Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/interprocess/allocators/detail/node_pool.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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