Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b293cf61b174f6cb974e48c9096dc9b3 > files > 241

lib64commoncpp-devel-1.8.1-7.mga4.x86_64.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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>GNU CommonC++: ost::MemPager Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">GNU CommonC++
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;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 id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceost.html">ost</a></li><li class="navelem"><a class="el" href="classost_1_1_mem_pager.html">MemPager</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="classost_1_1_mem_pager-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ost::MemPager Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<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="classost_1_1_mem_pager.html#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="dyncontent">
 <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" title="Keydata objects are used to load and hold &quot;configuration&quot; data for a given application. " alt="ost::Keydata" shape="rect" coords="0,56,136,80"/>
<area href="classost_1_1_shared_mem_pager.html" title="The shared mempager uses a mutex to protect key access methods. " alt="ost::SharedMemPager" shape="rect" coords="146,56,282,80"/>
<area href="classost_1_1_stack_pager.html" title="The StackPager provides a repository to stash and retrieve working data in last-in-first-out order..." alt="ost::StackPager" shape="rect" coords="292,56,428,80"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a320897ecfca3e92378c45ec70aee58ba"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a320897ecfca3e92378c45ec70aee58ba">getPages</a> (void)</td></tr>
<tr class="memdesc:a320897ecfca3e92378c45ec70aee58ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the total number of pages that have been allocated for this memory pool.  <a href="#a320897ecfca3e92378c45ec70aee58ba">More...</a><br/></td></tr>
<tr class="separator:a320897ecfca3e92378c45ec70aee58ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a2c82ac4c97fcba81c643966973e78d84"><td class="memItemLeft" align="right" valign="top">virtual void *&#160;</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 class="memdesc:a2c82ac4c97fcba81c643966973e78d84"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate first workspace from paged memory.  <a href="#a2c82ac4c97fcba81c643966973e78d84">More...</a><br/></td></tr>
<tr class="separator:a2c82ac4c97fcba81c643966973e78d84"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3a03cb50bd4084ddbf6314ec0339d176"><td class="memItemLeft" align="right" valign="top">virtual void *&#160;</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 class="memdesc:a3a03cb50bd4084ddbf6314ec0339d176"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate memory from either the currently active page, or allocate a new page for the object.  <a href="#a3a03cb50bd4084ddbf6314ec0339d176">More...</a><br/></td></tr>
<tr class="separator:a3a03cb50bd4084ddbf6314ec0339d176"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ea4e6f82bffa66c994fcd10ebdee594"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a7ea4e6f82bffa66c994fcd10ebdee594">first</a> (char *str)</td></tr>
<tr class="memdesc:a7ea4e6f82bffa66c994fcd10ebdee594"><td class="mdescLeft">&#160;</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">More...</a><br/></td></tr>
<tr class="separator:a7ea4e6f82bffa66c994fcd10ebdee594"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a245b6c4181ccccbabc52f1c3451f2fb6"><td class="memItemLeft" align="right" valign="top">char *&#160;</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 class="memdesc:a245b6c4181ccccbabc52f1c3451f2fb6"><td class="mdescLeft">&#160;</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">More...</a><br/></td></tr>
<tr class="separator:a245b6c4181ccccbabc52f1c3451f2fb6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5dc37c26af34d6f4c26e125eded3e2be"><td class="memItemLeft" align="right" valign="top">&#160;</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 class="memdesc:a5dc37c26af34d6f4c26e125eded3e2be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a paged memory pool for cumulative storage.  <a href="#a5dc37c26af34d6f4c26e125eded3e2be">More...</a><br/></td></tr>
<tr class="separator:a5dc37c26af34d6f4c26e125eded3e2be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5bfdb6f2d6f569ba08c32c59efb3a012"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a5bfdb6f2d6f569ba08c32c59efb3a012">purge</a> (void)</td></tr>
<tr class="memdesc:a5bfdb6f2d6f569ba08c32c59efb3a012"><td class="mdescLeft">&#160;</td><td class="mdescRight">purge the current memory pool.  <a href="#a5bfdb6f2d6f569ba08c32c59efb3a012">More...</a><br/></td></tr>
<tr class="separator:a5bfdb6f2d6f569ba08c32c59efb3a012"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8efb94a243063ed1f9d1ddb315cb6042"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a8efb94a243063ed1f9d1ddb315cb6042">clean</a> (void)</td></tr>
<tr class="memdesc:a8efb94a243063ed1f9d1ddb315cb6042"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clean for memory cleanup before exiting.  <a href="#a8efb94a243063ed1f9d1ddb315cb6042">More...</a><br/></td></tr>
<tr class="separator:a8efb94a243063ed1f9d1ddb315cb6042"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58dcf48146eca4ae2286706968fdf9c5"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a58dcf48146eca4ae2286706968fdf9c5">~MemPager</a> ()</td></tr>
<tr class="memdesc:a58dcf48146eca4ae2286706968fdf9c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete the memory pool and all allocated memory.  <a href="#a58dcf48146eca4ae2286706968fdf9c5">More...</a><br/></td></tr>
<tr class="separator:a58dcf48146eca4ae2286706968fdf9c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a7fb804f7dc96dd9f705c84095f37f1ca"><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#a7fb804f7dc96dd9f705c84095f37f1ca">String</a></td></tr>
<tr class="separator:a7fb804f7dc96dd9f705c84095f37f1ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac5ec8bc6fca4e4e6a8faa45d4b0a9d58"><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mem_pager.html#ac5ec8bc6fca4e4e6a8faa45d4b0a9d58">MemPagerObject</a></td></tr>
<tr class="separator:ac5ec8bc6fca4e4e6a8faa45d4b0a9d58"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><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="section author"><dt>Author</dt><dd>David Sugar <a href="#" onclick="location.href='mai'+'lto:'+'dyf'+'et'+'@os'+'te'+'l.c'+'om'; return false;">dyfet<span style="display: none;">.nosp@m.</span>@ost<span style="display: none;">.nosp@m.</span>el.co<span style="display: none;">.nosp@m.</span>m</a> Accumulative object memory allocator. </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a5dc37c26af34d6f4c26e125eded3e2be"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ost::MemPager::MemPager </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>pagesize</em> = <code>4096</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </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 class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">pagesize</td><td>page size to allocate chunks. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a58dcf48146eca4ae2286706968fdf9c5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual ost::MemPager::~MemPager </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

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

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a3a03cb50bd4084ddbf6314ec0339d176"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void* ost::MemPager::alloc </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </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 class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>size of memory to allocate. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</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>

</div>
</div>
<a class="anchor" id="a245b6c4181ccccbabc52f1c3451f2fb6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">char* ost::MemPager::alloc </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </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 class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>string to allocate and copy into paged memory pool. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>copy of string from allocated memory. </dd></dl>

</div>
</div>
<a class="anchor" id="a8efb94a243063ed1f9d1ddb315cb6042"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void ost::MemPager::clean </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

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

</div>
</div>
<a class="anchor" id="a2c82ac4c97fcba81c643966973e78d84"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void* ost::MemPager::first </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </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 class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>size of memory to allocate. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</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="a7ea4e6f82bffa66c994fcd10ebdee594"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">char* ost::MemPager::first </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </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 class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>string to allocate and copy into paged memory pool. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>copy of string from allocated memory. </dd></dl>

</div>
</div>
<a class="anchor" id="a320897ecfca3e92378c45ec70aee58ba"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int ost::MemPager::getPages </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </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="section return"><dt>Returns</dt><dd>number of pages allocated. </dd></dl>

</div>
</div>
<a class="anchor" id="a5bfdb6f2d6f569ba08c32c59efb3a012"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void ost::MemPager::purge </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

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

</div>
</div>
<h2 class="groupheader">Friends And Related Function Documentation</h2>
<a class="anchor" id="ac5ec8bc6fca4e4e6a8faa45d4b0a9d58"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classost_1_1_mem_pager_object.html">MemPagerObject</a></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a7fb804f7dc96dd9f705c84095f37f1ca"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classost_1_1_string.html">String</a></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">friend</span></span>  </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><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 17 2013 23:24:57 for GNU CommonC++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>