Chemical Data Processing Library Python API - Version 1.2.0
Classes | Static Public Member Functions | Static Public Attributes | List of all members
CDPL.Chem.MolecularGraphIOManager Class Reference

A singleton class that serves as a global registry for Chem.MolecularGraphInputHandler and Chem.MolecularGraphOutputHandler implementation instances. More...

+ Inheritance diagram for CDPL.Chem.MolecularGraphIOManager:

Classes

class  InputHandlerSequence
 
class  OutputHandlerSequence
 

Static Public Member Functions

None registerInputHandler (MolecularGraphInputHandler handler)
 Registers the specified Chem.MolecularGraphInputHandler implementation instance. More...
 
MolecularGraphInputHandler getInputHandler (int idx)
 Returns a reference to the registered Chem.MolecularGraphInputHandler implementation instance with the specified index. More...
 
MolecularGraphInputHandler getInputHandlerByFormat (Base.DataFormat fmt)
 Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the specified data format. More...
 
MolecularGraphInputHandler getInputHandlerByName (str name)
 Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified name. More...
 
MolecularGraphInputHandler getInputHandlerByFileExtension (str file_ext)
 Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified file extension. More...
 
MolecularGraphInputHandler getInputHandlerByFileName (str file_name)
 Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format matching the extension of file_name. More...
 
MolecularGraphInputHandler getInputHandlerByMimeType (str mime_type)
 Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified mime-type. More...
 
bool unregisterInputHandler (Base.DataFormat fmt)
 Unregisters the Chem.MolecularGraphInputHandler implementation instance for the specified data format. More...
 
None unregisterInputHandler (int idx)
 Unregisters the Chem.MolecularGraphInputHandler implementation instance with the specified index. More...
 
bool unregisterInputHandler (MolecularGraphInputHandler handler)
 Unregisters the specified Chem.MolecularGraphInputHandler implementation instance. More...
 
int getNumInputHandlers ()
 Returns the number of registered Chem.MolecularGraphInputHandler implementation instances. More...
 
InputHandlerSequence getInputHandlers ()
 
None registerOutputHandler (MolecularGraphOutputHandler handler)
 Registers the specified Chem.MolecularGraphOutputHandler implementation instance. More...
 
MolecularGraphOutputHandler getOutputHandler (int idx)
 Returns a reference to the registered Chem.MolecularGraphOutputHandler implementation instance with the specified index. More...
 
MolecularGraphOutputHandler getOutputHandlerByFormat (Base.DataFormat fmt)
 Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the specified data format. More...
 
MolecularGraphOutputHandler getOutputHandlerByName (str name)
 Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified name. More...
 
MolecularGraphOutputHandler getOutputHandlerByFileExtension (str file_ext)
 Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified file extension. More...
 
MolecularGraphOutputHandler getOutputHandlerByFileName (str file_name)
 Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format matching the extension of file_name. More...
 
MolecularGraphOutputHandler getOutputHandlerByMimeType (str mime_type)
 Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified mime-type. More...
 
bool unregisterOutputHandler (Base.DataFormat fmt)
 Unregisters the Chem.MolecularGraphOutputHandler implementation instance for the specified data format. More...
 
None unregisterOutputHandler (int idx)
 Unregisters the Chem.MolecularGraphOutputHandler implementation instance with the specified index. More...
 
bool unregisterOutputHandler (MolecularGraphOutputHandler handler)
 Unregisters the specified Chem.MolecularGraphOutputHandler implementation instance. More...
 
int getNumOutputHandlers ()
 Returns the number of registered Chem.MolecularGraphOutputHandler implementation instances. More...
 
OutputHandlerSequence getOutputHandlers ()
 

Static Public Attributes

 inputHandlers = _HIDDEN_VALUE_
 
int numInputHandlers = 0
 
 outputHandlers = _HIDDEN_VALUE_
 
int numOutputHandlers = 33
 

Detailed Description

A singleton class that serves as a global registry for Chem.MolecularGraphInputHandler and Chem.MolecularGraphOutputHandler implementation instances.

DataIOManager provides static methods for the registration and lookup of Chem.MolecularGraphInputHandler and Chem.MolecularGraphOutputHandler implementation instances that handle different input and output storage formats.

Input and output handlers are registered by the methods registerInputHandler() and registerOutputHandler(). These methods expect a reference to an instance of the respective handler implementation as an argument (please note that the registered instance must not be destroyed as long as it is accessible via the DataIOManager interface!).

For the removal of registered handlers the unregisterInputHandler() and unregisterOutputHandler() family of overloaded methods is provided. These methods accept a reference to the registered handler instance, the handler index, the handled data format or an iterator pointing to the handler as an argument.

Registered input handlers can be queried by the methods getInputHandlerByFormat(), getInputHandlerByName(), getInputHandlerByFileExtension() and getInputHandlerByMimeType(), which allow to find a suitable handler for a given data format, data format name, file extension or mime-type. For the registered output handlers similar methods are provided.

I/O handlers for data formats and object types supported by the CDPL are registered in the static library initialization code. These built-in handlers are accessible by the linking client code as soon as the library initialization has finished.

Member Function Documentation

◆ registerInputHandler()

None CDPL.Chem.MolecularGraphIOManager.registerInputHandler ( MolecularGraphInputHandler  handler)
static

Registers the specified Chem.MolecularGraphInputHandler implementation instance.

Parameters
handlerThe Chem.MolecularGraphInputHandler implementation instance to register.

◆ getInputHandler()

MolecularGraphInputHandler CDPL.Chem.MolecularGraphIOManager.getInputHandler ( int  idx)
static

Returns a reference to the registered Chem.MolecularGraphInputHandler implementation instance with the specified index.

Parameters
idxThe zero-based index of the Chem.MolecularGraphInputHandler implementation instance to return.
Returns
A reference to the Chem.MolecularGraphInputHandler implementation instance with the specified index.
Exceptions
Base.IndexErrorif idx is out of bounds.

◆ getInputHandlerByFormat()

MolecularGraphInputHandler CDPL.Chem.MolecularGraphIOManager.getInputHandlerByFormat ( Base.DataFormat  fmt)
static

Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the specified data format.

Parameters
fmtSpecifies the data format that is associated with the requested Chem.MolecularGraphInputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphInputHandler implementation instance registered for the specified data format, or None if not available.

◆ getInputHandlerByName()

MolecularGraphInputHandler CDPL.Chem.MolecularGraphIOManager.getInputHandlerByName ( str  name)
static

Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified name.

Parameters
nameSpecifies the name of the data format that is associated with the requested Chem.MolecularGraphInputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified name, or None if not available.
Note
The matching of the name is not case-sensitive.

◆ getInputHandlerByFileExtension()

MolecularGraphInputHandler CDPL.Chem.MolecularGraphIOManager.getInputHandlerByFileExtension ( str  file_ext)
static

Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified file extension.

Parameters
file_extSpecifies the file extension of the data format that is associated with the requested Chem.MolecularGraphInputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified file extension, or None if not available.
Note
The matching of the file extension is not case-sensitive.

◆ getInputHandlerByFileName()

MolecularGraphInputHandler CDPL.Chem.MolecularGraphIOManager.getInputHandlerByFileName ( str  file_name)
static

Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format matching the extension of file_name.

Parameters
file_nameSpecifies the file name for which to search for a data format that matches its extension.
Returns
A reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format matching the extension of file_name, or None if not available.
Note
The matching of the file extension is not case-sensitive.

◆ getInputHandlerByMimeType()

MolecularGraphInputHandler CDPL.Chem.MolecularGraphIOManager.getInputHandlerByMimeType ( str  mime_type)
static

Returns a reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified mime-type.

Parameters
mime_typeSpecifies the mime-type of the data format that is associated with the requested Chem.MolecularGraphInputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphInputHandler implementation instance registered for the data format with the specified mime-type, or None if not available.
Note
The matching of the mime-type is not case-sensitive.

◆ unregisterInputHandler() [1/3]

bool CDPL.Chem.MolecularGraphIOManager.unregisterInputHandler ( Base.DataFormat  fmt)
static

Unregisters the Chem.MolecularGraphInputHandler implementation instance for the specified data format.

Only one handler instance at a time will be unregistered (in a first in - first out manner). If more than one handler instance has been registered for the given data format, the method has to be called multiple times to unregister all instances.

Parameters
fmtSpecifies the data format that is associated with the handler instance to unregister.
Returns
True if a handler instance for the specified data format was found and has been unregistered, and False otherwise.

◆ unregisterInputHandler() [2/3]

None CDPL.Chem.MolecularGraphIOManager.unregisterInputHandler ( int  idx)
static

Unregisters the Chem.MolecularGraphInputHandler implementation instance with the specified index.

Parameters
idxThe zero-based index of the Chem.MolecularGraphInputHandler implementation instance to unregister.
Exceptions
Base.IndexErrorif idx is out of bounds.

◆ unregisterInputHandler() [3/3]

bool CDPL.Chem.MolecularGraphIOManager.unregisterInputHandler ( MolecularGraphInputHandler  handler)
static

Unregisters the specified Chem.MolecularGraphInputHandler implementation instance.

Parameters
handlerThe Chem.MolecularGraphInputHandler implementation instance to unregister.
Returns
True if the handler instance was found and has been unregistered, and False otherwise.

◆ getNumInputHandlers()

int CDPL.Chem.MolecularGraphIOManager.getNumInputHandlers ( )
static

Returns the number of registered Chem.MolecularGraphInputHandler implementation instances.

Returns
The number of registered Chem.MolecularGraphInputHandler implementation instances.

◆ getInputHandlers()

InputHandlerSequence CDPL.Chem.MolecularGraphIOManager.getInputHandlers ( )
static
Parameters
<br>
Returns

◆ registerOutputHandler()

None CDPL.Chem.MolecularGraphIOManager.registerOutputHandler ( MolecularGraphOutputHandler  handler)
static

Registers the specified Chem.MolecularGraphOutputHandler implementation instance.

Parameters
handlerThe Chem.MolecularGraphOutputHandler implementation instance to register.

◆ getOutputHandler()

MolecularGraphOutputHandler CDPL.Chem.MolecularGraphIOManager.getOutputHandler ( int  idx)
static

Returns a reference to the registered Chem.MolecularGraphOutputHandler implementation instance with the specified index.

Parameters
idxThe zero-based index of the Chem.MolecularGraphOutputHandler implementation instance to return.
Returns
A reference to the Chem.MolecularGraphOutputHandler implementation instance with the specified index.
Exceptions
Base.IndexErrorif idx is out of bounds.

◆ getOutputHandlerByFormat()

MolecularGraphOutputHandler CDPL.Chem.MolecularGraphIOManager.getOutputHandlerByFormat ( Base.DataFormat  fmt)
static

Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the specified data format.

Parameters
fmtSpecifies the data format that is associated with the requested Chem.MolecularGraphOutputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the specified data format, or None if not available.

◆ getOutputHandlerByName()

MolecularGraphOutputHandler CDPL.Chem.MolecularGraphIOManager.getOutputHandlerByName ( str  name)
static

Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified name.

Parameters
nameSpecifies the name of the data format that is associated with the requested Chem.MolecularGraphOutputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified name, or None if not available.
Note
The matching of the name is not case-sensitive.

◆ getOutputHandlerByFileExtension()

MolecularGraphOutputHandler CDPL.Chem.MolecularGraphIOManager.getOutputHandlerByFileExtension ( str  file_ext)
static

Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified file extension.

Parameters
file_extSpecifies the file extension of the data format that is associated with the requested Chem.MolecularGraphOutputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified file extension, or None if not available.
Note
The matching of the file extension is not case-sensitive.

◆ getOutputHandlerByFileName()

MolecularGraphOutputHandler CDPL.Chem.MolecularGraphIOManager.getOutputHandlerByFileName ( str  file_name)
static

Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format matching the extension of file_name.

Parameters
file_nameSpecifies the file name for which to search for a data format that matches its extension.
Returns
A reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format matching the extension of file_name, or None if not available.
Note
The matching of the file extension is not case-sensitive.

◆ getOutputHandlerByMimeType()

MolecularGraphOutputHandler CDPL.Chem.MolecularGraphIOManager.getOutputHandlerByMimeType ( str  mime_type)
static

Returns a reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified mime-type.

Parameters
mime_typeSpecifies the mime-type of the data format that is associated with the requested Chem.MolecularGraphOutputHandler implementation instance.
Returns
A reference to a Chem.MolecularGraphOutputHandler implementation instance registered for the data format with the specified mime-type, or None if not available.
Note
The matching of the mime-type is not case-sensitive.

◆ unregisterOutputHandler() [1/3]

bool CDPL.Chem.MolecularGraphIOManager.unregisterOutputHandler ( Base.DataFormat  fmt)
static

Unregisters the Chem.MolecularGraphOutputHandler implementation instance for the specified data format.

Only one handler instance at a time will be unregistered (in a first in - first out manner). If more than one handler instance has been registered for the given data format, the method has to be called multiple times to unregister all instances.

Parameters
fmtSpecifies the data format that is associated with the handler instance to unregister.
Returns
True if a handler instance for the specified data format was found and has been unregistered, and False otherwise.

◆ unregisterOutputHandler() [2/3]

None CDPL.Chem.MolecularGraphIOManager.unregisterOutputHandler ( int  idx)
static

Unregisters the Chem.MolecularGraphOutputHandler implementation instance with the specified index.

Parameters
idxThe zero-based index of the Chem.MolecularGraphOutputHandler implementation instance to unregister.
Exceptions
Base.IndexErrorif idx is out of bounds.

◆ unregisterOutputHandler() [3/3]

bool CDPL.Chem.MolecularGraphIOManager.unregisterOutputHandler ( MolecularGraphOutputHandler  handler)
static

Unregisters the specified Chem.MolecularGraphOutputHandler implementation instance.

Parameters
handlerThe Chem.MolecularGraphOutputHandler implementation instance to unregister.
Returns
True if the handler instance was found and has been unregistered, and False otherwise.

◆ getNumOutputHandlers()

int CDPL.Chem.MolecularGraphIOManager.getNumOutputHandlers ( )
static

Returns the number of registered Chem.MolecularGraphOutputHandler implementation instances.

Returns
The number of registered Chem.MolecularGraphOutputHandler implementation instances.

◆ getOutputHandlers()

OutputHandlerSequence CDPL.Chem.MolecularGraphIOManager.getOutputHandlers ( )
static
Parameters
<br>
Returns