Open Babel: OBGlobalDataBase Class Reference

Public Member Functions | Protected Attributes

# OBGlobalDataBase Class Reference

Base data table class, handles reading data files. More...

`#include <openbabel/data.h>`

Inheritance diagram for OBGlobalDataBase:

List of all members.

## Public Member Functions
| OBGlobalDataBase ()
virtual | ~OBGlobalDataBase ()
void | Init ()
virtual size_t | GetSize ()
void | SetReadDirectory (char *dir)
void | SetEnvironmentVariable (char *var)
virtual void | ParseLine (const char *)
## Protected Attributes
bool | _init
const char * | _dataptr
std::string | _filename
std::string | _dir
std::string | _subdir
std::string | _envvar

## Detailed Description

Base data table class, handles reading data files.

Base data table class--reads ASCII data files in various formats

1. Checks for the environment variable _envvar (defaults to "BABEL_DATADIR")

- Tries the _subdir directory if defined (def. "data") and then the main directory

1. Checks for the directory _dir (def. determined by the build environment)

- Tries the subdirectory corresponding to this version, then the main directory

1. Reverts to the compiled-in default data

## Constructor & Destructor Documentation

OBGlobalDataBase | ( | ) | `[inline]`

Constructor.

virtual ~OBGlobalDataBase | ( | ) | `[inline, virtual]`

Destructor.

## Member Function Documentation

void Init | ( | ) |

Read in the data file, falling back as needed.

virtual size_t GetSize | ( | ) | `[inline, virtual]`

Returns:
  the size of the database (for error checking)

Reimplemented in OBBondTyper, OBElementTable, OBIsotopeTable, OBTypeTable, OBResidueData, OBPhModel, OBRotorRules, OBAtomTyper, OBAromaticTyper, and OBRingTyper.

void SetReadDirectory | ( | char * | dir ) | `[inline]`

Set the directory before calling Init()

void SetEnvironmentVariable | ( | char * | var ) | `[inline]`

Set the environment variable to use before calling Init()

virtual void ParseLine | ( | const char * | ) | `[inline, virtual]`

Specified by particular table classes (parses an individual data line)

Reimplemented in OBBondTyper, OBElementTable, OBIsotopeTable, OBTypeTable, OBResidueData, OBPhModel, OBRotorRules, OBAtomTyper, OBAromaticTyper, and OBRingTyper.

## Member Data Documentation

bool _init`[protected]`

Whether the data been read already.

const char* _dataptr`[protected]`

Default data table if file is unreadable.

std::string _filename`[protected]`

File to search for.

std::string _dir`[protected]`

Data directory for file if _envvar fails.

std::string _subdir`[protected]`

Subdirectory (if using environment variable)

std::string _envvar`[protected]`

Environment variable to check first.

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

- data.h
- data.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines