annotate DEPENDENCIES/generic/include/boost/interprocess/allocators/adaptive_pool.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/interprocess for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_INTERPROCESS_ADAPTIVE_POOL_HPP
Chris@16 12 #define BOOST_INTERPROCESS_ADAPTIVE_POOL_HPP
Chris@16 13
Chris@101 14 #ifndef BOOST_CONFIG_HPP
Chris@101 15 # include <boost/config.hpp>
Chris@101 16 #endif
Chris@101 17 #
Chris@101 18 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@16 19 # pragma once
Chris@16 20 #endif
Chris@16 21
Chris@16 22 #include <boost/interprocess/detail/config_begin.hpp>
Chris@16 23 #include <boost/interprocess/detail/workaround.hpp>
Chris@16 24
Chris@16 25 #include <boost/intrusive/pointer_traits.hpp>
Chris@16 26
Chris@16 27 #include <boost/interprocess/interprocess_fwd.hpp>
Chris@16 28 #include <boost/assert.hpp>
Chris@16 29 #include <boost/utility/addressof.hpp>
Chris@16 30 #include <boost/interprocess/detail/utilities.hpp>
Chris@16 31 #include <boost/interprocess/detail/type_traits.hpp>
Chris@16 32 #include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp>
Chris@101 33 #include <boost/interprocess/containers/version_type.hpp>
Chris@16 34 #include <boost/interprocess/exceptions.hpp>
Chris@16 35 #include <boost/interprocess/allocators/detail/allocator_common.hpp>
Chris@16 36 #include <boost/container/detail/multiallocation_chain.hpp>
Chris@16 37 #include <boost/interprocess/detail/mpl.hpp>
Chris@101 38 #include <boost/move/adl_move_swap.hpp>
Chris@16 39 #include <cstddef>
Chris@16 40
Chris@16 41 //!\file
Chris@16 42 //!Describes adaptive_pool pooled shared memory STL compatible allocator
Chris@16 43
Chris@16 44 namespace boost {
Chris@16 45 namespace interprocess {
Chris@16 46
Chris@101 47 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
Chris@16 48
Chris@16 49 namespace ipcdetail{
Chris@16 50
Chris@16 51 template < unsigned int Version
Chris@16 52 , class T
Chris@16 53 , class SegmentManager
Chris@16 54 , std::size_t NodesPerBlock
Chris@16 55 , std::size_t MaxFreeBlocks
Chris@16 56 , unsigned char OverheadPercent
Chris@16 57 >
Chris@16 58 class adaptive_pool_base
Chris@16 59 : public node_pool_allocation_impl
Chris@16 60 < adaptive_pool_base
Chris@16 61 < Version, T, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent>
Chris@16 62 , Version
Chris@16 63 , T
Chris@16 64 , SegmentManager
Chris@16 65 >
Chris@16 66 {
Chris@16 67 public:
Chris@16 68 typedef typename SegmentManager::void_pointer void_pointer;
Chris@16 69 typedef SegmentManager segment_manager;
Chris@16 70 typedef adaptive_pool_base
Chris@16 71 <Version, T, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> self_t;
Chris@16 72
Chris@101 73 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
Chris@16 74
Chris@16 75 template <int dummy>
Chris@16 76 struct node_pool
Chris@16 77 {
Chris@16 78 typedef ipcdetail::shared_adaptive_node_pool
Chris@16 79 < SegmentManager, sizeof_value<T>::value, NodesPerBlock, MaxFreeBlocks, OverheadPercent> type;
Chris@16 80
Chris@16 81 static type *get(void *p)
Chris@16 82 { return static_cast<type*>(p); }
Chris@16 83 };
Chris@101 84 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 85
Chris@16 86 BOOST_STATIC_ASSERT((Version <=2));
Chris@16 87
Chris@16 88 public:
Chris@16 89 //-------
Chris@16 90 typedef typename boost::intrusive::
Chris@16 91 pointer_traits<void_pointer>::template
Chris@16 92 rebind_pointer<T>::type pointer;
Chris@16 93 typedef typename boost::intrusive::
Chris@16 94 pointer_traits<void_pointer>::template
Chris@16 95 rebind_pointer<const T>::type const_pointer;
Chris@16 96 typedef T value_type;
Chris@16 97 typedef typename ipcdetail::add_reference
Chris@16 98 <value_type>::type reference;
Chris@16 99 typedef typename ipcdetail::add_reference
Chris@16 100 <const value_type>::type const_reference;
Chris@16 101 typedef typename segment_manager::size_type size_type;
Chris@16 102 typedef typename segment_manager::difference_type difference_type;
Chris@16 103
Chris@16 104 typedef boost::interprocess::version_type<adaptive_pool_base, Version> version;
Chris@16 105 typedef boost::container::container_detail::transform_multiallocation_chain
Chris@16 106 <typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
Chris@16 107
Chris@16 108 //!Obtains adaptive_pool_base from
Chris@16 109 //!adaptive_pool_base
Chris@16 110 template<class T2>
Chris@16 111 struct rebind
Chris@16 112 {
Chris@16 113 typedef adaptive_pool_base<Version, T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other;
Chris@16 114 };
Chris@16 115
Chris@101 116 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
Chris@16 117 private:
Chris@16 118 //!Not assignable from related adaptive_pool_base
Chris@16 119 template<unsigned int Version2, class T2, class SegmentManager2, std::size_t N2, std::size_t F2, unsigned char O2>
Chris@16 120 adaptive_pool_base& operator=
Chris@16 121 (const adaptive_pool_base<Version2, T2, SegmentManager2, N2, F2, O2>&);
Chris@16 122
Chris@101 123 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 124
Chris@16 125 public:
Chris@16 126 //!Constructor from a segment manager. If not present, constructs a node
Chris@16 127 //!pool. Increments the reference count of the associated node pool.
Chris@16 128 //!Can throw boost::interprocess::bad_alloc
Chris@16 129 adaptive_pool_base(segment_manager *segment_mngr)
Chris@16 130 : mp_node_pool(ipcdetail::get_or_create_node_pool<typename node_pool<0>::type>(segment_mngr)) { }
Chris@16 131
Chris@16 132 //!Copy constructor from other adaptive_pool_base. Increments the reference
Chris@16 133 //!count of the associated node pool. Never throws
Chris@16 134 adaptive_pool_base(const adaptive_pool_base &other)
Chris@16 135 : mp_node_pool(other.get_node_pool())
Chris@16 136 {
Chris@16 137 node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count();
Chris@16 138 }
Chris@16 139
Chris@16 140 //!Assignment from other adaptive_pool_base
Chris@16 141 adaptive_pool_base& operator=(const adaptive_pool_base &other)
Chris@16 142 {
Chris@16 143 adaptive_pool_base c(other);
Chris@101 144 boost::adl_move_swap(*this, c);
Chris@16 145 return *this;
Chris@16 146 }
Chris@16 147
Chris@16 148 //!Copy constructor from related adaptive_pool_base. If not present, constructs
Chris@16 149 //!a node pool. Increments the reference count of the associated node pool.
Chris@16 150 //!Can throw boost::interprocess::bad_alloc
Chris@16 151 template<class T2>
Chris@16 152 adaptive_pool_base
Chris@16 153 (const adaptive_pool_base<Version, T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> &other)
Chris@16 154 : mp_node_pool(ipcdetail::get_or_create_node_pool<typename node_pool<0>::type>(other.get_segment_manager())) { }
Chris@16 155
Chris@16 156 //!Destructor, removes node_pool_t from memory
Chris@16 157 //!if its reference count reaches to zero. Never throws
Chris@16 158 ~adaptive_pool_base()
Chris@16 159 { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); }
Chris@16 160
Chris@16 161 //!Returns a pointer to the node pool.
Chris@16 162 //!Never throws
Chris@16 163 void* get_node_pool() const
Chris@16 164 { return ipcdetail::to_raw_pointer(mp_node_pool); }
Chris@16 165
Chris@16 166 //!Returns the segment manager.
Chris@16 167 //!Never throws
Chris@16 168 segment_manager* get_segment_manager()const
Chris@16 169 { return node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->get_segment_manager(); }
Chris@16 170
Chris@16 171 //!Swaps allocators. Does not throw. If each allocator is placed in a
Chris@16 172 //!different memory segment, the result is undefined.
Chris@16 173 friend void swap(self_t &alloc1, self_t &alloc2)
Chris@101 174 { boost::adl_move_swap(alloc1.mp_node_pool, alloc2.mp_node_pool); }
Chris@16 175
Chris@101 176 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
Chris@16 177 private:
Chris@16 178 void_pointer mp_node_pool;
Chris@101 179 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 180 };
Chris@16 181
Chris@16 182 //!Equality test for same type
Chris@16 183 //!of adaptive_pool_base
Chris@16 184 template<unsigned int V, class T, class S, std::size_t NPC, std::size_t F, unsigned char OP> inline
Chris@16 185 bool operator==(const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc1,
Chris@16 186 const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc2)
Chris@16 187 { return alloc1.get_node_pool() == alloc2.get_node_pool(); }
Chris@16 188
Chris@16 189 //!Inequality test for same type
Chris@16 190 //!of adaptive_pool_base
Chris@16 191 template<unsigned int V, class T, class S, std::size_t NPC, std::size_t F, unsigned char OP> inline
Chris@16 192 bool operator!=(const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc1,
Chris@16 193 const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc2)
Chris@16 194 { return alloc1.get_node_pool() != alloc2.get_node_pool(); }
Chris@16 195
Chris@16 196 template < class T
Chris@16 197 , class SegmentManager
Chris@16 198 , std::size_t NodesPerBlock = 64
Chris@16 199 , std::size_t MaxFreeBlocks = 2
Chris@16 200 , unsigned char OverheadPercent = 5
Chris@16 201 >
Chris@16 202 class adaptive_pool_v1
Chris@16 203 : public adaptive_pool_base
Chris@16 204 < 1
Chris@16 205 , T
Chris@16 206 , SegmentManager
Chris@16 207 , NodesPerBlock
Chris@16 208 , MaxFreeBlocks
Chris@16 209 , OverheadPercent
Chris@16 210 >
Chris@16 211 {
Chris@16 212 public:
Chris@16 213 typedef ipcdetail::adaptive_pool_base
Chris@16 214 < 1, T, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> base_t;
Chris@16 215
Chris@16 216 template<class T2>
Chris@16 217 struct rebind
Chris@16 218 {
Chris@16 219 typedef adaptive_pool_v1<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other;
Chris@16 220 };
Chris@16 221
Chris@16 222 adaptive_pool_v1(SegmentManager *segment_mngr)
Chris@16 223 : base_t(segment_mngr)
Chris@16 224 {}
Chris@16 225
Chris@16 226 template<class T2>
Chris@16 227 adaptive_pool_v1
Chris@16 228 (const adaptive_pool_v1<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> &other)
Chris@16 229 : base_t(other)
Chris@16 230 {}
Chris@16 231 };
Chris@16 232
Chris@16 233 } //namespace ipcdetail{
Chris@16 234
Chris@101 235 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 236
Chris@16 237 //!An STL node allocator that uses a segment manager as memory
Chris@16 238 //!source. The internal pointer type will of the same type (raw, smart) as
Chris@16 239 //!"typename SegmentManager::void_pointer" type. This allows
Chris@16 240 //!placing the allocator in shared memory, memory mapped-files, etc...
Chris@16 241 //!
Chris@16 242 //!This node allocator shares a segregated storage between all instances
Chris@16 243 //!of adaptive_pool with equal sizeof(T) placed in the same segment
Chris@16 244 //!group. NodesPerBlock is the number of nodes allocated at once when the allocator
Chris@16 245 //!needs runs out of nodes. MaxFreeBlocks is the maximum number of totally free blocks
Chris@16 246 //!that the adaptive node pool will hold. The rest of the totally free blocks will be
Chris@16 247 //!deallocated with the segment manager.
Chris@16 248 //!
Chris@16 249 //!OverheadPercent is the (approximated) maximum size overhead (1-20%) of the allocator:
Chris@16 250 //!(memory usable for nodes / total memory allocated from the segment manager)
Chris@16 251 template < class T
Chris@16 252 , class SegmentManager
Chris@16 253 , std::size_t NodesPerBlock
Chris@16 254 , std::size_t MaxFreeBlocks
Chris@16 255 , unsigned char OverheadPercent
Chris@16 256 >
Chris@16 257 class adaptive_pool
Chris@101 258 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
Chris@16 259 : public ipcdetail::adaptive_pool_base
Chris@16 260 < 2
Chris@16 261 , T
Chris@16 262 , SegmentManager
Chris@16 263 , NodesPerBlock
Chris@16 264 , MaxFreeBlocks
Chris@16 265 , OverheadPercent
Chris@16 266 >
Chris@101 267 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 268 {
Chris@16 269
Chris@16 270 #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 271 typedef ipcdetail::adaptive_pool_base
Chris@16 272 < 2, T, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> base_t;
Chris@16 273 public:
Chris@16 274 typedef boost::interprocess::version_type<adaptive_pool, 2> version;
Chris@16 275
Chris@16 276 template<class T2>
Chris@16 277 struct rebind
Chris@16 278 {
Chris@16 279 typedef adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other;
Chris@16 280 };
Chris@16 281
Chris@16 282 adaptive_pool(SegmentManager *segment_mngr)
Chris@16 283 : base_t(segment_mngr)
Chris@16 284 {}
Chris@16 285
Chris@16 286 template<class T2>
Chris@16 287 adaptive_pool
Chris@16 288 (const adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> &other)
Chris@16 289 : base_t(other)
Chris@16 290 {}
Chris@16 291
Chris@16 292 #else //BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 293 public:
Chris@16 294 typedef implementation_defined::segment_manager segment_manager;
Chris@16 295 typedef segment_manager::void_pointer void_pointer;
Chris@16 296 typedef implementation_defined::pointer pointer;
Chris@16 297 typedef implementation_defined::const_pointer const_pointer;
Chris@16 298 typedef T value_type;
Chris@16 299 typedef typename ipcdetail::add_reference
Chris@16 300 <value_type>::type reference;
Chris@16 301 typedef typename ipcdetail::add_reference
Chris@16 302 <const value_type>::type const_reference;
Chris@16 303 typedef typename segment_manager::size_type size_type;
Chris@16 304 typedef typename segment_manager::difference_type difference_type;
Chris@16 305
Chris@16 306 //!Obtains adaptive_pool from
Chris@16 307 //!adaptive_pool
Chris@16 308 template<class T2>
Chris@16 309 struct rebind
Chris@16 310 {
Chris@16 311 typedef adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other;
Chris@16 312 };
Chris@16 313
Chris@16 314 private:
Chris@16 315 //!Not assignable from
Chris@16 316 //!related adaptive_pool
Chris@16 317 template<class T2, class SegmentManager2, std::size_t N2, std::size_t F2, unsigned char OP2>
Chris@16 318 adaptive_pool& operator=
Chris@16 319 (const adaptive_pool<T2, SegmentManager2, N2, F2, OP2>&);
Chris@16 320
Chris@16 321 //!Not assignable from
Chris@16 322 //!other adaptive_pool
Chris@16 323 //adaptive_pool& operator=(const adaptive_pool&);
Chris@16 324
Chris@16 325 public:
Chris@16 326 //!Constructor from a segment manager. If not present, constructs a node
Chris@16 327 //!pool. Increments the reference count of the associated node pool.
Chris@16 328 //!Can throw boost::interprocess::bad_alloc
Chris@16 329 adaptive_pool(segment_manager *segment_mngr);
Chris@16 330
Chris@16 331 //!Copy constructor from other adaptive_pool. Increments the reference
Chris@16 332 //!count of the associated node pool. Never throws
Chris@16 333 adaptive_pool(const adaptive_pool &other);
Chris@16 334
Chris@16 335 //!Copy constructor from related adaptive_pool. If not present, constructs
Chris@16 336 //!a node pool. Increments the reference count of the associated node pool.
Chris@16 337 //!Can throw boost::interprocess::bad_alloc
Chris@16 338 template<class T2>
Chris@16 339 adaptive_pool
Chris@16 340 (const adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> &other);
Chris@16 341
Chris@16 342 //!Destructor, removes node_pool_t from memory
Chris@16 343 //!if its reference count reaches to zero. Never throws
Chris@16 344 ~adaptive_pool();
Chris@16 345
Chris@16 346 //!Returns a pointer to the node pool.
Chris@16 347 //!Never throws
Chris@16 348 void* get_node_pool() const;
Chris@16 349
Chris@16 350 //!Returns the segment manager.
Chris@16 351 //!Never throws
Chris@16 352 segment_manager* get_segment_manager()const;
Chris@16 353
Chris@16 354 //!Returns the number of elements that could be allocated.
Chris@16 355 //!Never throws
Chris@16 356 size_type max_size() const;
Chris@16 357
Chris@16 358 //!Allocate memory for an array of count elements.
Chris@16 359 //!Throws boost::interprocess::bad_alloc if there is no enough memory
Chris@16 360 pointer allocate(size_type count, cvoid_pointer hint = 0);
Chris@16 361
Chris@16 362 //!Deallocate allocated memory.
Chris@16 363 //!Never throws
Chris@16 364 void deallocate(const pointer &ptr, size_type count);
Chris@16 365
Chris@16 366 //!Deallocates all free blocks
Chris@16 367 //!of the pool
Chris@16 368 void deallocate_free_blocks();
Chris@16 369
Chris@16 370 //!Swaps allocators. Does not throw. If each allocator is placed in a
Chris@16 371 //!different memory segment, the result is undefined.
Chris@16 372 friend void swap(self_t &alloc1, self_t &alloc2);
Chris@16 373
Chris@16 374 //!Returns address of mutable object.
Chris@16 375 //!Never throws
Chris@16 376 pointer address(reference value) const;
Chris@16 377
Chris@16 378 //!Returns address of non mutable object.
Chris@16 379 //!Never throws
Chris@16 380 const_pointer address(const_reference value) const;
Chris@16 381 /*
Chris@16 382 //!Copy construct an object.
Chris@16 383 //!Throws if T's copy constructor throws
Chris@16 384 void construct(const pointer &ptr, const_reference v);
Chris@16 385
Chris@16 386 //!Destroys object. Throws if object's
Chris@16 387 //!destructor throws
Chris@16 388 void destroy(const pointer &ptr);
Chris@16 389 */
Chris@16 390 //!Returns maximum the number of objects the previously allocated memory
Chris@16 391 //!pointed by p can hold. This size only works for memory allocated with
Chris@16 392 //!allocate, allocation_command and allocate_many.
Chris@16 393 size_type size(const pointer &p) const;
Chris@16 394
Chris@101 395 pointer allocation_command(boost::interprocess::allocation_type command,
Chris@101 396 size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
Chris@16 397
Chris@16 398 //!Allocates many elements of size elem_size in a contiguous block
Chris@16 399 //!of memory. The minimum number to be allocated is min_elements,
Chris@16 400 //!the preferred and maximum number is
Chris@16 401 //!preferred_elements. The number of actually allocated elements is
Chris@16 402 //!will be assigned to received_size. The elements must be deallocated
Chris@16 403 //!with deallocate(...)
Chris@16 404 void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
Chris@16 405
Chris@16 406 //!Allocates n_elements elements, each one of size elem_sizes[i]in a
Chris@16 407 //!contiguous block
Chris@16 408 //!of memory. The elements must be deallocated
Chris@16 409 void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
Chris@16 410
Chris@16 411 //!Allocates many elements of size elem_size in a contiguous block
Chris@16 412 //!of memory. The minimum number to be allocated is min_elements,
Chris@16 413 //!the preferred and maximum number is
Chris@16 414 //!preferred_elements. The number of actually allocated elements is
Chris@16 415 //!will be assigned to received_size. The elements must be deallocated
Chris@16 416 //!with deallocate(...)
Chris@16 417 void deallocate_many(multiallocation_chain &chain);
Chris@16 418
Chris@16 419 //!Allocates just one object. Memory allocated with this function
Chris@16 420 //!must be deallocated only with deallocate_one().
Chris@16 421 //!Throws boost::interprocess::bad_alloc if there is no enough memory
Chris@16 422 pointer allocate_one();
Chris@16 423
Chris@16 424 //!Allocates many elements of size == 1 in a contiguous block
Chris@16 425 //!of memory. The minimum number to be allocated is min_elements,
Chris@16 426 //!the preferred and maximum number is
Chris@16 427 //!preferred_elements. The number of actually allocated elements is
Chris@16 428 //!will be assigned to received_size. Memory allocated with this function
Chris@16 429 //!must be deallocated only with deallocate_one().
Chris@16 430 void allocate_individual(size_type num_elements, multiallocation_chain &chain);
Chris@16 431
Chris@16 432 //!Deallocates memory previously allocated with allocate_one().
Chris@16 433 //!You should never use deallocate_one to deallocate memory allocated
Chris@16 434 //!with other functions different from allocate_one(). Never throws
Chris@16 435 void deallocate_one(const pointer &p);
Chris@16 436
Chris@16 437 //!Allocates many elements of size == 1 in a contiguous block
Chris@16 438 //!of memory. The minimum number to be allocated is min_elements,
Chris@16 439 //!the preferred and maximum number is
Chris@16 440 //!preferred_elements. The number of actually allocated elements is
Chris@16 441 //!will be assigned to received_size. Memory allocated with this function
Chris@16 442 //!must be deallocated only with deallocate_one().
Chris@16 443 void deallocate_individual(multiallocation_chain &chain);
Chris@16 444 #endif
Chris@16 445 };
Chris@16 446
Chris@16 447 #ifdef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 448
Chris@16 449 //!Equality test for same type
Chris@16 450 //!of adaptive_pool
Chris@16 451 template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline
Chris@16 452 bool operator==(const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1,
Chris@16 453 const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2);
Chris@16 454
Chris@16 455 //!Inequality test for same type
Chris@16 456 //!of adaptive_pool
Chris@16 457 template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline
Chris@16 458 bool operator!=(const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1,
Chris@16 459 const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2);
Chris@16 460
Chris@16 461 #endif
Chris@16 462
Chris@16 463 } //namespace interprocess {
Chris@16 464 } //namespace boost {
Chris@16 465
Chris@16 466 #include <boost/interprocess/detail/config_end.hpp>
Chris@16 467
Chris@16 468 #endif //#ifndef BOOST_INTERPROCESS_ADAPTIVE_POOL_HPP
Chris@16 469