Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/interprocess for documentation. Chris@16: // Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: #ifndef BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP Chris@16: #define BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP Chris@16: Chris@101: #ifndef BOOST_CONFIG_HPP Chris@101: # include Chris@101: #endif Chris@101: # Chris@101: #if defined(BOOST_HAS_PRAGMA_ONCE) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: Chris@16: //!\file Chris@16: //!Describes the real adaptive pool shared by many Interprocess adaptive pool allocators Chris@16: Chris@16: namespace boost { Chris@16: namespace interprocess { Chris@16: namespace ipcdetail { Chris@16: Chris@16: Chris@16: Chris@16: //!Pooled shared memory allocator using single segregated storage. Includes Chris@16: //!a reference count but the class does not delete itself, this is Chris@16: //!responsibility of user classes. Node size (NodeSize) and the number of Chris@16: //!nodes allocated per block (NodesPerBlock) are known at compile time Chris@16: template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock > Chris@16: class private_node_pool Chris@16: //Inherit from the implementation to avoid template bloat Chris@16: : public boost::container::container_detail:: Chris@16: private_node_pool_impl Chris@16: { Chris@16: typedef boost::container::container_detail::private_node_pool_impl Chris@16: base_t; Chris@16: //Non-copyable Chris@16: private_node_pool(); Chris@16: private_node_pool(const private_node_pool &); Chris@16: private_node_pool &operator=(const private_node_pool &); Chris@16: Chris@16: public: Chris@16: typedef SegmentManager segment_manager; Chris@16: typedef typename base_t::size_type size_type; Chris@16: Chris@16: static const size_type nodes_per_block = NodesPerBlock; Chris@16: //Deprecated, use nodes_per_block Chris@16: static const size_type nodes_per_chunk = NodesPerBlock; Chris@16: Chris@16: //!Constructor from a segment manager. Never throws Chris@16: private_node_pool(segment_manager *segment_mngr) Chris@16: : base_t(segment_mngr, NodeSize, NodesPerBlock) Chris@16: {} Chris@16: Chris@16: //!Returns the segment manager. Never throws Chris@16: segment_manager* get_segment_manager() const Chris@16: { return static_cast(base_t::get_segment_manager_base()); } Chris@16: }; Chris@16: Chris@16: Chris@16: //!Pooled shared memory allocator using single segregated storage. Includes Chris@16: //!a reference count but the class does not delete itself, this is Chris@16: //!responsibility of user classes. Node size (NodeSize) and the number of Chris@16: //!nodes allocated per block (NodesPerBlock) are known at compile time Chris@16: //!Pooled shared memory allocator using adaptive pool. Includes Chris@16: //!a reference count but the class does not delete itself, this is Chris@16: //!responsibility of user classes. Node size (NodeSize) and the number of Chris@16: //!nodes allocated per block (NodesPerBlock) are known at compile time Chris@16: template< class SegmentManager Chris@16: , std::size_t NodeSize Chris@16: , std::size_t NodesPerBlock Chris@16: > Chris@16: class shared_node_pool Chris@16: : public ipcdetail::shared_pool_impl Chris@16: < private_node_pool Chris@16: Chris@16: > Chris@16: { Chris@16: typedef ipcdetail::shared_pool_impl Chris@16: < private_node_pool Chris@16: Chris@16: > base_t; Chris@16: public: Chris@16: shared_node_pool(SegmentManager *segment_mgnr) Chris@16: : base_t(segment_mgnr) Chris@16: {} Chris@16: }; Chris@16: Chris@16: } //namespace ipcdetail { Chris@16: } //namespace interprocess { Chris@16: } //namespace boost { Chris@16: Chris@16: #include Chris@16: Chris@16: #endif //#ifndef BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP