<!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>C++ API frePPLe: frepple::utils::Keyword Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="../styles.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <div id="menubar"> <div id="logo" align="center"> <br/><img src='../frepple.bmp' alt="frepple" /><br/> <a href='http://www.frepple.com/'> <strong>a Free<br/>Production Planning<br/>Library</strong> </a> </div> <div id="menu"> <br/> <h3><a href='../Main/HomePage.html'>Main</a></h3> <h3><a href='../UI/Main.html'>User Manual</a></h3> <h3><a href='../Tutorial/Main.html'>Tutorial</a></h3> <h3><a href='../Frepple/Main.html'>Reference Manual</a></h3> <h3><a href='../Main/FAQ.html'>FAQ</a></h3> <h3><a href='index.html'>C++ API</a></h3> <br/> </div> </div> <div id="content"> <br/> <!-- 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="pages.html"><span>Related Pages</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="a00256.html">frepple</a>::<a class="el" href="a00257.html">utils</a>::<a class="el" href="a00096.html">Keyword</a> </div> </div> <div class="contents"> <h1>frepple::utils::Keyword Class Reference</h1><!-- doxytag: class="frepple::utils::Keyword" --><!-- doxytag: inherits="frepple::utils::NonCopyable" --> <p>This class defines a keyword for the frePPLe data model. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="a00252_source.html">utils.h</a>></code></p> <div class="dynheader"> Inheritance diagram for frepple::utils::Keyword:</div> <div class="dynsection"> <div class="center"><img src="a00596.png" border="0" usemap="#frepple_1_1utils_1_1_keyword_inherit__map" alt="Inheritance graph"/></div> <map name="frepple_1_1utils_1_1_keyword_inherit__map" id="frepple_1_1utils_1_1_keyword_inherit__map"> <area shape="rect" id="node2" href="a00119.html" title="Class NonCopyable is a base class. Derive your own class from it when you want to..." alt="" coords="5,6,181,34"/> </map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> <p><a href="a00597.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Types</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef map< <a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a>, <a class="el" href="a00096.html">Keyword</a> * > </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a9626a8e15f130fc100f1f8287fbed1a6">tagtable</a></td></tr> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a73bf10e838b38969a20fedcda3d80c8b">getHash</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const string & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a6fe8e65499b3da5250f55f937e93a0ec">getName</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const XMLCh * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a41a9194dcca824f85e4352278ff39ef6">getXMLCharacters</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#af5e1cfda9fcce374c6aa6f37c79b982a">Keyword</a> (const string &, const string &)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a1462a02c9cd51d5555f9dde5e2ed6d25">Keyword</a> (const string &)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const string & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#ac0a8274ff836c347cae323dc3a668524">stringAttribute</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const string & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a4d60c4d639eb65453e17fd31eed8ff35">stringElement</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const string & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#acd655b11f66fee61c73702c1e0ebb909">stringEndElement</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const string & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a2a05a07508f2f9e878d8a3d4ee7ee980">stringStartElement</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a1a060811808e477c1546f2ccf29f306f">~Keyword</a> ()</td></tr> <tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="a00096.html">Keyword</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#aeccf1356d895ed0bf0e02f42763c72ea">find</a> (const char *)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="a00096.html#a9626a8e15f130fc100f1f8287fbed1a6">tagtable</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a2b9525303cd6a86d0ae27f00e03789d1">getTags</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#ada720882692e130f0c09481c30922d73">hash</a> (const XMLCh *)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a0815f8e6fef0489a537d2ee44be023f0">hash</a> (const string &c)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#a9df960daad4f157b92cc4974694093da">hash</a> (const char *)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00096.html#ac4cb763773ebb4af0b067e7db73e81a1">printTags</a> ()</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>This class defines a keyword for the frePPLe data model. </p> <p>The keywords are used to define the attribute names for the objects.<br/> They are used as:</p> <ul> <li>Element and attribute names in XML documents</li> <li><a class="el" href="a00002.html" title="A class to model keyword instances.">Attribute</a> names in the Python extension.</li> </ul> <p>Special for this class is the requirement to have a "perfect" hash function, i.e. a function that returns a distinct number for each defined tag. The class prints a warning message when the hash function doesn't satisfy this criterion. </p> <p>Definition at line <a class="el" href="a00252_source.html#l00862">862</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> <hr/><h2>Member Typedef Documentation</h2> <a class="anchor" id="a9626a8e15f130fc100f1f8287fbed1a6"></a><!-- doxytag: member="frepple::utils::Keyword::tagtable" ref="a9626a8e15f130fc100f1f8287fbed1a6" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef map<<a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a>,<a class="el" href="a00096.html">Keyword</a>*> <a class="el" href="a00096.html#a9626a8e15f130fc100f1f8287fbed1a6">frepple::utils::Keyword::tagtable</a></td> </tr> </table> </div> <div class="memdoc"> <p>Container for maintaining a list of all tags. </p> <p>Definition at line <a class="el" href="a00252_source.html#l00880">880</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a1462a02c9cd51d5555f9dde5e2ed6d25"></a><!-- doxytag: member="frepple::utils::Keyword::Keyword" ref="a1462a02c9cd51d5555f9dde5e2ed6d25" args="(const string &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">frepple::utils::Keyword::Keyword </td> <td>(</td> <td class="paramtype">const string & </td> <td class="paramname"> <em>name</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>This is the constructor.<br/> The tag doesn't belong to an XML namespace. </p> <p>Definition at line <a class="el" href="a00255_source.html#l00678">678</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="af5e1cfda9fcce374c6aa6f37c79b982a"></a><!-- doxytag: member="frepple::utils::Keyword::Keyword" ref="af5e1cfda9fcce374c6aa6f37c79b982a" args="(const string &, const string &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">frepple::utils::Keyword::Keyword </td> <td>(</td> <td class="paramtype">const string & </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const string & </td> <td class="paramname"> <em>nspace</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>This is the constructor. The tag belongs to the XML namespace passed as second argument.<br/> Note that we still require the first argument to be unique, since it is used as a keyword for the Python extensions. </p> <p>Definition at line <a class="el" href="a00255_source.html#l00701">701</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="a1a060811808e477c1546f2ccf29f306f"></a><!-- doxytag: member="frepple::utils::Keyword::~Keyword" ref="a1a060811808e477c1546f2ccf29f306f" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">frepple::utils::Keyword::~Keyword </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destructor. </p> <p>Definition at line <a class="el" href="a00255_source.html#l00744">744</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="aeccf1356d895ed0bf0e02f42763c72ea"></a><!-- doxytag: member="frepple::utils::Keyword::find" ref="aeccf1356d895ed0bf0e02f42763c72ea" args="(const char *)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="a00096.html">Keyword</a> & frepple::utils::Keyword::find </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Finds a tag when passed a certain string. If no tag exists yet, it will be created. </p> <p>Definition at line <a class="el" href="a00255_source.html#l00756">756</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="a73bf10e838b38969a20fedcda3d80c8b"></a><!-- doxytag: member="frepple::utils::Keyword::getHash" ref="a73bf10e838b38969a20fedcda3d80c8b" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> frepple::utils::Keyword::getHash </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the hash value of the tag. </p> <p>Definition at line <a class="el" href="a00252_source.html#l00897">897</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a6fe8e65499b3da5250f55f937e93a0ec"></a><!-- doxytag: member="frepple::utils::Keyword::getName" ref="a6fe8e65499b3da5250f55f937e93a0ec" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const string& frepple::utils::Keyword::getName </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the name of the tag. </p> <p>Definition at line <a class="el" href="a00252_source.html#l00900">900</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a2b9525303cd6a86d0ae27f00e03789d1"></a><!-- doxytag: member="frepple::utils::Keyword::getTags" ref="a2b9525303cd6a86d0ae27f00e03789d1" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00096.html#a9626a8e15f130fc100f1f8287fbed1a6">Keyword::tagtable</a> & frepple::utils::Keyword::getTags </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Return a reference to a table with all defined tags. </p> <p>Definition at line <a class="el" href="a00255_source.html#l00763">763</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="a41a9194dcca824f85e4352278ff39ef6"></a><!-- doxytag: member="frepple::utils::Keyword::getXMLCharacters" ref="a41a9194dcca824f85e4352278ff39ef6" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const XMLCh* frepple::utils::Keyword::getXMLCharacters </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a pointer to an array of XML characters. This format is used by Xerces for the internal representation of character strings. </p> <p>Definition at line <a class="el" href="a00252_source.html#l00904">904</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="ada720882692e130f0c09481c30922d73"></a><!-- doxytag: member="frepple::utils::Keyword::hash" ref="ada720882692e130f0c09481c30922d73" args="(const XMLCh *)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> frepple::utils::Keyword::hash </td> <td>(</td> <td class="paramtype">const XMLCh * </td> <td class="paramname"> <em>t</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This is the hash function taken an XML character string as input.<br/> The function is expected to return exactly the same result as when a character pointer is passed as argument. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00096.html#a9df960daad4f157b92cc4974694093da">hash(const char*)</a> </dd></dl> <p>Definition at line <a class="el" href="a00255_source.html#l00785">785</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="a0815f8e6fef0489a537d2ee44be023f0"></a><!-- doxytag: member="frepple::utils::Keyword::hash" ref="a0815f8e6fef0489a537d2ee44be023f0" args="(const string &c)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> frepple::utils::Keyword::hash </td> <td>(</td> <td class="paramtype">const string & </td> <td class="paramname"> <em>c</em></td> <td> ) </td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This is the hash function. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00096.html#a9df960daad4f157b92cc4974694093da">hash(const char*)</a> </dd></dl> <p>Definition at line <a class="el" href="a00252_source.html#l00932">932</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a9df960daad4f157b92cc4974694093da"></a><!-- doxytag: member="frepple::utils::Keyword::hash" ref="a9df960daad4f157b92cc4974694093da" args="(const char *)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00257.html#af8a429831281b355afd656cb83d31443">hashtype</a> frepple::utils::Keyword::hash </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>c</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This is the hash function. See the note on the perfectness of this function at the start. This function should be as simple as possible while still garantueeing the perfectness.<br/> The hash function is based on the Xerces-C implementation, with the difference that the hash calculated by our function is portable between platforms.<br/> The hash modulus is 954991 (which is the biggest prime number lower than 1000000). </p> <p>Definition at line <a class="el" href="a00255_source.html#l00770">770</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="ac4cb763773ebb4af0b067e7db73e81a1"></a><!-- doxytag: member="frepple::utils::Keyword::printTags" ref="ac4cb763773ebb4af0b067e7db73e81a1" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::Keyword::printTags </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Prints a list of all tags that have been defined. This can be useful for debugging and also for creating a good hashing function.<br/> GNU gperf is a program that can generate a perfect hash function for a given set of symbols. </p> <p>Definition at line <a class="el" href="a00255_source.html#l00806">806</a> of file <a class="el" href="a00255_source.html">xmlparser.cpp</a>.</p> </div> </div> <a class="anchor" id="ac0a8274ff836c347cae323dc3a668524"></a><!-- doxytag: member="frepple::utils::Keyword::stringAttribute" ref="ac0a8274ff836c347cae323dc3a668524" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const string& frepple::utils::Keyword::stringAttribute </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a string to start an XML attribute with this tag: TAG= </p> <p>Definition at line <a class="el" href="a00252_source.html#l00916">916</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a4d60c4d639eb65453e17fd31eed8ff35"></a><!-- doxytag: member="frepple::utils::Keyword::stringElement" ref="a4d60c4d639eb65453e17fd31eed8ff35" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const string& frepple::utils::Keyword::stringElement </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a string to start an XML element with this tag: <TAG> </p> <p>Definition at line <a class="el" href="a00252_source.html#l00913">913</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="acd655b11f66fee61c73702c1e0ebb909"></a><!-- doxytag: member="frepple::utils::Keyword::stringEndElement" ref="acd655b11f66fee61c73702c1e0ebb909" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const string& frepple::utils::Keyword::stringEndElement </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a string to end an XML element with this tag: </TAG> </p> <p>Definition at line <a class="el" href="a00252_source.html#l00910">910</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a2a05a07508f2f9e878d8a3d4ee7ee980"></a><!-- doxytag: member="frepple::utils::Keyword::stringStartElement" ref="a2a05a07508f2f9e878d8a3d4ee7ee980" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const string& frepple::utils::Keyword::stringStartElement </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a string to start an XML element with this tag: <TAG </p> <p>Definition at line <a class="el" href="a00252_source.html#l00907">907</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="a00252_source.html">utils.h</a></li> <li><a class="el" href="a00255_source.html">xmlparser.cpp</a></li> </ul> </div> <hr size="1"/><address style="align: right;"><small>Documentation generated for frePPLe by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"/></a></small></address> </div> </div> </body> </html>