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