#include <openbabel/plugin.h>
Public Types | |
typedef std::map< const char *, OBPlugin *, CharPtrLess > | PluginMapType |
typedef PluginMapType::const_iterator | PluginIterator |
Public Member Functions | |
virtual | ~OBPlugin () |
virtual const char * | Description () |
virtual bool | Display (std::string &txt, const char *param, const char *ID=NULL) |
virtual OBPlugin * | MakeInstance (const std::vector< std::string > &) |
const char * | GetID () const |
virtual PluginMapType & | GetMap () const =0 |
Static Public Member Functions | |
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 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 |
typedef std::map<const char*, OBPlugin*, CharPtrLess> PluginMapType |
typedef PluginMapType::const_iterator PluginIterator |
virtual ~OBPlugin | ( | ) | [inline, virtual] |
Virtual destructor necessary for classes with virtual functions.
virtual const char* Description | ( | ) | [inline, virtual] |
Required description of a sub-type.
Reimplemented in OBFormat, OBGroupContrib, and OpTransform.
Referenced by OBPlugin::Display(), and OBOp::OpOptions().
bool Display | ( | std::string & | txt, | |
const char * | param, | |||
const char * | ID = NULL | |||
) | [virtual] |
Write information on a plugin class to the string txt. Return false if not written. The default implementation outputs: the ID, a tab character, and the first line of the Description. The param string can be used in derived types to provide different outputs.
Reimplemented in OBDescriptor, and OBFormat.
Referenced by OBDescriptor::Display().
virtual OBPlugin* MakeInstance | ( | const std::vector< std::string > & | ) | [inline, virtual] |
Make a new instance of the class. See OpTransform, OBGroupContrib, SmartsDescriptor classes for derived versions. Usually, the first parameter is the classname, the next three are parameters(ID, filename, description) for a constructor, and the rest data.
Reimplemented in OBGroupContrib, and OpTransform.
Referenced by OBConversion::LoadFormatFiles().
static OBPlugin* GetPlugin | ( | const char * | Type, | |
const char * | ID | |||
) | [inline, static] |
Get a pointer to a plugin from its type and ID. Return NULL if not found. Not cast to Type*.
Referenced by OBConversion::LoadFormatFiles().
const char* GetID | ( | ) | const [inline] |
Return the ID of the sub-type instance.
Referenced by OBPlugin::Display(), OBFormat::Display(), and OBDescriptor::PredictAndSave().
bool ListAsVector | ( | const char * | PluginID, | |
const char * | param, | |||
std::vector< std::string > & | vlist | |||
) | [static] |
Output a list of sub-type classes of the the type PluginID, or, if PluginID is "plugins" or empty, a list of the base types. If PluginID is not recognized or is NULL, the base types are output and the return is false.
Referenced by OBConversion::GetSupportedInputFormat(), OBConversion::GetSupportedOutputFormat(), and OBPlugin::List().
void List | ( | const char * | PluginID, | |
const char * | param = NULL , |
|||
std::ostream * | os = &std::cout | |||
) | [static] |
As ListAsVector but sent to an ostream with a default of cout if not specified.
Referenced by OBPlugin::ListAsString().
string ListAsString | ( | const char * | PluginID, | |
const char * | param = NULL | |||
) | [static] |
As ListAsVector but returns a string containing the list.
string FirstLine | ( | const char * | txt | ) | [static] |
Utility function to return only the first line of a string.
Referenced by OBPlugin::Display(), OBFormat::Display(), and OBOp::OpOptions().
static PluginIterator Begin | ( | const char * | PluginID | ) | [inline, static] |
Return an iterator at the start of the map of the plugin types PluginID or, if there is no such map, the end of the top level plugin map.
Referenced by OBConversion::GetNextFormat(), and OBOp::OpOptions().
static PluginIterator End | ( | const char * | PluginID | ) | [inline, static] |
Referenced by OBConversion::GetNextFormat(), and OBOp::OpOptions().
virtual PluginMapType& GetMap | ( | ) | const [pure virtual] |
static PluginMapType& PluginMap | ( | ) | [inline, static, protected] |
Returns a reference to the map of the plugin types. Is a function rather than a static member variable to avoid initialization problems.
Referenced by OBPlugin::GetTypeMap(), OBPlugin::ListAsVector(), and OBFormat::RegisterFormat().
OBPlugin::PluginMapType & GetTypeMap | ( | const char * | PluginID | ) | [static, protected] |
Returns the map of a particular plugin type, e.g. GetMapType("fingerprints").
static OBPlugin* BaseFindType | ( | PluginMapType & | Map, | |
const char * | ID | |||
) | [inline, static, protected] |
Returns the type with the specified ID, or NULL if not found. Will be cast to the appropriate class in the calling routine.
const char* _id [protected] |
Referenced by OBFormat::RegisterFormat().