Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > ed376d6842ea322c25405e7c23b3bc12 > files > 263

libcommoncpp-devel-1.8.0-5.1mdv2010.1.i586.rpm

<!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>GNU CommonC++: ost::MemPager 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.3 -->
<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>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</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="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_mem_pager.html">MemPager</a>
  </div>
</div>
<div class="contents">
<h1>ost::MemPager Class Reference</h1><!-- doxytag: class="ost::MemPager" -->
<p>The memory pager is used to allocate cumulative memory pages for storing object specific "persistant" data that is presumed to persist during the life of a given derived object.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="misc_8h_source.html">misc.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ost::MemPager:</div>
<div class="dynsection">
 <div class="center">
  <img src="classost_1_1_mem_pager.png" usemap="#ost::MemPager_map" alt=""/>
  <map id="ost::MemPager_map" name="ost::MemPager_map">
<area href="classost_1_1_keydata.html" alt="ost::Keydata" shape="rect" coords="0,56,136,80"/>
<area href="classost_1_1_shared_mem_pager.html" alt="ost::SharedMemPager" shape="rect" coords="146,56,282,80"/>
<area href="classost_1_1_stack_pager.html" alt="ost::StackPager" shape="rect" coords="292,56,428,80"/>
</map>
 </div>
</div>

<p><a href="classost_1_1_mem_pager-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><b>_page</b></td></tr>
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a320897ecfca3e92378c45ec70aee58ba">getPages</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the total number of pages that have been allocated for this memory pool.  <a href="#a320897ecfca3e92378c45ec70aee58ba"></a><br/></td></tr>
<tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a2c82ac4c97fcba81c643966973e78d84">first</a> (size_t size)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate first workspace from paged memory.  <a href="#a2c82ac4c97fcba81c643966973e78d84"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a3a03cb50bd4084ddbf6314ec0339d176">alloc</a> (size_t size)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate memory from either the currently active page, or allocate a new page for the object.  <a href="#a3a03cb50bd4084ddbf6314ec0339d176"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a7ea4e6f82bffa66c994fcd10ebdee594">first</a> (char *str)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate a string from the memory pager pool and copy the string into it's new memory area.  <a href="#a7ea4e6f82bffa66c994fcd10ebdee594"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a245b6c4181ccccbabc52f1c3451f2fb6">alloc</a> (const char *str)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate a string from the memory pager pool and copy the string inti it's new memory area.  <a href="#a245b6c4181ccccbabc52f1c3451f2fb6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a5dc37c26af34d6f4c26e125eded3e2be">MemPager</a> (size_t pagesize=4096)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a paged memory pool for cumulative storage.  <a href="#a5dc37c26af34d6f4c26e125eded3e2be"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a5bfdb6f2d6f569ba08c32c59efb3a012">purge</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">purge the current memory pool.  <a href="#a5bfdb6f2d6f569ba08c32c59efb3a012"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a8efb94a243063ed1f9d1ddb315cb6042">clean</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Clean for memory cleanup before exiting.  <a href="#a8efb94a243063ed1f9d1ddb315cb6042"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a58dcf48146eca4ae2286706968fdf9c5">~MemPager</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete the memory pool and all allocated memory.  <a href="#a58dcf48146eca4ae2286706968fdf9c5"></a><br/></td></tr>
<tr><td colspan="2"><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a7fb804f7dc96dd9f705c84095f37f1ca">String</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#ac5ec8bc6fca4e4e6a8faa45d4b0a9d58">MemPagerObject</a></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>The memory pager is used to allocate cumulative memory pages for storing object specific "persistant" data that is presumed to persist during the life of a given derived object. </p>
<p>When the object is destroyed, all accumulated data is automatically purged.</p>
<p>There are a number of odd and specialized utility classes found in Common C++. The most common of these is the "MemPager" class. This is basically a class to enable page-grouped "cumulative" memory allocation; all accumulated allocations are dropped during the destructor. This class has found it's way in a lot of other utility classes in Common C++.</p>
<dl class="author"><dt><b>Author:</b></dt><dd>David Sugar &lt;<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>&gt; Accumulative object memory allocator. </dd></dl>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a5dc37c26af34d6f4c26e125eded3e2be"></a><!-- doxytag: member="ost::MemPager::MemPager" ref="a5dc37c26af34d6f4c26e125eded3e2be" args="(size_t pagesize=4096)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ost::MemPager::MemPager </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>pagesize</em> = <code>4096</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create a paged memory pool for cumulative storage. </p>
<p>This pool allocates memory in fixed "pagesize" chunks. Ideal performance is achived when the pool size matches the system page size. This pool can only exist in derived objects.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pagesize</em>&nbsp;</td><td>page size to allocate chunks. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a58dcf48146eca4ae2286706968fdf9c5"></a><!-- doxytag: member="ost::MemPager::~MemPager" ref="a58dcf48146eca4ae2286706968fdf9c5" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual ost::MemPager::~MemPager </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Delete the memory pool and all allocated memory. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a245b6c4181ccccbabc52f1c3451f2fb6"></a><!-- doxytag: member="ost::MemPager::alloc" ref="a245b6c4181ccccbabc52f1c3451f2fb6" args="(const char *str)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ost::MemPager::alloc </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>str</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate a string from the memory pager pool and copy the string inti it's new memory area. </p>
<p>This checks only the last active page for available space before allocating a new page.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>string to allocate and copy into paged memory pool. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>copy of string from allocated memory. </dd></dl>

</div>
</div>
<a class="anchor" id="a3a03cb50bd4084ddbf6314ec0339d176"></a><!-- doxytag: member="ost::MemPager::alloc" ref="a3a03cb50bd4084ddbf6314ec0339d176" args="(size_t size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void* ost::MemPager::alloc </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>size</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate memory from either the currently active page, or allocate a new page for the object. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>size of memory to allocate. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to allocated memory. </dd></dl>

<p>Reimplemented in <a class="el" href="classost_1_1_shared_mem_pager.html#ad5c3aad294fd247a972a72983dcf831b">ost::SharedMemPager</a>.</p>

<p>Referenced by <a class="el" href="misc_8h_source.html#l00642">ost::MemPagerObject::operator new()</a>, and <a class="el" href="misc_8h_source.html#l00651">ost::MemPagerObject::operator new[]()</a>.</p>

</div>
</div>
<a class="anchor" id="a8efb94a243063ed1f9d1ddb315cb6042"></a><!-- doxytag: member="ost::MemPager::clean" ref="a8efb94a243063ed1f9d1ddb315cb6042" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::MemPager::clean </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Clean for memory cleanup before exiting. </p>

</div>
</div>
<a class="anchor" id="a7ea4e6f82bffa66c994fcd10ebdee594"></a><!-- doxytag: member="ost::MemPager::first" ref="a7ea4e6f82bffa66c994fcd10ebdee594" args="(char *str)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ost::MemPager::first </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>str</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate a string from the memory pager pool and copy the string into it's new memory area. </p>
<p>This method allocates memory by first searching for an available page, and then allocating a new page if no space is found.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>string to allocate and copy into paged memory pool. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>copy of string from allocated memory. </dd></dl>

</div>
</div>
<a class="anchor" id="a2c82ac4c97fcba81c643966973e78d84"></a><!-- doxytag: member="ost::MemPager::first" ref="a2c82ac4c97fcba81c643966973e78d84" args="(size_t size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void* ost::MemPager::first </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>size</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate first workspace from paged memory. </p>
<p>This method scans all currently allocated blocks for available space before adding new pages and hence is both slower and more efficient.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>size of memory to allocate. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to allocated memory. </dd></dl>

<p>Reimplemented in <a class="el" href="classost_1_1_shared_mem_pager.html#a644a00d48052aff83a180523b205aa6f">ost::SharedMemPager</a>.</p>

</div>
</div>
<a class="anchor" id="a320897ecfca3e92378c45ec70aee58ba"></a><!-- doxytag: member="ost::MemPager::getPages" ref="a320897ecfca3e92378c45ec70aee58ba" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ost::MemPager::getPages </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the total number of pages that have been allocated for this memory pool. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of pages allocated. </dd></dl>

</div>
</div>
<a class="anchor" id="a5bfdb6f2d6f569ba08c32c59efb3a012"></a><!-- doxytag: member="ost::MemPager::purge" ref="a5bfdb6f2d6f569ba08c32c59efb3a012" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::MemPager::purge </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>purge the current memory pool. </p>

<p>Reimplemented in <a class="el" href="classost_1_1_stack_pager.html#ac903c181770651ee8f42717892dd9fa4">ost::StackPager</a>, and <a class="el" href="classost_1_1_shared_mem_pager.html#afafb0b8ce31a2b1fdee64a5a9cadebc6">ost::SharedMemPager</a>.</p>

</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="ac5ec8bc6fca4e4e6a8faa45d4b0a9d58"></a><!-- doxytag: member="ost::MemPager::MemPagerObject" ref="ac5ec8bc6fca4e4e6a8faa45d4b0a9d58" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classost_1_1_mem_pager_object.html">MemPagerObject</a><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a7fb804f7dc96dd9f705c84095f37f1ca"></a><!-- doxytag: member="ost::MemPager::String" ref="a7fb804f7dc96dd9f705c84095f37f1ca" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classost_1_1_string.html">String</a><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="misc_8h_source.html">misc.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Nov 12 09:55:47 2010 for GNU CommonC++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>