OpTransform Class Reference

Applies molecular transforms (OBChemTsfm class) read from a datafile. More...

#include <openbabel/optransform.h>

Inheritance diagram for OpTransform:

List of all members.

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 OpTransformMakeInstance (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 PluginMapTypeGetMap () const =0

Static Public Member Functions

static std::string OpOptions (OBBase *pOb)
static bool DoOps (OBBase *pOb, OpMap *pOptions)
static OBPluginGetPlugin (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 PluginMapTypePluginMap ()
static PluginMapTypeGetTypeMap (const char *PluginID)
static OBPluginBaseFindType (PluginMapType &Map, const char *ID)

Protected Attributes

const char * _id


Detailed Description

Applies molecular transforms (OBChemTsfm class) read from a datafile.

Since:
version 2.2

Member Typedef Documentation

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]


Constructor & Destructor Documentation

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]


Member Function Documentation

virtual const char* Description (  )  [virtual]

Required description of a sub-type.

Reimplemented from OBPlugin.

virtual bool WorksWith ( OBBase pOb  )  const [inline, virtual]

Checks that this op is being applied to the right kind of object(OBMol).

Implements OBOp.

virtual bool Do ( OBBase pOb,
OpMap pOptions = NULL,
const char *  OptionText = NULL 
) [virtual]

Carries out the transform.

Implements OBOp.

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]

Returns:
string describing options, for display with -H and to make checkboxes in GUI

Referenced by OBMol::ClassDescription().

static bool DoOps ( OBBase pOb,
OpMap pOptions 
) [inline, static, inherited]

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)

Returns:
false indicating object should not be output, if any Do() returns false

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]

virtual PluginMapType& GetMap (  )  const [pure virtual, inherited]

Returns the map of the subtypes.

Referenced by OBFormat::RegisterFormat().

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.


Member Data Documentation

const char* _id [protected, inherited]


The documentation for this class was generated from the following file: