<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>The Gnome Chemistry Utils: gcu::Formula Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespacegcu.html">gcu</a>::<a class="el" href="classgcu_1_1Formula.html">Formula</a> </div> </div> <div class="contents"> <h1>gcu::Formula Class Reference</h1><!-- doxytag: class="gcu::Formula" --> <p><code>#include <<a class="el" href="formula_8h_source.html">gcu/formula.h</a>></code></p> <p><a href="classgcu_1_1Formula-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#ae1c51535d0054f7c5cbdd057534d11e7">Formula</a> (std::string entry, <a class="el" href="namespacegcu.html#a49392c345f0740efd3167eb30aca570e">FormulaParseMode</a> mode=GCU_FORMULA_PARSE_GUESS) throw (parse_error)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#ac5ebbcba608d87e5fcb30eb80f3f0a7a">~Formula</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">char const * </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#a11e89053abc2f9633e0664a3579a5deb">GetMarkup</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">std::map< int, int > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#ab1c834fc7ba943809bf26976e938fca9">GetRawFormula</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">char const * </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#a08f21e12b0f6bf643a0ac12422f7d6f3">GetRawMarkup</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#a890a3386514b2dffec1f7f1562d9cc72">SetFormula</a> (std::string entry) throw (parse_error)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#a71a32179a7a25aaa067b2340a3dd6cdc">Clear</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classgcu_1_1DimensionalValue.html">DimensionalValue</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#a4c72c8bedf531762c85a2350b049d571">GetMolecularWeight</a> (bool &artificial)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#a8672e0b7f13cfe9e925c7cf4a5098f63">CalculateIsotopicPattern</a> (<a class="el" href="classgcu_1_1IsotopicPattern.html">IsotopicPattern</a> &pattern)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">std::list< <a class="el" href="classgcu_1_1FormulaElt.html">FormulaElt</a> * > const & </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcu_1_1Formula.html#ab36e337dd70844ef94ce2cb79be12c2b">GetElements</a> () const </td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>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. </p> <p>Definition at line <a class="el" href="formula_8h_source.html#l00285">285</a> of file <a class="el" href="formula_8h_source.html">formula.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="ae1c51535d0054f7c5cbdd057534d11e7"></a><!-- doxytag: member="gcu::Formula::Formula" ref="ae1c51535d0054f7c5cbdd057534d11e7" args="(std::string entry, FormulaParseMode mode=GCU_FORMULA_PARSE_GUESS)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">gcu::Formula::Formula </td> <td>(</td> <td class="paramtype">std::string </td> <td class="paramname"> <em>entry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespacegcu.html#a49392c345f0740efd3167eb30aca570e">FormulaParseMode</a> </td> <td class="paramname"> <em>mode</em> = <code>GCU_FORMULA_PARSE_GUESS</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td> throw (<a class="el" href="classgcu_1_1parse__error.html">parse_error</a>)</td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>entry,:</em> </td><td>the formula to parse as a string. </td></tr> <tr><td valign="top"></td><td valign="top"><em>mode,:</em> </td><td>the way ambiguous symbols shoud be interpreted. The constructor will emit a <a class="el" href="classgcu_1_1parse__error.html">parse_error</a> exception. if it cannot parse the given formula. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ac5ebbcba608d87e5fcb30eb80f3f0a7a"></a><!-- doxytag: member="gcu::Formula::~Formula" ref="ac5ebbcba608d87e5fcb30eb80f3f0a7a" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual gcu::Formula::~Formula </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>The destructor. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a8672e0b7f13cfe9e925c7cf4a5098f63"></a><!-- doxytag: member="gcu::Formula::CalculateIsotopicPattern" ref="a8672e0b7f13cfe9e925c7cf4a5098f63" args="(IsotopicPattern &pattern)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void gcu::Formula::CalculateIsotopicPattern </td> <td>(</td> <td class="paramtype"><a class="el" href="classgcu_1_1IsotopicPattern.html">IsotopicPattern</a> & </td> <td class="paramname"> <em>pattern</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pattern,:</em> </td><td>the <a class="el" href="classgcu_1_1IsotopicPattern.html">IsotopicPattern</a> to be filled This method evaluates the isotopic pattern and fills the pattern parameter with the calculated data. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a71a32179a7a25aaa067b2340a3dd6cdc"></a><!-- doxytag: member="gcu::Formula::Clear" ref="a71a32179a7a25aaa067b2340a3dd6cdc" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void gcu::Formula::Clear </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Clears all data. </p> </div> </div> <a class="anchor" id="ab36e337dd70844ef94ce2cb79be12c2b"></a><!-- doxytag: member="gcu::Formula::GetElements" ref="ab36e337dd70844ef94ce2cb79be12c2b" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">std::list<<a class="el" href="classgcu_1_1FormulaElt.html">FormulaElt</a> *> const& gcu::Formula::GetElements </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the parsed formula as a list of elements. </p> <p>Definition at line <a class="el" href="formula_8h_source.html#l00340">340</a> of file <a class="el" href="formula_8h_source.html">formula.h</a>.</p> </div> </div> <a class="anchor" id="a11e89053abc2f9633e0664a3579a5deb"></a><!-- doxytag: member="gcu::Formula::GetMarkup" ref="a11e89053abc2f9633e0664a3579a5deb" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">char const* gcu::Formula::GetMarkup </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>the original formula as a pango markup. </dd></dl> </div> </div> <a class="anchor" id="a4c72c8bedf531762c85a2350b049d571"></a><!-- doxytag: member="gcu::Formula::GetMolecularWeight" ref="a4c72c8bedf531762c85a2350b049d571" args="(bool &artificial)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classgcu_1_1DimensionalValue.html">DimensionalValue</a> gcu::Formula::GetMolecularWeight </td> <td>(</td> <td class="paramtype">bool & </td> <td class="paramname"> <em>artificial</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>artificial,:</em> </td><td>will be true if the formula contains an artificial element (with no natural isotope). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the molecular weight corresponding to the formula. </dd></dl> </div> </div> <a class="anchor" id="ab1c834fc7ba943809bf26976e938fca9"></a><!-- doxytag: member="gcu::Formula::GetRawFormula" ref="ab1c834fc7ba943809bf26976e938fca9" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">std::map<int,int>& gcu::Formula::GetRawFormula </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>the raw formula as a map of atoms numbers indexed by atomic number Z. </dd></dl> </div> </div> <a class="anchor" id="a08f21e12b0f6bf643a0ac12422f7d6f3"></a><!-- doxytag: member="gcu::Formula::GetRawMarkup" ref="a08f21e12b0f6bf643a0ac12422f7d6f3" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">char const* gcu::Formula::GetRawMarkup </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>the raw formula as a pango markup. </dd></dl> </div> </div> <a class="anchor" id="a890a3386514b2dffec1f7f1562d9cc72"></a><!-- doxytag: member="gcu::Formula::SetFormula" ref="a890a3386514b2dffec1f7f1562d9cc72" args="(std::string entry)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void gcu::Formula::SetFormula </td> <td>(</td> <td class="paramtype">std::string </td> <td class="paramname"> <em>entry</em></td> <td> ) </td> <td> throw (<a class="el" href="classgcu_1_1parse__error.html">parse_error</a>)</td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>entry,:</em> </td><td>the formula to parse as a string. Calls <a class="el" href="classgcu_1_1Formula.html#a71a32179a7a25aaa067b2340a3dd6cdc">Formula::Clear</a> before parsing the new formula. The method will emit a <a class="el" href="classgcu_1_1parse__error.html">parse_error</a> exception if it cannot parse the given formula. </td></tr> </table> </dd> </dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="formula_8h_source.html">formula.h</a></li> </ul> </div> <hr size="1"/><address style="text-align: right;"><small>Generated on Sun Sep 6 18:33:55 2009 for The Gnome Chemistry Utils by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>