Open Babel
3.0
|
#include <openbabel/data.h>
Public Member Functions | |
OBTypeTable (void) | |
~OBTypeTable () | |
void | ParseLine (const char *) |
size_t | GetSize () |
bool | SetFromType (const char *) |
bool | SetToType (const char *) |
bool | Translate (char *to, const char *from) |
bool | Translate (std::string &to, const std::string &from) |
std::string | Translate (const std::string &from) |
std::string | GetFromType () |
std::string | GetToType () |
void | Init () |
void | SetReadDirectory (char *dir) |
void | SetEnvironmentVariable (char *var) |
Protected Attributes | |
bool | _init |
const char * | _dataptr |
std::string | _filename |
std::string | _dir |
std::string | _subdir |
std::string | _envvar |
Atom Type Translation Table.
Molecular file formats frequently store information about atoms in an atom type field. Some formats store only the element for each atom, while others include hybridization and local environments, such as the Sybyl mol2 atom type field. The OBTypeTable class acts as a translation table to convert atom types between a number of different molecular file formats. The constructor for OBTypeTable automatically reads the text file types.txt. An instance of OBTypeTable (ttab) is declared external in data.cpp and is referenced as extern OBTypeTable ttab in mol.h. The following code demonstrates how to use the OBTypeTable class to translate the internal representation of atom types in an OBMol Internal to Sybyl Mol2 atom types.
Current atom types include (defined in the top line of the data file types.txt):
OBTypeTable | ( | void | ) |
|
inline |
|
virtual |
Specified by particular table classes (parses an individual data line)
Reimplemented from OBGlobalDataBase.
|
inlinevirtual |
Reimplemented from OBGlobalDataBase.
bool SetFromType | ( | const char * | from | ) |
Set the initial atom type to be translated.
bool SetToType | ( | const char * | to | ) |
Set the destination atom type for translation.
bool Translate | ( | char * | to, |
const char * | from | ||
) |
Translate atom types.
Translates atom types (to, from), checking for size of destination string and null-terminating as needed
bool Translate | ( | std::string & | to, |
const std::string & | from | ||
) |
Translate atom types
std::string Translate | ( | const std::string & | from | ) |
Translate atom types
std::string GetFromType | ( | ) |
std::string GetToType | ( | ) |
|
inherited |
Read in the data file, falling back as needed.
Referenced by OBRotorList::Init().
|
inlineinherited |
Set the directory before calling Init()
|
inlineinherited |
Set the environment variable to use before calling Init()
|
protectedinherited |
Whether the data been read already.
|
protectedinherited |
Default data table if file is unreadable.
|
protectedinherited |
File to search for.
|
protectedinherited |
Data directory for file if _envvar fails.
|
protectedinherited |
Subdirectory (if using environment variable)
|
protectedinherited |
Environment variable to check first.