Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > fa7fad8f194f80107561a85291acd153 > files > 1003

lib64boost-devel-doc-1.42.0-3mdv2010.1.x86_64.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class template rbtree_best_fit</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../boost_interprocess_reference.html#header.boost.interprocess.mem_algo.rbtree_best_fit_hpp" title="Header &lt;boost/interprocess/mem_algo/rbtree_best_fit.hpp&gt;">
<link rel="prev" href="mapped_region.html" title="Class mapped_region">
<link rel="next" href="simple_seq_fit.html" title="Class template simple_seq_fit">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mapped_region.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_interprocess_reference.html#header.boost.interprocess.mem_algo.rbtree_best_fit_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="simple_seq_fit.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="refentry" title="Class template rbtree_best_fit">
<a name="boost.interprocess.rbtree_best_fit"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template rbtree_best_fit</span></h2>
<p>boost::interprocess::rbtree_best_fit</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="emphasis"><em>// In header: &lt;<a class="link" href="../../boost_interprocess_reference.html#header.boost.interprocess.mem_algo.rbtree_best_fit_hpp" title="Header &lt;boost/interprocess/mem_algo/rbtree_best_fit.hpp&gt;">boost/interprocess/mem_algo/rbtree_best_fit.hpp</a>&gt;

</em></span><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> MutexFamily, <span class="bold"><strong>typename</strong></span> VoidPointer, std::size_t MemAlignment&gt; 
<span class="bold"><strong>class</strong></span> <a class="link" href="rbtree_best_fit.html" title="Class template rbtree_best_fit">rbtree_best_fit</a> {
<span class="bold"><strong>public</strong></span>:
  <span class="emphasis"><em>// <a class="link" href="rbtree_best_fit.html#boost.interprocess.rbtree_best_fittypes">types</a></em></span>
  <span class="bold"><strong>typedef</strong></span> MutexFamily <a class="link" href="rbtree_best_fit.html#boost.interprocess.rbtree_best_fit.mutex_family">mutex_family</a>;
  <span class="bold"><strong>typedef</strong></span> VoidPointer <a name="boost.interprocess.rbtree_best_fit.void_pointer"></a>void_pointer;           <span class="emphasis"><em>// Pointer type to be used with the rest of the Interprocess framework. </em></span>
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a name="boost.interprocess.rbtree_best_fit.multiallocation_chain"></a>multiallocation_chain;

  <span class="emphasis"><em>// <a class="link" href="rbtree_best_fit.html#boost.interprocess.rbtree_best_fitconstruct-copy-destruct">construct/copy/destruct</a></em></span>
  <a class="link" href="rbtree_best_fit.html#id813232-bb">rbtree_best_fit</a>(std::size_t, std::size_t);
  <a class="link" href="rbtree_best_fit.html#id813251-bb">~rbtree_best_fit</a>();

  <span class="emphasis"><em>// <a class="link" href="rbtree_best_fit.html#id812974-bb">public member functions</a></em></span>
  <span class="type"><span class="bold"><strong>void</strong></span> *</span> <a class="link" href="rbtree_best_fit.html#id812978-bb">allocate</a>(std::size_t) ;
  <span class="type"><span class="bold"><strong>void</strong></span></span> <a class="link" href="rbtree_best_fit.html#id812994-bb">deallocate</a>(<span class="bold"><strong>void</strong></span> *) ;
  <span class="type">std::size_t</span> <a class="link" href="rbtree_best_fit.html#id813012-bb">get_size</a>() <span class="bold"><strong>const</strong></span>;
  <span class="type">std::size_t</span> <a class="link" href="rbtree_best_fit.html#id813022-bb">get_free_memory</a>() <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>void</strong></span></span> <a class="link" href="rbtree_best_fit.html#id813033-bb">zero_free_memory</a>() ;
  <span class="type"><span class="bold"><strong>void</strong></span></span> <a class="link" href="rbtree_best_fit.html#id813046-bb">grow</a>(std::size_t) ;
  <span class="type"><span class="bold"><strong>void</strong></span></span> <a class="link" href="rbtree_best_fit.html#id813064-bb">shrink_to_fit</a>() ;
  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a class="link" href="rbtree_best_fit.html#id813074-bb">all_memory_deallocated</a>() ;
  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a class="link" href="rbtree_best_fit.html#id813086-bb">check_sanity</a>() ;
  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T&gt; 
    <span class="type">std::pair&lt; T *, <span class="bold"><strong>bool</strong></span> &gt;</span> 
    <a class="link" href="rbtree_best_fit.html#id813098-bb">allocation_command</a>(boost::interprocess::allocation_type, std::size_t, 
                       std::size_t, std::size_t &amp;, T * = 0) ;
  <span class="type">std::pair&lt; <span class="bold"><strong>void</strong></span> *, <span class="bold"><strong>bool</strong></span> &gt;</span> 
  <a class="link" href="rbtree_best_fit.html#id813144-bb">raw_allocation_command</a>(boost::interprocess::allocation_type, std::size_t, 
                         std::size_t, std::size_t &amp;, <span class="bold"><strong>void</strong></span> * = 0, 
                         std::size_t = 1) ;
  <span class="type">std::size_t</span> <a class="link" href="rbtree_best_fit.html#id813191-bb">size</a>(<span class="bold"><strong>const</strong></span> <span class="bold"><strong>void</strong></span> *) <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>void</strong></span> *</span> <a class="link" href="rbtree_best_fit.html#id813208-bb">allocate_aligned</a>(std::size_t, std::size_t) ;

  <span class="emphasis"><em>// <a class="link" href="rbtree_best_fit.html#id813254-bb">public static functions</a></em></span>
  <span class="type"><span class="bold"><strong>static</strong></span> std::size_t</span> <a class="link" href="rbtree_best_fit.html#id813258-bb">get_min_size</a>(std::size_t) ;
  <span class="bold"><strong>static</strong></span> <span class="type"><span class="bold"><strong>const</strong></span> std::size_t</span> PayloadPerAllocation;
};</pre></div>
<div class="refsect1" title="Description">
<a name="id1030455"></a><h2>Description</h2>
<p>This class implements an algorithm that stores the free nodes in a red-black tree to have logarithmic search/insert times. </p>
<div class="refsect2" title="rbtree_best_fit public types">
<a name="id1030462"></a><h3>
<a name="boost.interprocess.rbtree_best_fittypes"></a><code class="computeroutput">rbtree_best_fit</code> 
        public
       types</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>
<span class="bold"><strong>typedef</strong></span> MutexFamily <a name="boost.interprocess.rbtree_best_fit.mutex_family"></a>mutex_family;</p>
<p>Shared interprocess_mutex family used for the rest of the Interprocess framework </p>
</li></ol></div>
</div>
<div class="refsect2" title="rbtree_best_fit public construct/copy/destruct">
<a name="id1030502"></a><h3>
<a name="boost.interprocess.rbtree_best_fitconstruct-copy-destruct"></a><code class="computeroutput">rbtree_best_fit</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="id813232-bb"></a>rbtree_best_fit(std::size_t size, std::size_t extra_hdr_bytes);</pre>
<p>Constructor. "size" is the total size of the managed memory segment, "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(rbtree_best_fit) offset that the allocator should not use at all. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="id813251-bb"></a>~rbtree_best_fit();</pre>Destructor. </li>
</ol></div>
</div>
<div class="refsect2" title="rbtree_best_fit public member functions">
<a name="id1030556"></a><h3>
<a name="id812974-bb"></a><code class="computeroutput">rbtree_best_fit</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span> *</span> <a name="id812978-bb"></a>allocate(std::size_t nbytes) ;</pre>Allocates bytes, returns 0 if there is not more memory. </li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id812994-bb"></a>deallocate(<span class="bold"><strong>void</strong></span> * addr) ;</pre>
<p>Deallocates previously allocated bytes </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type">std::size_t</span> <a name="id813012-bb"></a>get_size() <span class="bold"><strong>const</strong></span>;</pre>Returns the size of the memory segment. </li>
<li class="listitem">
<pre class="literallayout"><span class="type">std::size_t</span> <a name="id813022-bb"></a>get_free_memory() <span class="bold"><strong>const</strong></span>;</pre>Returns the number of free bytes of the segment. </li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id813033-bb"></a>zero_free_memory() ;</pre>
<p>Initializes to zero all the memory that's not in use. This function is normally used for security reasons. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id813046-bb"></a>grow(std::size_t extra_size) ;</pre>
<p>Increases managed memory in extra_size bytes more </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id813064-bb"></a>shrink_to_fit() ;</pre>Decreases managed memory as much as possible. </li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id813074-bb"></a>all_memory_deallocated() ;</pre>Returns true if all allocated memory has been deallocated. </li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id813086-bb"></a>check_sanity() ;</pre>
<p>Makes an internal sanity check and returns true if success </p>
</li>
<li class="listitem"><pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T&gt; 
  <span class="type">std::pair&lt; T *, <span class="bold"><strong>bool</strong></span> &gt;</span> 
  <a name="id813098-bb"></a>allocation_command(boost::interprocess::allocation_type command, 
                     std::size_t limit_size, std::size_t preferred_size, 
                     std::size_t &amp; received_size, T * reuse_ptr = 0) ;</pre></li>
<li class="listitem"><pre class="literallayout"><span class="type">std::pair&lt; <span class="bold"><strong>void</strong></span> *, <span class="bold"><strong>bool</strong></span> &gt;</span> 
<a name="id813144-bb"></a>raw_allocation_command(boost::interprocess::allocation_type command, 
                       std::size_t limit_object, 
                       std::size_t preferred_object, 
                       std::size_t &amp; received_object, <span class="bold"><strong>void</strong></span> * reuse_ptr = 0, 
                       std::size_t sizeof_object = 1) ;</pre></li>
<li class="listitem">
<pre class="literallayout"><span class="type">std::size_t</span> <a name="id813191-bb"></a>size(<span class="bold"><strong>const</strong></span> <span class="bold"><strong>void</strong></span> * ptr) <span class="bold"><strong>const</strong></span>;</pre>Returns the size of the buffer previously allocated pointed by ptr. </li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span> *</span> <a name="id813208-bb"></a>allocate_aligned(std::size_t nbytes, std::size_t alignment) ;</pre>
<p>Allocates aligned bytes, returns 0 if there is not more memory. Alignment must be power of 2 </p>
</li>
</ol></div>
</div>
<div class="refsect2" title="rbtree_best_fit public static functions">
<a name="id1031206"></a><h3>
<a name="id813254-bb"></a><code class="computeroutput">rbtree_best_fit</code> public static functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>static</strong></span> std::size_t</span> <a name="id813258-bb"></a>get_min_size(std::size_t extra_hdr_bytes) ;</pre>Obtains the minimum size needed by the algorithm. </li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2005 - 2008 Ion Gaztanaga<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mapped_region.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_interprocess_reference.html#header.boost.interprocess.mem_algo.rbtree_best_fit_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="simple_seq_fit.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>