gcu::Formula Class Reference

#include <gcu/formula.h>

List of all members.

Public Member Functions

 Formula (string entry) throw (parse_error)
char const * GetMarkup ()
map< int, int > & GetRawFormula ()
char const * GetRawMarkup ()
void SetFormula (string entry) throw (parse_error)
void Clear ()
double GetMolecularWeight (int &prec, bool &artificial)
void CalculateIsotopicPattern (IsotopicPattern &pattern)


Detailed Description

This class interprets a chemical formula provided as a string and make some calculations using it. Currently, it is able to calculate the raw formula, the molecular weight and the isotopic pattern.

Definition at line 84 of file formula.h.


Constructor & Destructor Documentation

gcu::Formula::Formula ( string  entry  )  throw (parse_error)

Parameters:
entry,: the formula to parse as a string. The constructor will emit a parse_error exception. if it cannot parse the given formula.


Member Function Documentation

char const* gcu::Formula::GetMarkup (  ) 

Returns:
the original formula as a pango markup.

map<int,int>& gcu::Formula::GetRawFormula (  ) 

Returns:
the raw formula as a map of atoms numbers indexed by atomic number Z.

char const* gcu::Formula::GetRawMarkup (  ) 

Returns:
the raw formula as a pango markup.

void gcu::Formula::SetFormula ( string  entry  )  throw (parse_error)

Parameters:
entry,: the formula to parse as a string. Calls Formula::Clear before parsing the new formula. The method will emit a parse_error exception if it cannot parse the given formula.

void gcu::Formula::Clear (  ) 

Clears all data.

double gcu::Formula::GetMolecularWeight ( int &  prec,
bool &  artificial 
)

Parameters:
prec,: will be filled with the precision (number of significative decimal figures).
artificial,: will be true if the formula contains an artificial element (with no natural isotope).
Returns:
the molecular weight corresponding to the formula.

void gcu::Formula::CalculateIsotopicPattern ( IsotopicPattern pattern  ) 

Parameters:
pattern,: the IsotopicPattern to be filled This method evaluates the isotopic pattern and fills the pattern parameter with the calculated data.


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

Generated on Wed Mar 19 19:27:25 2008 for The Gnome Chemistry Utils by  doxygen 1.5.5