Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-21 08:07:56

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_NODE_POOL_HPP
0012 #define BOOST_INTERPROCESS_DETAIL_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 
0026 #include <boost/intrusive/slist.hpp>
0027 #include <boost/interprocess/detail/utilities.hpp>
0028 #include <boost/interprocess/allocators/detail/allocator_common.hpp>
0029 #include <boost/container/detail/node_pool_impl.hpp>
0030 #include <cstddef>
0031 
0032 
0033 //!\file
0034 //!Describes the real adaptive pool shared by many Interprocess adaptive pool allocators
0035 
0036 namespace boost {
0037 namespace interprocess {
0038 namespace ipcdetail {
0039 
0040 
0041 
0042 //!Pooled shared memory allocator using single segregated storage. Includes
0043 //!a reference count but the class does not delete itself, this is
0044 //!responsibility of user classes. Node size (NodeSize) and the number of
0045 //!nodes allocated per block (NodesPerBlock) are known at compile time
0046 template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock >
0047 class private_node_pool
0048    //Inherit from the implementation to avoid template bloat
0049    :  public boost::container::dtl::
0050          private_node_pool_impl<typename SegmentManager::segment_manager_base_type>
0051 {
0052    typedef boost::container::dtl::private_node_pool_impl
0053       <typename SegmentManager::segment_manager_base_type> base_t;
0054    //Non-copyable
0055    private_node_pool();
0056    private_node_pool(const private_node_pool &);
0057    private_node_pool &operator=(const private_node_pool &);
0058 
0059    public:
0060    typedef SegmentManager              segment_manager;
0061    typedef typename base_t::size_type  size_type;
0062 
0063    static const size_type nodes_per_block = NodesPerBlock;
0064    //Deprecated, use nodes_per_block
0065    static const size_type nodes_per_chunk = NodesPerBlock;
0066 
0067    //!Constructor from a segment manager. Never throws
0068    private_node_pool(segment_manager *segment_mngr)
0069       :  base_t(segment_mngr, NodeSize, NodesPerBlock)
0070    {}
0071 
0072    //!Returns the segment manager. Never throws
0073    segment_manager* get_segment_manager() const
0074    {  return static_cast<segment_manager*>(base_t::get_segment_manager_base()); }
0075 };
0076 
0077 
0078 //!Pooled shared memory allocator using single segregated storage. Includes
0079 //!a reference count but the class does not delete itself, this is
0080 //!responsibility of user classes. Node size (NodeSize) and the number of
0081 //!nodes allocated per block (NodesPerBlock) are known at compile time
0082 //!Pooled shared memory allocator using adaptive pool. Includes
0083 //!a reference count but the class does not delete itself, this is
0084 //!responsibility of user classes. Node size (NodeSize) and the number of
0085 //!nodes allocated per block (NodesPerBlock) are known at compile time
0086 template< class SegmentManager
0087         , std::size_t NodeSize
0088         , std::size_t NodesPerBlock
0089         >
0090 class shared_node_pool
0091    :  public ipcdetail::shared_pool_impl
0092       < private_node_pool
0093          <SegmentManager, NodeSize, NodesPerBlock>
0094       >
0095 {
0096    typedef ipcdetail::shared_pool_impl
0097       < private_node_pool
0098          <SegmentManager, NodeSize, NodesPerBlock>
0099       > base_t;
0100    public:
0101    shared_node_pool(SegmentManager *segment_mgnr)
0102       : base_t(segment_mgnr)
0103    {}
0104 };
0105 
0106 }  //namespace ipcdetail {
0107 }  //namespace interprocess {
0108 }  //namespace boost {
0109 
0110 #include <boost/interprocess/detail/config_end.hpp>
0111 
0112 #endif   //#ifndef BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP