#include <openbabel/optransform.h>
Public Types | |
typedef const std::map < std::string, std::string > | OpMap |
typedef std::map< const char *, OBPlugin *, CharPtrLess > | PluginMapType |
typedef PluginMapType::const_iterator | PluginIterator |
Public Member Functions | |
OpTransform (const char *ID, const char *filename, const char *descr) | |
~OpTransform () | |
virtual const char * | Description () |
virtual bool | WorksWith (OBBase *pOb) const |
virtual bool | Do (OBBase *pOb, OpMap *pOptions=NULL, const char *OptionText=NULL) |
virtual OpTransform * | MakeInstance (const std::vector< std::string > &textlines) |
virtual const char * | TypeID () |
virtual bool | Display (std::string &txt, const char *param, const char *ID=NULL) |
const char * | GetID () const |
virtual PluginMapType & | GetMap () const =0 |
Static Public Member Functions | |
static std::string | OpOptions (OBBase *pOb) |
static bool | DoOps (OBBase *pOb, OpMap *pOptions) |
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 const std::map<std::string, std::string> OpMap [inherited] |
typedef std::map<const char*, OBPlugin*, CharPtrLess> PluginMapType [inherited] |
typedef PluginMapType::const_iterator PluginIterator [inherited] |
OpTransform | ( | const char * | ID, | |
const char * | filename, | |||
const char * | descr | |||
) | [inline] |
constructor. Each instance provides an ID, a datafile and a description.
Referenced by OpTransform::MakeInstance().
~OpTransform | ( | ) | [inline] |
virtual const char* Description | ( | ) | [virtual] |
virtual bool WorksWith | ( | OBBase * | pOb | ) | const [inline, virtual] |
virtual OpTransform* 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 from OBPlugin.
virtual const char* TypeID | ( | ) | [inline, virtual, inherited] |
Provides the name of this kind of plugin. Use -L "ops" to list from commandline.
static std::string OpOptions | ( | OBBase * | pOb | ) | [inline, static, inherited] |
Referenced by OBMol::ClassDescription().
Call Do() of all the OBOps whose ID is a key in the map. Called from Transform(). The map has general options like -x or --multicharoption The key is the option name and the value, if any, is text which follows the option name. In some cases, there may be several parameters, space separated)
Referenced by OBMol::DoTransformations().
bool Display | ( | std::string & | txt, | |
const char * | param, | |||
const char * | ID = NULL | |||
) | [virtual, inherited] |
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().
static OBPlugin* GetPlugin | ( | const char * | Type, | |
const char * | ID | |||
) | [inline, static, inherited] |
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, inherited] |
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, inherited] |
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, inherited] |
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, inherited] |
As ListAsVector but returns a string containing the list.
string FirstLine | ( | const char * | txt | ) | [static, inherited] |
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, inherited] |
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, inherited] |
Referenced by OBConversion::GetNextFormat(), and OBOp::OpOptions().
virtual PluginMapType& GetMap | ( | ) | const [pure virtual, inherited] |
static PluginMapType& PluginMap | ( | ) | [inline, static, protected, inherited] |
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, inherited] |
Returns the map of a particular plugin type, e.g. GetMapType("fingerprints").
static OBPlugin* BaseFindType | ( | PluginMapType & | Map, | |
const char * | ID | |||
) | [inline, static, protected, inherited] |
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, inherited] |
Referenced by OBFormat::RegisterFormat().