Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:23:20

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
0004 // Software License, Version 1.0. (See accompanying file
0005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // See http://www.boost.org/libs/interprocess for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #ifndef BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP
0012 #define BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP
0013 
0014 #ifndef BOOST_CONFIG_HPP
0015 #  include <boost/config.hpp>
0016 #endif
0017 0018 ">#
0019 #if defined(BOOST_HAS_PRAGMA_ONCE)
0020 #  pragma once
0021 #endif
0022 
0023 #include <boost/interprocess/detail/config_begin.hpp>
0024 #include <boost/interprocess/detail/workaround.hpp>
0025 #include <boost/interprocess/detail/utilities.hpp>
0026 #include <boost/interprocess/detail/math_functions.hpp>
0027 #include <boost/intrusive/set.hpp>
0028 #include <boost/intrusive/slist.hpp>
0029 #include <boost/interprocess/detail/type_traits.hpp>
0030 #include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp>
0031 #include <boost/interprocess/allocators/detail/node_tools.hpp>
0032 #include <boost/interprocess/allocators/detail/allocator_common.hpp>
0033 #include <cstddef>
0034 #include <boost/config/no_tr1/cmath.hpp>
0035 #include <boost/container/detail/adaptive_node_pool_impl.hpp>
0036 #include <boost/assert.hpp>
0037 
0038 //!\file
0039 //!Describes the real adaptive pool shared by many Interprocess pool allocators
0040 
0041 namespace boost {
0042 namespace interprocess {
0043 namespace ipcdetail {
0044 
0045 template< class SegmentManager
0046         , std::size_t NodeSize
0047         , std::size_t NodesPerBlock
0048         , std::size_t MaxFreeBlocks
0049         , unsigned char OverheadPercent
0050         >
0051 class private_adaptive_node_pool
0052    :  public boost::container::dtl::private_adaptive_node_pool_impl_rt
0053          < typename SegmentManager::segment_manager_base_type
0054          , ::boost::container::adaptive_pool_flag::size_ordered |
0055            ::boost::container::adaptive_pool_flag::address_ordered
0056          >
0057 {
0058    typedef boost::container::dtl::private_adaptive_node_pool_impl_rt
0059       < typename SegmentManager::segment_manager_base_type
0060       , ::boost::container::adaptive_pool_flag::size_ordered |
0061         ::boost::container::adaptive_pool_flag::address_ordered
0062       > base_t;
0063    //Non-copyable
0064    private_adaptive_node_pool();
0065    private_adaptive_node_pool(const private_adaptive_node_pool &);
0066    private_adaptive_node_pool &operator=(const private_adaptive_node_pool &);
0067 
0068    public:
0069    typedef SegmentManager              segment_manager;
0070    typedef typename base_t::size_type  size_type;
0071 
0072    static const size_type nodes_per_block = NodesPerBlock;
0073 
0074    //!Constructor from a segment manager. Never throws
0075    private_adaptive_node_pool(segment_manager *segment_mngr)
0076       :  base_t(segment_mngr, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent)
0077    {}
0078 
0079    //!Returns the segment manager. Never throws
0080    segment_manager* get_segment_manager() const
0081    {  return static_cast<segment_manager*>(base_t::get_segment_manager_base()); }
0082 };
0083 
0084 //!Pooled shared memory allocator using adaptive pool. Includes
0085 //!a reference count but the class does not delete itself, this is
0086 //!responsibility of user classes. Node size (NodeSize) and the number of
0087 //!nodes allocated per block (NodesPerBlock) are known at compile time
0088 template< class SegmentManager
0089         , std::size_t NodeSize
0090         , std::size_t NodesPerBlock
0091         , std::size_t MaxFreeBlocks
0092         , unsigned char OverheadPercent
0093         >
0094 class shared_adaptive_node_pool
0095    :  public ipcdetail::shared_pool_impl
0096       < private_adaptive_node_pool
0097          <SegmentManager, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent>
0098       >
0099 {
0100    typedef ipcdetail::shared_pool_impl
0101       < private_adaptive_node_pool
0102          <SegmentManager, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent>
0103       > base_t;
0104    public:
0105    shared_adaptive_node_pool(SegmentManager *segment_mgnr)
0106       : base_t(segment_mgnr)
0107    {}
0108 };
0109 
0110 }  //namespace ipcdetail {
0111 }  //namespace interprocess {
0112 }  //namespace boost {
0113 
0114 #include <boost/interprocess/detail/config_end.hpp>
0115 
0116 #endif   //#ifndef BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP