]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/interprocess/include/boost/interprocess/allocators/detail/node_pool.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / interprocess / include / boost / interprocess / allocators / detail / node_pool.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/interprocess for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10
11 #ifndef BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP
12 #define BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP
13
14 #ifndef BOOST_CONFIG_HPP
15 # include <boost/config.hpp>
16 #endif
17 #
18 #if defined(BOOST_HAS_PRAGMA_ONCE)
19 # pragma once
20 #endif
21
22 #include <boost/interprocess/detail/config_begin.hpp>
23 #include <boost/interprocess/detail/workaround.hpp>
24
25 #include <boost/intrusive/slist.hpp>
26 #include <boost/interprocess/detail/utilities.hpp>
27 #include <boost/interprocess/allocators/detail/allocator_common.hpp>
28 #include <boost/container/detail/node_pool_impl.hpp>
29 #include <cstddef>
30
31
32 //!\file
33 //!Describes the real adaptive pool shared by many Interprocess adaptive pool allocators
34
35 namespace boost {
36 namespace interprocess {
37 namespace ipcdetail {
38
39
40
41 //!Pooled shared memory allocator using single segregated storage. Includes
42 //!a reference count but the class does not delete itself, this is
43 //!responsibility of user classes. Node size (NodeSize) and the number of
44 //!nodes allocated per block (NodesPerBlock) are known at compile time
45 template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock >
46 class private_node_pool
47 //Inherit from the implementation to avoid template bloat
48 : public boost::container::container_detail::
49 private_node_pool_impl<typename SegmentManager::segment_manager_base_type>
50 {
51 typedef boost::container::container_detail::private_node_pool_impl
52 <typename SegmentManager::segment_manager_base_type> base_t;
53 //Non-copyable
54 private_node_pool();
55 private_node_pool(const private_node_pool &);
56 private_node_pool &operator=(const private_node_pool &);
57
58 public:
59 typedef SegmentManager segment_manager;
60 typedef typename base_t::size_type size_type;
61
62 static const size_type nodes_per_block = NodesPerBlock;
63 //Deprecated, use nodes_per_block
64 static const size_type nodes_per_chunk = NodesPerBlock;
65
66 //!Constructor from a segment manager. Never throws
67 private_node_pool(segment_manager *segment_mngr)
68 : base_t(segment_mngr, NodeSize, NodesPerBlock)
69 {}
70
71 //!Returns the segment manager. Never throws
72 segment_manager* get_segment_manager() const
73 { return static_cast<segment_manager*>(base_t::get_segment_manager_base()); }
74 };
75
76
77 //!Pooled shared memory allocator using single segregated storage. Includes
78 //!a reference count but the class does not delete itself, this is
79 //!responsibility of user classes. Node size (NodeSize) and the number of
80 //!nodes allocated per block (NodesPerBlock) are known at compile time
81 //!Pooled shared memory allocator using adaptive pool. Includes
82 //!a reference count but the class does not delete itself, this is
83 //!responsibility of user classes. Node size (NodeSize) and the number of
84 //!nodes allocated per block (NodesPerBlock) are known at compile time
85 template< class SegmentManager
86 , std::size_t NodeSize
87 , std::size_t NodesPerBlock
88 >
89 class shared_node_pool
90 : public ipcdetail::shared_pool_impl
91 < private_node_pool
92 <SegmentManager, NodeSize, NodesPerBlock>
93 >
94 {
95 typedef ipcdetail::shared_pool_impl
96 < private_node_pool
97 <SegmentManager, NodeSize, NodesPerBlock>
98 > base_t;
99 public:
100 shared_node_pool(SegmentManager *segment_mgnr)
101 : base_t(segment_mgnr)
102 {}
103 };
104
105 } //namespace ipcdetail {
106 } //namespace interprocess {
107 } //namespace boost {
108
109 #include <boost/interprocess/detail/config_end.hpp>
110
111 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP