Click here to Skip to main content
15,881,588 members
Articles / Desktop Programming / MFC

Genetic Algorithm Library

Rate me:
Please Sign up or sign in to vote.
4.93/5 (175 votes)
7 Apr 2012GPL358 min read 435.6K   34.7K   555  
A framework for genetic algorithms
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Genetic Algorithm Library: Common::GaCatalogue&lt; T &gt; Class Template Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;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>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespace_common.html">Common</a>::<a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>
  </div>
</div>
<div class="contents">
<h1>Common::GaCatalogue&lt; T &gt; Class Template Reference</h1><!-- doxytag: class="Common::GaCatalogue" --><code><a class="el" href="class_common_1_1_ga_catalogue.html" title="GaCatalogue template class stores and manages catalogue (directory) for genetic operations...">GaCatalogue</a></code> template class stores and manages catalogue (directory) for genetic operations. Data can be accessed by its key (name). When user adds new data into catalogue, catalogue takes over responsibility for memory allocated by the data. Data must come from heap. Key/data combination is stored in <a class="el" href="class_common_1_1_ga_catalogue_entry.html" title="This template class manages key and pointer to data of a catalogue entry. Catalogue...">GaCatalogueEntry</a> object. Duplicates of key in catalogue are not allowed.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/Catalogue.h&gt;</code>
<p>

<p>
<a href="class_common_1_1_ga_catalogue-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#391658c681f87d2dd62e8d8097680009">GaCatalogue</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initializes empty catalogue.  <a href="#391658c681f87d2dd62e8d8097680009"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#8f56b50648fc665d7592d459c1b8ac89">~GaCatalogue</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees memory used by entries (keys and user data).  <a href="#8f56b50648fc665d7592d459c1b8ac89"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#b963cba6de70e72360b5d128ca9c8b22">Register</a> (const char *name, T *data, bool replace=false)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>Register</code> method adds data with specified key (name) to catalogue. If entry with specified key already exists in catalogue and replace is set to <code>false</code>, insertion will fail because duplicate of keys are not allowed. When replace is set to <code>true</code>, data in an entry with specified key are replaced or if such entry doesn't exist new entry is added to catalogue. Key is copied and catalogue object takes over responsibility for memory used by data. Data must be located at heap.  <a href="#b963cba6de70e72360b5d128ca9c8b22"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#bbb840085000e23eef7eb92b8d0ba8d2">Unregister</a> (const char *name)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>Unregister</code> method removes entry with specified key and frees memory used by it.  <a href="#bbb840085000e23eef7eb92b8d0ba8d2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_common_1_1_ga_catalogue_entry.html">GaCatalogueEntry</a>&lt; T &gt; *GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#ce9871878f376c2d272c7d12676fb0de">GetEntry</a> (const char *name) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is thread-safe.  <a href="#ce9871878f376c2d272c7d12676fb0de"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">T *GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#02556eaed2015731c1a88220f8389e6c">GetEntryData</a> (const char *name) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is thread-safe.  <a href="#02556eaed2015731c1a88220f8389e6c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">T *GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#b3c2bc56cce0f06ba0bb51c5d206877c">operator[]</a> (const char *name) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This operator method is thread-safe.  <a href="#b3c2bc56cce0f06ba0bb51c5d206877c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char **GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#fc2eee55b2d64e4e012556a31965b1cb">GetKeys</a> (int &amp;number) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>GetKeys</code> method returns all kesy in catalogue. This method allocates memory for array of pointers to keys and keys but caller is responsible for it.  <a href="#fc2eee55b2d64e4e012556a31965b1cb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#2d36636cf9a63569786789f3e1769b24">GetCount</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is thread-safe.  <a href="#2d36636cf9a63569786789f3e1769b24"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#04d5e93ee3b62b50d0dbc2f2c5ac8a25">IsExist</a> (const char *name) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>IsExist</code> method checks existence of entry with specified key.  <a href="#04d5e93ee3b62b50d0dbc2f2c5ac8a25"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>&lt; T &gt; &amp;GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#6cebfba25ae27f9c9d209694ceb5ddf3">Instance</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns reference to global instance of catalogue for type <code>T</code>.  <a href="#6cebfba25ae27f9c9d209694ceb5ddf3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#ad5f279da008ba805863855f5d4af6cc">MakeInstance</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Method makes global instance of catalogue if it wasn't instanced before. This method must be called before using of global instance of catalogue. All built-in global instances of catalogues are instanced in GaInitialization function.  <a href="#ad5f279da008ba805863855f5d4af6cc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#76874ab63d028eddf92d8c6841ffc078">FreeInstance</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees memory used by global instance of the catalogue. This method must be called before application quitting application or unloading library. All built-in global instances of catalogues are freed in <a class="el" href="_initialization_8h.html#015f356c6a52185833c536d8155099ae" title="GaFinalize should be call before exiting application, and after work with GAL is...">GaFinalize</a> function.  <a href="#76874ab63d028eddf92d8c6841ffc078"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef hash_map&lt; const char <br>
*, <a class="el" href="class_common_1_1_ga_catalogue_entry.html">GaCatalogueEntry</a>&lt; T &gt;<br>
 *, <a class="el" href="class_common_1_1_ga_catalogue_1_1_ga_cataolgue_hash_map_comparator.html">GaCataolgueHashMapComparator</a> &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#9ca2b2251283814b85436f058e208152">GaCataolgueHashMap</a></td></tr>

<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_common_1_1_ga_catalogue.html#9ca2b2251283814b85436f058e208152">GaCataolgueHashMap</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#75c96f3d55d8ddcc5393aed0a1ac9d8f">_entries</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Hash table which stores keys and data of the catalogue.  <a href="#75c96f3d55d8ddcc5393aed0a1ac9d8f"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Static Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static GAL_API <a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>&lt; T &gt; *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue.html#bbc3b4d998090701083d399e6d9dd383">_instance</a> = NULL</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pointer to global instance of catalogue for type <code>T</code>.  <a href="#bbc3b4d998090701083d399e6d9dd383"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_common_1_1_ga_catalogue_1_1_ga_cataolgue_hash_map_comparator.html">GaCataolgueHashMapComparator</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_common_1_1_ga_catalogue_1_1_ga_string_comparator.html">GaStringComparator</a></td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;typename T&gt;<br>
 class Common::GaCatalogue&lt; T &gt;</h3>

<code><a class="el" href="class_common_1_1_ga_catalogue.html" title="GaCatalogue template class stores and manages catalogue (directory) for genetic operations...">GaCatalogue</a></code> template class stores and manages catalogue (directory) for genetic operations. Data can be accessed by its key (name). When user adds new data into catalogue, catalogue takes over responsibility for memory allocated by the data. Data must come from heap. Key/data combination is stored in <a class="el" href="class_common_1_1_ga_catalogue_entry.html" title="This template class manages key and pointer to data of a catalogue entry. Catalogue...">GaCatalogueEntry</a> object. Duplicates of key in catalogue are not allowed. 
<p>
All public methods are thread-safe except <code>MakeInstance</code> and <code>FreeInstance</code>. This class has built-in synchronizator so it is allowed to use <code>LOCK_OBJECT</code> and <code>LOCK_THIS_OBJECT</code> macros with instances of this class. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>T</em>&nbsp;</td><td>type of stored data in catalogue.</td></tr>
  </table>
</dl>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="9ca2b2251283814b85436f058e208152"></a><!-- doxytag: member="Common::GaCatalogue::GaCataolgueHashMap" ref="9ca2b2251283814b85436f058e208152" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef hash_map&lt;const char*, <a class="el" href="class_common_1_1_ga_catalogue_entry.html">GaCatalogueEntry</a>&lt;T&gt;*, <a class="el" href="class_common_1_1_ga_catalogue_1_1_ga_cataolgue_hash_map_comparator.html">GaCataolgueHashMapComparator</a>&gt; <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::<a class="el" href="class_common_1_1_ga_catalogue.html#9ca2b2251283814b85436f058e208152">GaCataolgueHashMap</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="391658c681f87d2dd62e8d8097680009"></a><!-- doxytag: member="Common::GaCatalogue::GaCatalogue" ref="391658c681f87d2dd62e8d8097680009" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::<a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initializes empty catalogue. 
<p>

</div>
</div><p>
<a class="anchor" name="8f56b50648fc665d7592d459c1b8ac89"></a><!-- doxytag: member="Common::GaCatalogue::~GaCatalogue" ref="8f56b50648fc665d7592d459c1b8ac89" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::~<a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Frees memory used by entries (keys and user data). 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="6cebfba25ae27f9c9d209694ceb5ddf3"></a><!-- doxytag: member="Common::GaCatalogue::Instance" ref="6cebfba25ae27f9c9d209694ceb5ddf3" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>&lt;T&gt;&amp; GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::Instance           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns reference to global instance of catalogue for type <code>T</code>. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns reference to global instance of catalogue for type <code>T</code>.</dd></dl>

</div>
</div><p>
<a class="anchor" name="ad5f279da008ba805863855f5d4af6cc"></a><!-- doxytag: member="Common::GaCatalogue::MakeInstance" ref="ad5f279da008ba805863855f5d4af6cc" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">static void GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::MakeInstance           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Method makes global instance of catalogue if it wasn't instanced before. This method must be called before using of global instance of catalogue. All built-in global instances of catalogues are instanced in GaInitialization function. 
<p>
This method is not thread safe. 
</div>
</div><p>
<a class="anchor" name="76874ab63d028eddf92d8c6841ffc078"></a><!-- doxytag: member="Common::GaCatalogue::FreeInstance" ref="76874ab63d028eddf92d8c6841ffc078" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">static void GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::FreeInstance           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Frees memory used by global instance of the catalogue. This method must be called before application quitting application or unloading library. All built-in global instances of catalogues are freed in <a class="el" href="_initialization_8h.html#015f356c6a52185833c536d8155099ae" title="GaFinalize should be call before exiting application, and after work with GAL is...">GaFinalize</a> function. 
<p>
This method is not thread safe. 
</div>
</div><p>
<a class="anchor" name="b963cba6de70e72360b5d128ca9c8b22"></a><!-- doxytag: member="Common::GaCatalogue::Register" ref="b963cba6de70e72360b5d128ca9c8b22" args="(const char *name, T *data, bool replace=false)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::Register           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T *&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>replace</em> = <code>false</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>Register</code> method adds data with specified key (name) to catalogue. If entry with specified key already exists in catalogue and replace is set to <code>false</code>, insertion will fail because duplicate of keys are not allowed. When replace is set to <code>true</code>, data in an entry with specified key are replaced or if such entry doesn't exist new entry is added to catalogue. Key is copied and catalogue object takes over responsibility for memory used by data. Data must be located at heap. 
<p>
This method is thread-safe. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>key of new or existing entry.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>reference to data which will be stored in catalogue</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>replace</em>&nbsp;</td><td>tells method whether it should replace data in an entry if it exists with specified key.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns <code>true</code> if data is added or replaced successfully. If data cannot be added it returns <code>false</code>.</dd></dl>

</div>
</div><p>
<a class="anchor" name="bbb840085000e23eef7eb92b8d0ba8d2"></a><!-- doxytag: member="Common::GaCatalogue::Unregister" ref="bbb840085000e23eef7eb92b8d0ba8d2" args="(const char *name)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::Unregister           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>Unregister</code> method removes entry with specified key and frees memory used by it. 
<p>
This method is thread-safe. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>key of the desired entry.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns <code>true</code> if entry with specified key is removed successfully. If entry cannot be found method returns <code>false</code>.</dd></dl>

</div>
</div><p>
<a class="anchor" name="ce9871878f376c2d272c7d12676fb0de"></a><!-- doxytag: member="Common::GaCatalogue::GetEntry" ref="ce9871878f376c2d272c7d12676fb0de" args="(const char *name) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_common_1_1_ga_catalogue_entry.html">GaCatalogueEntry</a>&lt;T&gt;* GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::GetEntry           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method is thread-safe. 
<p>
&lt;param name=name"&gt;key of the desired entry.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns pointer to catalogue entry with specified key. If such entry cannot be found, method returns <code>NULL</code> pointer.</dd></dl>

</div>
</div><p>
<a class="anchor" name="02556eaed2015731c1a88220f8389e6c"></a><!-- doxytag: member="Common::GaCatalogue::GetEntryData" ref="02556eaed2015731c1a88220f8389e6c" args="(const char *name) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T* GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::GetEntryData           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method is thread-safe. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>key of the desired entry.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns pointer to data of entry with specified key. If such entry cannot be found, method returns <code>NULL</code> pointer.</dd></dl>

</div>
</div><p>
<a class="anchor" name="b3c2bc56cce0f06ba0bb51c5d206877c"></a><!-- doxytag: member="Common::GaCatalogue::operator[]" ref="b3c2bc56cce0f06ba0bb51c5d206877c" args="(const char *name) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T* GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::operator[]           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This operator method is thread-safe. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>key of the desired entry.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Operator returns pointer to data of entry with specified key. If such entry cannot be found, operator returns <code>NULL</code> pointer.</dd></dl>

</div>
</div><p>
<a class="anchor" name="fc2eee55b2d64e4e012556a31965b1cb"></a><!-- doxytag: member="Common::GaCatalogue::GetKeys" ref="fc2eee55b2d64e4e012556a31965b1cb" args="(int &amp;number) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">char** GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::GetKeys           </td>
          <td>(</td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>number</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>GetKeys</code> method returns all kesy in catalogue. This method allocates memory for array of pointers to keys and keys but caller is responsible for it. 
<p>
This method is thread-safe. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>number</em>&nbsp;</td><td>Reference to variable to which number of kesy will be stored.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns pointer to array of keys.</dd></dl>

</div>
</div><p>
<a class="anchor" name="2d36636cf9a63569786789f3e1769b24"></a><!-- doxytag: member="Common::GaCatalogue::GetCount" ref="2d36636cf9a63569786789f3e1769b24" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::GetCount           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method is thread-safe. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns number of entries in catalogue.</dd></dl>

</div>
</div><p>
<a class="anchor" name="04d5e93ee3b62b50d0dbc2f2c5ac8a25"></a><!-- doxytag: member="Common::GaCatalogue::IsExist" ref="04d5e93ee3b62b50d0dbc2f2c5ac8a25" args="(const char *name) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool GACALL <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::IsExist           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>IsExist</code> method checks existence of entry with specified key. 
<p>
This method is thread-safe. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>key of the desired entry.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns <code>true</code> if entry with specified key exists in catalogue, otherwise return <code>false</code>.</dd></dl>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="bbc3b4d998090701083d399e6d9dd383"></a><!-- doxytag: member="Common::GaCatalogue::_instance" ref="bbc3b4d998090701083d399e6d9dd383" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_common_1_1_ga_catalogue.html">GaCatalogue</a>&lt; T &gt; * <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::<a class="el" href="class_common_1_1_ga_catalogue.html#bbc3b4d998090701083d399e6d9dd383">_instance</a> = NULL<code> [inline, static, private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Pointer to global instance of catalogue for type <code>T</code>. 
<p>

</div>
</div><p>
<a class="anchor" name="75c96f3d55d8ddcc5393aed0a1ac9d8f"></a><!-- doxytag: member="Common::GaCatalogue::_entries" ref="75c96f3d55d8ddcc5393aed0a1ac9d8f" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_common_1_1_ga_catalogue.html#9ca2b2251283814b85436f058e208152">GaCataolgueHashMap</a> <a class="el" href="class_common_1_1_ga_catalogue.html">Common::GaCatalogue</a>&lt; T &gt;::<a class="el" href="class_common_1_1_ga_catalogue.html#75c96f3d55d8ddcc5393aed0a1ac9d8f">_entries</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Hash table which stores keys and data of the catalogue. 
<p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>source/<a class="el" href="_catalogue_8h.html">Catalogue.h</a></ul>
</div>
<br/><a href="http://www.coolsoft-sd.com/ProductVersion.aspx?vid=9">Genetic Algorithm Library</a><br/><a href="http://www.coolsoft-sd.com/">Coolsoft Software Development</a>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer
Serbia Serbia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions