# gcu::Residue Class Reference

`#include <gcu/residue.h>`

Inheritance diagram for gcu::Residue:

List of all members.

## Public Member Functions

| Residue ()
| Residue (char const *name, Document *doc=NULL)
virtual | ~Residue ()
std::map< int, int > const & | GetRawFormula () const
std::map< std::string, bool > const & | GetSymbols () const
std::map< std::string, std::string > const & | GetNames () const
void | SetName (char const *name)
void | AddSymbol (char const *symbol)
void | RemoveSymbol (char const *symbol)
virtual void | Load (xmlNodePtr node)
virtual bool | operator== (Molecule const &mol) const
char const * | GetName (void)
void | SetGeneric (bool val)
bool | GetGeneric (void) const
bool & | GetRefGeneric (void)
Document * | GetDocument (void)
Molecule * | GetMolecule (void)
Document * | GetOwner (void)

## Static Public Member Functions

static Residue const * | GetResidue (char const *symbol, bool *ambiguous=NULL)
static Residue const * | GetResiduebyName (char const *name)
static std::string const * | GetFirstResidueSymbol (ResidueIterator &i)
static std::string const * | GetNextResidueSymbol (ResidueIterator &i)

## Static Public Attributes

static unsigned | MaxSymbolLength

## Detailed Description

Represents the meaning of group symbols, such as Me, Ph or Bz. They have one or more associated symbols and a molecule which atoms and bonds are represented by the symbol. The molecule starts from a pseudo-atom with Z = 0, which represents the atom linked to the group. Currently only one pseudo-atom with one single bond to the group is allowed.

Definition at line 66 of file gcu/residue.h.

## Constructor & Destructor Documentation

gcu::Residue::Residue | ( |  | ) |

Creates a residue.

Reimplemented in gcp::Residue.

gcu::Residue::Residue | ( | char const * | name,
|  | Document * | doc = `NULL` |
| ) |  |  |

Parameters:

  | name | the name of the residue.
  | doc | the document owning the residue when it does not have global scope.

Creates a residue and sets its name.

virtual gcu::Residue::~Residue | ( |  | ) | `[virtual]`

The destructor.

Reimplemented in gcp::Residue.

## Member Function Documentation

std::map<int,int> const& gcu::Residue::GetRawFormula | ( |  | ) | const`[inline]`

Returns:
  the raw formula of the residue as a map of integers (number of atoms of an element) indexed by the atomic number of the element.

The following code gives the number of carbon atoms:

                    Residue *residue;
                    ... // initialize the residue
                    cout << "the residue has " << residue->GetRawFormula ()[6] << " carbon atoms." << endl;

Definition at line 98 of file gcu/residue.h.

std::map<std::string, bool> const& gcu::Residue::GetSymbols | ( |  | ) | const`[inline]`

Returns:
  the symbols of the atoms group as a std::map. The symbols index boolean values telling whether the symbol is ambiguous or not.

A symbol is ambiguous if it can also represent a single atom, such as Ac, or Pr.

Definition at line 105 of file gcu/residue.h.

std::map<std::string, std::string> const& gcu::Residue::GetNames | ( |  | ) | const`[inline]`

Returns:
  the names of the atoms group, as a std::map indexed by the correspondig locale.

Definition at line 110 of file gcu/residue.h.

void gcu::Residue::SetName | ( | char const * | name | ) |

Parameters:

  | name | the name to give to the Residue.

void gcu::Residue::AddSymbol | ( | char const * | symbol | ) |

Parameters:

  | symbol | a chemical symbol.

Adds symbol to the list of valid symbols for the atoms group.

void gcu::Residue::RemoveSymbol | ( | char const * | symbol | ) |

Parameters:

  | symbol | a chemical symbol.

Removes symbol from the list of valid symbols for the atoms group.

virtual void gcu::Residue::Load | ( | xmlNodePtr | node | ) | `[virtual]`

Parameters:

  | node | a XMLNode* representing the residue.

loads the residu from an XML file.

static Residue const* gcu::Residue::GetResidue | ( | char const * | symbol,
|  | bool * | ambiguous = `NULL` |
| ) |  |  | `[static]`

Parameters:

  | symbol | the symbol for which a Residue* is searched.
  | ambiguous | where to store the boolean telling if the symbol is ambiguous or NULL.

Returns:
  the Residue* found or NULL.

static Residue const* gcu::Residue::GetResiduebyName | ( | char const * | name | ) | `[static]`

Parameters:

  | name | the name for which a Residue* is searched.

Returns:
  the Residue* found or NULL.

static std::string const* gcu::Residue::GetFirstResidueSymbol | ( | ResidueIterator & | i | ) | `[static]`

Parameters:

  | i | an iterator.

Used to iterate through all known atoms groups and their symbols. Initializes the iterator.

Returns:
  the first known symbol. If not NULL, the iterator gives access to the associated Residue througn a gcu::SymbolResidue structure.

static std::string const* gcu::Residue::GetNextResidueSymbol | ( | ResidueIterator & | i | ) | `[static]`

Parameters:

  | i | an iterator initialized by Residue::GetFirstResidueSymbol.

Used to iterate through all known atoms groups and their symbols. Initializes the iterator.

Returns:
  the next known symbol. If not NULL, the iterator gives access to the associated Residue through a gcu::SymbolResidue structure.

virtual bool gcu::Residue::operator== | ( | Molecule const & | mol | ) | const`[inline, virtual]`

Parameters:

  | mol | a molecule to compare to the atoms group.

Returns:
  true if the molecule is the same as the one associated with this.

Reimplemented in gcp::Residue.

Definition at line 170 of file gcu/residue.h.

gcu::Residue::GetName | ( | void |  | ) | `[inline]`

Returns:
  the name of the Residue instance.

Definition at line 187 of file gcu/residue.h.

gcu::Residue::SetGeneric | ( | bool | Generic | ) | `[inline]`

Parameters:

  | Generic | whether the symbol is a generic symbol or not.

Generic symbols are such symbols as R, Ar, or X which might represent various atoms or groups of atoms. When expanded, they will be replaced by a default value, for example, R will expand to a methyl, and Ar to a phenyl group.

Definition at line 202 of file gcu/residue.h.

gcu::Residue::GetGeneric | ( | void |  | ) | const`[inline]`

Returns:
  whether the symbol is a generic symbol or not.

Definition at line 202 of file gcu/residue.h.

gcu::Residue::GetRefGeneric | ( | void |  | ) | `[inline]`

Returns:
  whether the symbol is a generic symbol or not as a reference to a boolean variable.

Definition at line 202 of file gcu/residue.h.

gcu::Residue::GetDocument | ( | void |  | ) | `[inline]`

Returns the gcu::Document* used to store the molecule associated with the atoms group.

Definition at line 207 of file gcu/residue.h.

gcu::Residue::GetMolecule | ( | void |  | ) | `[inline]`

Returns the gcu::Molecule* describing the structure of the atoms group.

Definition at line 212 of file gcu/residue.h.

gcu::Residue::GetOwner | ( | void |  | ) | `[inline]`

Returns:
  the Document for which the Residue is valid. If NULL, the Residue is of global scope.

Definition at line 217 of file gcu/residue.h.

## Member Data Documentation

unsigned gcu::Residue::MaxSymbolLength `[static]`

Returns:
  the maxium length of all known symbols. This is used by the framework when parsing a string formula.

Definition at line 177 of file gcu/residue.h.

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

- gcu/residue.h