Open Babel
3.0
|
#include <openbabel/obconversion.h>
Public Types | |
typedef std::map< const char *, OBPlugin *, CharPtrLess > | PluginMapType |
typedef PluginMapType::const_iterator | PluginIterator |
Public Member Functions | |
OBFormat () | |
const char * | TypeID () |
virtual bool | ReadMolecule (OBBase *, OBConversion *) |
virtual bool | ReadChemObject (OBConversion *) |
virtual bool | WriteMolecule (OBBase *, OBConversion *) |
virtual bool | WriteChemObject (OBConversion *) |
virtual const char * | Description ()=0 |
virtual const char * | TargetClassDescription () |
virtual const std::type_info & | GetType () |
virtual const char * | SpecificationURL () |
virtual const char * | GetMIMEType () |
virtual unsigned int | Flags () |
virtual int | SkipObjects (int, OBConversion *) |
virtual OBFormat * | MakeNewInstance () |
int | RegisterFormat (const char *ID, const char *MIME=NULL) |
virtual bool | Display (std::string &txt, const char *param, const char *ID=NULL) |
virtual OBPlugin * | MakeInstance (const std::vector< std::string > &) |
virtual void | Init () |
const char * | GetID () const |
virtual PluginMapType & | GetMap () const =0 |
Static Public Member Functions | |
static OBFormat * | FormatFromMIME (const char *MIME) |
static OBPlugin * | GetPlugin (const char *Type, const char *ID) |
static bool | ListAsVector (const char *PluginID, const char *param, std::vector< std::string > &vlist) |
static void | List (const char *PluginID, const char *param=NULL, std::ostream *os=&std::cout) |
static std::string | ListAsString (const char *PluginID, const char *param=NULL) |
static std::string | FirstLine (const char *txt) |
static PluginIterator | Begin (const char *PluginID) |
static PluginIterator | End (const char *PluginID) |
static void | LoadAllPlugins () |
Static Protected Member Functions | |
static PluginMapType & | PluginMap () |
static PluginMapType & | GetTypeMap (const char *PluginID) |
static OBPlugin * | BaseFindType (PluginMapType &Map, const char *ID) |
Protected Attributes | |
const char * | _id |
Static Protected Attributes | |
static int | AllPluginsLoaded = 0 |
Base class for file formats.
Two sets of Read and Write functions are specified for each format to handle two different requirements. The "Convert" interface is for use in file format conversion applications. The user interface, a console, a GUI, or another program is kept unaware of the details of the chemistry and does not need to #include mol.h. It is then necessary to manipulate only pointers to OBBase in OBConversion and the user interface, with all the construction and deletion of OBMol etc objects being done in the Format classes or the OB core. The convention with "Covert" interface functions is that chemical objects are made on the heap with new in the ReadChemicalObject() functions and and deleted in WriteChemicalObject() functions
The "API" interface is for programatic use of the OB routines in application programs where mol.h is #included. There is generally no creation or destruction of objects in ReadMolecule() and WriteMolecule() and no restriction on whether the pointers are to the heap or the stack.
|
inline |
Default constructor. Registration via RegisterFormat(), not via constructor as in other plugins.
|
inlinevirtual |
Redefined by each plugin type: "formats", "fingerprints", etc.
Reimplemented from OBPlugin.
|
inlinevirtual |
The "API" interface Read function.
Reads a single object. Does not make a new object on the heap; can be used with a pointer to an chem object on the heap or the stack.
Reimplemented in XMLMoleculeFormat.
Referenced by OBMoleculeFormat::DeferMolOutput(), OBConversion::Read(), and OBMoleculeFormat::ReadChemObjectImpl().
|
inlinevirtual |
The "Convert" interface Read function.
Possibly reads multiple new objects on the heap and subjects them to its DoTransformations() function, which may delete them again. Sends result to pConv->AddChemObject()
Reimplemented in XMLMoleculeFormat, and OBMoleculeFormat.
Referenced by OBConversion::Convert().
|
inlinevirtual |
The "API" interface Write function.
Writes a single object Does not delete the object; can be used with a pointer to an chem object on the heap or the stack.
Referenced by OBMoleculeFormat::DeleteDeferredMols(), OBMoleculeFormat::DoOutputOptions(), OBMoleculeFormat::OutputDeferredMols(), OBConversion::Write(), and OBMoleculeFormat::WriteChemObjectImpl().
|
inlinevirtual |
The "Convert" interface Write function.
Writes a single object Deletes the object after writing
Reimplemented in XMLMoleculeFormat, and OBMoleculeFormat.
Referenced by OBConversion::AddChemObject(), and OBConversion::Convert().
|
pure virtual |
Information on this format. Printed out in response to -Hxxx option where xxx id the id of the format.
Must be provided by each format class. Can include a list of command line Options. These may be used to construction check boxes, radio buttons etc for GUI interface.
Reimplemented from OBPlugin.
Referenced by OBConversion::GetNextFormat(), and OBConversion::RegisterOptionParam().
|
virtual |
A decription of the chemical object converted by this format.
If not provided, the object type used by the default format is used (usually OBMol).
Referenced by OBConversion::ReportNumberConverted().
|
virtual |
Reimplemented in XMLMoleculeFormat, and OBMoleculeFormat.
|
inlinevirtual |
Web address where the format is defined.
|
inlinevirtual |
Chemical MIME type associated with this file type (if any)
|
inlinevirtual |
Decribes the capabilities of the format (Read only etc.)
Currently, can be a bitwise OR of any of the following NOTREADABLE READONEONLY NOTWRITABLE WRITEONEONLY DEFAULTFORMAT READBINARY WRITEBINARY READXML
Referenced by OBConversion::AddChemObject(), OBConversion::Convert(), OBMoleculeFormat::DeleteDeferredMols(), OBConversion::GetNextFormat(), OBMoleculeFormat::ReadChemObjectImpl(), OBConversion::SetInFormat(), OBConversion::SetInStream(), and OBConversion::SetOutFormat().
|
inlinevirtual |
Skip past first n objects in input stream (or current one with n=0)
Reimplemented in XMLBaseFormat.
Referenced by OBConversion::Convert(), OBConversion::NumInputObjects(), and OBConversion::SetStartAndEnd().
|
inlinevirtual |
int RegisterFormat | ( | const char * | ID, |
const char * | MIME = NULL |
||
) |
Referenced by OBConversion::RegisterFormat().
|
virtual |
Provides a description in txt of the format specified by itr. If param starts with "in", "read", "out" or "write" only the appropriate formats are output. The others return false. If param contains "verbose", the whole description is output.
Reimplemented from OBPlugin.
|
static |
Referenced by OBConversion::FormatFromMIME().