diff options
Diffstat (limited to 'boost/interprocess/allocators')
10 files changed, 169 insertions, 169 deletions
diff --git a/boost/interprocess/allocators/adaptive_pool.hpp b/boost/interprocess/allocators/adaptive_pool.hpp index 846df5d413..a85202b4ee 100644 --- a/boost/interprocess/allocators/adaptive_pool.hpp +++ b/boost/interprocess/allocators/adaptive_pool.hpp @@ -35,7 +35,7 @@ #include <cstddef> //!\file -//!Describes adaptive_pool pooled shared memory STL compatible allocator +//!Describes adaptive_pool pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -101,11 +101,11 @@ class adaptive_pool_base typedef boost::container::container_detail::transform_multiallocation_chain <typename SegmentManager::multiallocation_chain, T>multiallocation_chain; - //!Obtains adaptive_pool_base from + //!Obtains adaptive_pool_base from //!adaptive_pool_base template<class T2> struct rebind - { + { typedef adaptive_pool_base<Version, T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; @@ -122,15 +122,15 @@ class adaptive_pool_base //!Constructor from a segment manager. If not present, constructs a node //!pool. Increments the reference count of the associated node pool. //!Can throw boost::interprocess::bad_alloc - adaptive_pool_base(segment_manager *segment_mngr) + adaptive_pool_base(segment_manager *segment_mngr) : mp_node_pool(ipcdetail::get_or_create_node_pool<typename node_pool<0>::type>(segment_mngr)) { } - //!Copy constructor from other adaptive_pool_base. Increments the reference + //!Copy constructor from other adaptive_pool_base. Increments the reference //!count of the associated node pool. Never throws - adaptive_pool_base(const adaptive_pool_base &other) - : mp_node_pool(other.get_node_pool()) - { - node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); + adaptive_pool_base(const adaptive_pool_base &other) + : mp_node_pool(other.get_node_pool()) + { + node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); } //!Assignment from other adaptive_pool_base @@ -151,7 +151,7 @@ class adaptive_pool_base //!Destructor, removes node_pool_t from memory //!if its reference count reaches to zero. Never throws - ~adaptive_pool_base() + ~adaptive_pool_base() { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); } //!Returns a pointer to the node pool. @@ -178,14 +178,14 @@ class adaptive_pool_base //!Equality test for same type //!of adaptive_pool_base template<unsigned int V, class T, class S, std::size_t NPC, std::size_t F, unsigned char OP> inline -bool operator==(const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc1, +bool operator==(const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc1, const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type //!of adaptive_pool_base template<unsigned int V, class T, class S, std::size_t NPC, std::size_t F, unsigned char OP> inline -bool operator!=(const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc1, +bool operator!=(const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc1, const adaptive_pool_base<V, T, S, NPC, F, OP> &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } @@ -211,11 +211,11 @@ class adaptive_pool_v1 template<class T2> struct rebind - { + { typedef adaptive_pool_v1<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; - adaptive_pool_v1(SegmentManager *segment_mngr) + adaptive_pool_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -230,13 +230,13 @@ class adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... //! -//!This node allocator shares a segregated storage between all instances -//!of adaptive_pool with equal sizeof(T) placed in the same segment +//!This node allocator shares a segregated storage between all instances +//!of adaptive_pool with equal sizeof(T) placed in the same segment //!group. NodesPerBlock is the number of nodes allocated at once when the allocator //!needs runs out of nodes. MaxFreeBlocks is the maximum number of totally free blocks //!that the adaptive node pool will hold. The rest of the totally free blocks will be @@ -271,11 +271,11 @@ class adaptive_pool template<class T2> struct rebind - { + { typedef adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; - adaptive_pool(SegmentManager *segment_mngr) + adaptive_pool(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -299,11 +299,11 @@ class adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains adaptive_pool from + //!Obtains adaptive_pool from //!adaptive_pool template<class T2> struct rebind - { + { typedef adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; @@ -314,7 +314,7 @@ class adaptive_pool adaptive_pool& operator= (const adaptive_pool<T2, SegmentManager2, N2, F2, OP2>&); - //!Not assignable from + //!Not assignable from //!other adaptive_pool //adaptive_pool& operator=(const adaptive_pool&); @@ -324,7 +324,7 @@ class adaptive_pool //!Can throw boost::interprocess::bad_alloc adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other adaptive_pool. Increments the reference + //!Copy constructor from other adaptive_pool. Increments the reference //!count of the associated node pool. Never throws adaptive_pool(const adaptive_pool &other); @@ -351,7 +351,7 @@ class adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -375,7 +375,7 @@ class adaptive_pool //!Never throws const_pointer address(const_reference value) const; /* - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -390,7 +390,7 @@ class adaptive_pool std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -448,13 +448,13 @@ class adaptive_pool //!Equality test for same type //!of adaptive_pool template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator==(const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator==(const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2); //!Inequality test for same type //!of adaptive_pool template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator!=(const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator!=(const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, const adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2); #endif diff --git a/boost/interprocess/allocators/allocator.hpp b/boost/interprocess/allocators/allocator.hpp index aa4b22dcc9..38e8c6901a 100644 --- a/boost/interprocess/allocators/allocator.hpp +++ b/boost/interprocess/allocators/allocator.hpp @@ -45,12 +45,12 @@ namespace boost { namespace interprocess { -//!An STL compatible allocator that uses a segment manager as +//!An STL compatible allocator that uses a segment manager as //!memory source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... template<class T, class SegmentManager> -class allocator +class allocator { public: //Segment manager @@ -115,7 +115,7 @@ class allocator //!objects of type T2 template<class T2> struct rebind - { + { typedef allocator<T2, SegmentManager> other; }; @@ -126,21 +126,21 @@ class allocator //!Constructor from the segment manager. //!Never throws - allocator(segment_manager *segment_mngr) + allocator(segment_manager *segment_mngr) : mp_mngr(segment_mngr) { } //!Constructor from other allocator. //!Never throws - allocator(const allocator &other) + allocator(const allocator &other) : mp_mngr(other.get_segment_manager()){ } //!Constructor from related allocator. //!Never throws template<class T2> - allocator(const allocator<T2, SegmentManager> &other) + allocator(const allocator<T2, SegmentManager> &other) : mp_mngr(other.get_segment_manager()){} - //!Allocates memory for an array of count elements. + //!Allocates memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_ptr hint = 0) { @@ -169,13 +169,13 @@ class allocator //!pointed by p can hold. This size only works for memory allocated with //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const - { + { return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0) { @@ -273,14 +273,14 @@ class allocator //!Equality test for same type //!of allocator template<class T, class SegmentManager> inline -bool operator==(const allocator<T , SegmentManager> &alloc1, +bool operator==(const allocator<T , SegmentManager> &alloc1, const allocator<T, SegmentManager> &alloc2) { return alloc1.get_segment_manager() == alloc2.get_segment_manager(); } //!Inequality test for same type //!of allocator template<class T, class SegmentManager> inline -bool operator!=(const allocator<T, SegmentManager> &alloc1, +bool operator!=(const allocator<T, SegmentManager> &alloc1, const allocator<T, SegmentManager> &alloc2) { return alloc1.get_segment_manager() != alloc2.get_segment_manager(); } diff --git a/boost/interprocess/allocators/cached_adaptive_pool.hpp b/boost/interprocess/allocators/cached_adaptive_pool.hpp index bec1050de5..98af033fe6 100644 --- a/boost/interprocess/allocators/cached_adaptive_pool.hpp +++ b/boost/interprocess/allocators/cached_adaptive_pool.hpp @@ -28,7 +28,7 @@ #include <cstddef> //!\file -//!Describes cached_adaptive_pool pooled shared memory STL compatible allocator +//!Describes cached_adaptive_pool pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -69,7 +69,7 @@ class cached_adaptive_pool_v1 template<class T2> struct rebind - { + { typedef cached_adaptive_pool_v1 <T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; @@ -77,7 +77,7 @@ class cached_adaptive_pool_v1 typedef typename base_t::size_type size_type; cached_adaptive_pool_v1(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -93,12 +93,12 @@ class cached_adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... //! -//!This node allocator shares a segregated storage between all instances of +//!This node allocator shares a segregated storage between all instances of //!cached_adaptive_pool with equal sizeof(T) placed in the same //!memory segment. But also caches some nodes privately to //!avoid some synchronization overhead. @@ -149,13 +149,13 @@ class cached_adaptive_pool template<class T2> struct rebind - { + { typedef cached_adaptive_pool <T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; cached_adaptive_pool(SegmentManager *segment_mngr, - std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -179,11 +179,11 @@ class cached_adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains cached_adaptive_pool from + //!Obtains cached_adaptive_pool from //!cached_adaptive_pool template<class T2> struct rebind - { + { typedef cached_adaptive_pool<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; @@ -194,7 +194,7 @@ class cached_adaptive_pool cached_adaptive_pool& operator= (const cached_adaptive_pool<T2, SegmentManager2, N2, F2, OP2>&); - //!Not assignable from + //!Not assignable from //!other cached_adaptive_pool cached_adaptive_pool& operator=(const cached_adaptive_pool&); @@ -204,7 +204,7 @@ class cached_adaptive_pool //!Can throw boost::interprocess::bad_alloc cached_adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other cached_adaptive_pool. Increments the reference + //!Copy constructor from other cached_adaptive_pool. Increments the reference //!count of the associated node pool. Never throws cached_adaptive_pool(const cached_adaptive_pool &other); @@ -231,7 +231,7 @@ class cached_adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -255,7 +255,7 @@ class cached_adaptive_pool //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -270,7 +270,7 @@ class cached_adaptive_pool std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -335,13 +335,13 @@ class cached_adaptive_pool //!Equality test for same type //!of cached_adaptive_pool template<class T, class S, std::size_t NodesPerBlock, std::size_t F, std::size_t OP> inline -bool operator==(const cached_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator==(const cached_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, const cached_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2); //!Inequality test for same type //!of cached_adaptive_pool template<class T, class S, std::size_t NodesPerBlock, std::size_t F, std::size_t OP> inline -bool operator!=(const cached_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator!=(const cached_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, const cached_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2); #endif diff --git a/boost/interprocess/allocators/cached_node_allocator.hpp b/boost/interprocess/allocators/cached_node_allocator.hpp index 03398156db..b0ad0e4ebc 100644 --- a/boost/interprocess/allocators/cached_node_allocator.hpp +++ b/boost/interprocess/allocators/cached_node_allocator.hpp @@ -28,7 +28,7 @@ #include <cstddef> //!\file -//!Describes cached_cached_node_allocator pooled shared memory STL compatible allocator +//!Describes cached_cached_node_allocator pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -64,7 +64,7 @@ class cached_node_allocator_v1 template<class T2> struct rebind - { + { typedef cached_node_allocator_v1 <T2, SegmentManager, NodesPerBlock> other; }; @@ -72,7 +72,7 @@ class cached_node_allocator_v1 typedef typename base_t::size_type size_type; cached_node_allocator_v1(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -122,12 +122,12 @@ class cached_node_allocator template<class T2> struct rebind - { + { typedef cached_node_allocator<T2, SegmentManager, NodesPerBlock> other; }; cached_node_allocator(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -151,11 +151,11 @@ class cached_node_allocator typedef typename SegmentManager::size_type size_type; typedef typename SegmentManager::difference_type difference_type; - //!Obtains cached_node_allocator from + //!Obtains cached_node_allocator from //!cached_node_allocator template<class T2> struct rebind - { + { typedef cached_node_allocator<T2, SegmentManager> other; }; @@ -166,7 +166,7 @@ class cached_node_allocator cached_node_allocator& operator= (const cached_node_allocator<T2, SegmentManager2, N2>&); - //!Not assignable from + //!Not assignable from //!other cached_node_allocator cached_node_allocator& operator=(const cached_node_allocator&); @@ -176,7 +176,7 @@ class cached_node_allocator //!Can throw boost::interprocess::bad_alloc cached_node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other cached_node_allocator. Increments the reference + //!Copy constructor from other cached_node_allocator. Increments the reference //!count of the associated node pool. Never throws cached_node_allocator(const cached_node_allocator &other); @@ -203,7 +203,7 @@ class cached_node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -227,7 +227,7 @@ class cached_node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Default construct an object. + //!Default construct an object. //!Throws if T's default constructor throws void construct(const pointer &ptr, const_reference v); @@ -242,7 +242,7 @@ class cached_node_allocator std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -307,13 +307,13 @@ class cached_node_allocator //!Equality test for same type //!of cached_node_allocator template<class T, class S, std::size_t NPC> inline -bool operator==(const cached_node_allocator<T, S, NPC> &alloc1, +bool operator==(const cached_node_allocator<T, S, NPC> &alloc1, const cached_node_allocator<T, S, NPC> &alloc2); //!Inequality test for same type //!of cached_node_allocator template<class T, class S, std::size_t NPC> inline -bool operator!=(const cached_node_allocator<T, S, NPC> &alloc1, +bool operator!=(const cached_node_allocator<T, S, NPC> &alloc1, const cached_node_allocator<T, S, NPC> &alloc2); #endif diff --git a/boost/interprocess/allocators/detail/adaptive_node_pool.hpp b/boost/interprocess/allocators/detail/adaptive_node_pool.hpp index 4ccc920663..abe183146f 100644 --- a/boost/interprocess/allocators/detail/adaptive_node_pool.hpp +++ b/boost/interprocess/allocators/detail/adaptive_node_pool.hpp @@ -74,7 +74,7 @@ class private_adaptive_node_pool }; //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!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 @@ -83,7 +83,7 @@ template< class SegmentManager , std::size_t MaxFreeBlocks , unsigned char OverheadPercent > -class shared_adaptive_node_pool +class shared_adaptive_node_pool : public ipcdetail::shared_pool_impl < private_adaptive_node_pool <SegmentManager, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> diff --git a/boost/interprocess/allocators/detail/allocator_common.hpp b/boost/interprocess/allocators/detail/allocator_common.hpp index ea660b1a90..ba14d3f64d 100644 --- a/boost/interprocess/allocators/detail/allocator_common.hpp +++ b/boost/interprocess/allocators/detail/allocator_common.hpp @@ -73,7 +73,7 @@ namespace ipcdetail { template<class NodePool> struct get_or_create_node_pool_func { - + //!This connects or constructs the unique instance of node_pool_t //!Can throw boost::interprocess::bad_alloc void operator()() @@ -90,7 +90,7 @@ struct get_or_create_node_pool_func //!object parameters get_or_create_node_pool_func(typename NodePool::segment_manager *mngr) : mp_segment_manager(mngr){} - + NodePool *mp_node_pool; typename NodePool::segment_manager *mp_segment_manager; }; @@ -103,13 +103,13 @@ inline NodePool *get_or_create_node_pool(typename NodePool::segment_manager *mgn return func.mp_node_pool; } -//!Object function that decrements the reference count. If the count -//!reaches to zero destroys the node allocator from memory. +//!Object function that decrements the reference count. If the count +//!reaches to zero destroys the node allocator from memory. //!Never throws template<class NodePool> struct destroy_if_last_link_func { - //!Decrements reference count and destroys the object if there is no + //!Decrements reference count and destroys the object if there is no //!more attached allocators. Never throws void operator()() { @@ -117,19 +117,19 @@ struct destroy_if_last_link_func if(mp_node_pool->dec_ref_count() != 0) return; //Last link, let's destroy the segment_manager - mp_node_pool->get_segment_manager()->template destroy<NodePool>(boost::interprocess::unique_instance); - } + mp_node_pool->get_segment_manager()->template destroy<NodePool>(boost::interprocess::unique_instance); + } //!Constructor. Initializes function //!object parameters - destroy_if_last_link_func(NodePool *pool) + destroy_if_last_link_func(NodePool *pool) : mp_node_pool(pool) {} NodePool *mp_node_pool; }; -//!Destruction function, initializes and executes destruction function +//!Destruction function, initializes and executes destruction function //!object. Never throws template<class NodePool> inline void destroy_node_pool_if_last_link(NodePool *pool) @@ -173,7 +173,7 @@ class cache_impl ~cache_impl() { this->deallocate_all_cached_nodes(); - ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); + ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); } NodePool *get_node_pool() const @@ -227,7 +227,7 @@ class cache_impl //Check if cache is full if(m_cached_nodes.size() >= m_max_cached_nodes){ //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); @@ -242,7 +242,7 @@ class cache_impl //Check if cache is full if(m_cached_nodes.size() >= m_max_cached_nodes){ //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); @@ -279,7 +279,7 @@ class cache_impl void priv_deallocate_n_nodes(size_type n) { //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. size_type count(n); @@ -296,10 +296,10 @@ class cache_impl public: void swap(cache_impl &other) { - ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); - m_cached_nodes.swap(other.m_cached_nodes); - ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); - } + ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); + m_cached_nodes.swap(other.m_cached_nodes); + ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); + } }; template<class Derived, class T, class SegmentManager> @@ -335,13 +335,13 @@ class array_allocation_impl //!pointed by p can hold. This size only works for memory allocated with //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const - { + { return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0) { @@ -450,7 +450,7 @@ class node_pool_allocation_impl }; public: - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0) { @@ -599,7 +599,7 @@ class cached_allocator_impl size_type get_max_cached_nodes() const { return m_cache.get_max_cached_nodes(); } - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0) { @@ -612,7 +612,7 @@ class cached_allocator_impl } else{ ret = this->get_segment_manager()->allocate(sizeof(T)*count); - } + } return pointer(static_cast<T*>(ret)); } @@ -686,20 +686,20 @@ class cached_allocator_impl //!Equality test for same type of //!cached_allocator_impl template<class T, class N, unsigned int V> inline -bool operator==(const cached_allocator_impl<T, N, V> &alloc1, +bool operator==(const cached_allocator_impl<T, N, V> &alloc1, const cached_allocator_impl<T, N, V> &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type of //!cached_allocator_impl template<class T, class N, unsigned int V> inline -bool operator!=(const cached_allocator_impl<T, N, V> &alloc1, +bool operator!=(const cached_allocator_impl<T, N, V> &alloc1, const cached_allocator_impl<T, N, V> &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!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 private_node_allocator_t> @@ -736,7 +736,7 @@ class shared_pool_impl //----------------------- return private_node_allocator_t::allocate_node(); } - + //!Deallocates an array pointed by ptr. Never throws void deallocate_node(void *ptr) { @@ -756,7 +756,7 @@ class shared_pool_impl return private_node_allocator_t::allocate_nodes(nodes, n); } */ - //!Allocates n nodes. + //!Allocates n nodes. //!Can throw boost::interprocess::bad_alloc multiallocation_chain allocate_nodes(const size_type n) { diff --git a/boost/interprocess/allocators/detail/node_pool.hpp b/boost/interprocess/allocators/detail/node_pool.hpp index 7327ff92d5..562b64863b 100644 --- a/boost/interprocess/allocators/detail/node_pool.hpp +++ b/boost/interprocess/allocators/detail/node_pool.hpp @@ -37,7 +37,7 @@ namespace ipcdetail { //!Pooled shared memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is +//!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 > @@ -73,18 +73,18 @@ class private_node_pool //!Pooled shared memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is +//!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 +//!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 +class shared_node_pool : public ipcdetail::shared_pool_impl < private_node_pool <SegmentManager, NodeSize, NodesPerBlock> diff --git a/boost/interprocess/allocators/node_allocator.hpp b/boost/interprocess/allocators/node_allocator.hpp index f1c3259d73..2c1fe566a3 100644 --- a/boost/interprocess/allocators/node_allocator.hpp +++ b/boost/interprocess/allocators/node_allocator.hpp @@ -34,7 +34,7 @@ #include <cstddef> //!\file -//!Describes node_allocator pooled shared memory STL compatible allocator +//!Describes node_allocator pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -98,11 +98,11 @@ class node_allocator_base typedef boost::container::container_detail::transform_multiallocation_chain <typename SegmentManager::multiallocation_chain, T>multiallocation_chain; - //!Obtains node_allocator_base from + //!Obtains node_allocator_base from //!node_allocator_base template<class T2> struct rebind - { + { typedef node_allocator_base<Version, T2, SegmentManager, NodesPerBlock> other; }; @@ -121,15 +121,15 @@ class node_allocator_base //!Constructor from a segment manager. If not present, constructs a node //!pool. Increments the reference count of the associated node pool. //!Can throw boost::interprocess::bad_alloc - node_allocator_base(segment_manager *segment_mngr) + node_allocator_base(segment_manager *segment_mngr) : mp_node_pool(ipcdetail::get_or_create_node_pool<typename node_pool<0>::type>(segment_mngr)) { } - //!Copy constructor from other node_allocator_base. Increments the reference + //!Copy constructor from other node_allocator_base. Increments the reference //!count of the associated node pool. Never throws - node_allocator_base(const node_allocator_base &other) - : mp_node_pool(other.get_node_pool()) - { - node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); + node_allocator_base(const node_allocator_base &other) + : mp_node_pool(other.get_node_pool()) + { + node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); } //!Copy constructor from related node_allocator_base. If not present, constructs @@ -150,7 +150,7 @@ class node_allocator_base //!Destructor, removes node_pool_t from memory //!if its reference count reaches to zero. Never throws - ~node_allocator_base() + ~node_allocator_base() { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); } //!Returns a pointer to the node pool. @@ -177,14 +177,14 @@ class node_allocator_base //!Equality test for same type //!of node_allocator_base template<unsigned int V, class T, class S, std::size_t NPC> inline -bool operator==(const node_allocator_base<V, T, S, NPC> &alloc1, +bool operator==(const node_allocator_base<V, T, S, NPC> &alloc1, const node_allocator_base<V, T, S, NPC> &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type //!of node_allocator_base template<unsigned int V, class T, class S, std::size_t NPC> inline -bool operator!=(const node_allocator_base<V, T, S, NPC> &alloc1, +bool operator!=(const node_allocator_base<V, T, S, NPC> &alloc1, const node_allocator_base<V, T, S, NPC> &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } @@ -206,11 +206,11 @@ class node_allocator_v1 template<class T2> struct rebind - { + { typedef node_allocator_v1<T2, SegmentManager, NodesPerBlock> other; }; - node_allocator_v1(SegmentManager *segment_mngr) + node_allocator_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -225,12 +225,12 @@ class node_allocator_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... -//!This node allocator shares a segregated storage between all instances -//!of node_allocator with equal sizeof(T) placed in the same segment +//!This node allocator shares a segregated storage between all instances +//!of node_allocator with equal sizeof(T) placed in the same segment //!group. NodesPerBlock is the number of nodes allocated at once when the allocator //!needs runs out of nodes template < class T @@ -256,11 +256,11 @@ class node_allocator template<class T2> struct rebind - { + { typedef node_allocator<T2, SegmentManager, NodesPerBlock> other; }; - node_allocator(SegmentManager *segment_mngr) + node_allocator(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -284,11 +284,11 @@ class node_allocator typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains node_allocator from + //!Obtains node_allocator from //!node_allocator template<class T2> struct rebind - { + { typedef node_allocator<T2, SegmentManager, NodesPerBlock> other; }; @@ -299,7 +299,7 @@ class node_allocator node_allocator& operator= (const node_allocator<T2, SegmentManager2, N2>&); - //!Not assignable from + //!Not assignable from //!other node_allocator //node_allocator& operator=(const node_allocator&); @@ -309,7 +309,7 @@ class node_allocator //!Can throw boost::interprocess::bad_alloc node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other node_allocator. Increments the reference + //!Copy constructor from other node_allocator. Increments the reference //!count of the associated node pool. Never throws node_allocator(const node_allocator &other); @@ -336,7 +336,7 @@ class node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -360,7 +360,7 @@ class node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -375,7 +375,7 @@ class node_allocator std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -433,13 +433,13 @@ class node_allocator //!Equality test for same type //!of node_allocator template<class T, class S, std::size_t NPC> inline -bool operator==(const node_allocator<T, S, NPC> &alloc1, +bool operator==(const node_allocator<T, S, NPC> &alloc1, const node_allocator<T, S, NPC> &alloc2); //!Inequality test for same type //!of node_allocator template<class T, class S, std::size_t NPC> inline -bool operator!=(const node_allocator<T, S, NPC> &alloc1, +bool operator!=(const node_allocator<T, S, NPC> &alloc1, const node_allocator<T, S, NPC> &alloc2); #endif diff --git a/boost/interprocess/allocators/private_adaptive_pool.hpp b/boost/interprocess/allocators/private_adaptive_pool.hpp index 301fb92daa..febe85c69d 100644 --- a/boost/interprocess/allocators/private_adaptive_pool.hpp +++ b/boost/interprocess/allocators/private_adaptive_pool.hpp @@ -33,7 +33,7 @@ #include <cstddef> //!\file -//!Describes private_adaptive_pool_base pooled shared memory STL compatible allocator +//!Describes private_adaptive_pool_base pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -102,7 +102,7 @@ class private_adaptive_pool_base //!Obtains node_allocator from other node_allocator template<class T2> struct rebind - { + { typedef private_adaptive_pool_base <Version, T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; @@ -154,7 +154,7 @@ class private_adaptive_pool_base {} //!Destructor, frees all used memory. Never throws - ~private_adaptive_pool_base() + ~private_adaptive_pool_base() {} //!Returns the segment manager. Never throws @@ -178,13 +178,13 @@ class private_adaptive_pool_base //!Equality test for same type of private_adaptive_pool_base template<unsigned int V, class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator==(const private_adaptive_pool_base<V, T, S, NodesPerBlock, F, OP> &alloc1, +bool operator==(const private_adaptive_pool_base<V, T, S, NodesPerBlock, F, OP> &alloc1, const private_adaptive_pool_base<V, T, S, NodesPerBlock, F, OP> &alloc2) { return &alloc1 == &alloc2; } //!Inequality test for same type of private_adaptive_pool_base template<unsigned int V, class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator!=(const private_adaptive_pool_base<V, T, S, NodesPerBlock, F, OP> &alloc1, +bool operator!=(const private_adaptive_pool_base<V, T, S, NodesPerBlock, F, OP> &alloc1, const private_adaptive_pool_base<V, T, S, NodesPerBlock, F, OP> &alloc2) { return &alloc1 != &alloc2; } @@ -210,11 +210,11 @@ class private_adaptive_pool_v1 template<class T2> struct rebind - { + { typedef private_adaptive_pool_v1<T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; - private_adaptive_pool_v1(SegmentManager *segment_mngr) + private_adaptive_pool_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -229,7 +229,7 @@ class private_adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... @@ -269,12 +269,12 @@ class private_adaptive_pool template<class T2> struct rebind - { + { typedef private_adaptive_pool <T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; - private_adaptive_pool(SegmentManager *segment_mngr) + private_adaptive_pool(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -298,11 +298,11 @@ class private_adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains private_adaptive_pool from + //!Obtains private_adaptive_pool from //!private_adaptive_pool template<class T2> struct rebind - { + { typedef private_adaptive_pool <T2, SegmentManager, NodesPerBlock, MaxFreeBlocks, OverheadPercent> other; }; @@ -314,7 +314,7 @@ class private_adaptive_pool private_adaptive_pool& operator= (const private_adaptive_pool<T2, SegmentManager2, N2, F2>&); - //!Not assignable from + //!Not assignable from //!other private_adaptive_pool private_adaptive_pool& operator=(const private_adaptive_pool&); @@ -324,7 +324,7 @@ class private_adaptive_pool //!Can throw boost::interprocess::bad_alloc private_adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other private_adaptive_pool. Increments the reference + //!Copy constructor from other private_adaptive_pool. Increments the reference //!count of the associated node pool. Never throws private_adaptive_pool(const private_adaptive_pool &other); @@ -351,7 +351,7 @@ class private_adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -375,7 +375,7 @@ class private_adaptive_pool //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -390,7 +390,7 @@ class private_adaptive_pool std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -448,13 +448,13 @@ class private_adaptive_pool //!Equality test for same type //!of private_adaptive_pool template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator==(const private_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator==(const private_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, const private_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2); //!Inequality test for same type //!of private_adaptive_pool template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator!=(const private_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator!=(const private_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc1, const private_adaptive_pool<T, S, NodesPerBlock, F, OP> &alloc2); #endif diff --git a/boost/interprocess/allocators/private_node_allocator.hpp b/boost/interprocess/allocators/private_node_allocator.hpp index f202e316fa..46b7dd6097 100644 --- a/boost/interprocess/allocators/private_node_allocator.hpp +++ b/boost/interprocess/allocators/private_node_allocator.hpp @@ -33,7 +33,7 @@ #include <cstddef> //!\file -//!Describes private_node_allocator_base pooled shared memory STL compatible allocator +//!Describes private_node_allocator_base pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -97,7 +97,7 @@ class private_node_allocator_base //!Obtains node_allocator from other node_allocator template<class T2> struct rebind - { + { typedef private_node_allocator_base <Version, T2, SegmentManager, NodesPerBlock> other; }; @@ -146,7 +146,7 @@ class private_node_allocator_base {} //!Destructor, frees all used memory. Never throws - ~private_node_allocator_base() + ~private_node_allocator_base() {} //!Returns the segment manager. Never throws @@ -170,13 +170,13 @@ class private_node_allocator_base //!Equality test for same type of private_node_allocator_base template<unsigned int V, class T, class S, std::size_t NPC> inline -bool operator==(const private_node_allocator_base<V, T, S, NPC> &alloc1, +bool operator==(const private_node_allocator_base<V, T, S, NPC> &alloc1, const private_node_allocator_base<V, T, S, NPC> &alloc2) { return &alloc1 == &alloc2; } //!Inequality test for same type of private_node_allocator_base template<unsigned int V, class T, class S, std::size_t NPC> inline -bool operator!=(const private_node_allocator_base<V, T, S, NPC> &alloc1, +bool operator!=(const private_node_allocator_base<V, T, S, NPC> &alloc1, const private_node_allocator_base<V, T, S, NPC> &alloc2) { return &alloc1 != &alloc2; } @@ -198,11 +198,11 @@ class private_node_allocator_v1 template<class T2> struct rebind - { + { typedef private_node_allocator_v1<T2, SegmentManager, NodesPerBlock> other; }; - private_node_allocator_v1(SegmentManager *segment_mngr) + private_node_allocator_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -217,11 +217,11 @@ class private_node_allocator_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... -//!This allocator has its own node pool. NodesPerBlock is the number of nodes allocated +//!This allocator has its own node pool. NodesPerBlock is the number of nodes allocated //!at once when the allocator needs runs out of nodes template < class T , class SegmentManager @@ -246,12 +246,12 @@ class private_node_allocator template<class T2> struct rebind - { + { typedef private_node_allocator <T2, SegmentManager, NodesPerBlock> other; }; - private_node_allocator(SegmentManager *segment_mngr) + private_node_allocator(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -275,11 +275,11 @@ class private_node_allocator typedef typename segment_manager::size_type size_type; typedef typename segment_manage::difference_type difference_type; - //!Obtains private_node_allocator from + //!Obtains private_node_allocator from //!private_node_allocator template<class T2> struct rebind - { + { typedef private_node_allocator <T2, SegmentManager, NodesPerBlock> other; }; @@ -291,7 +291,7 @@ class private_node_allocator private_node_allocator& operator= (const private_node_allocator<T2, SegmentManager2, N2>&); - //!Not assignable from + //!Not assignable from //!other private_node_allocator private_node_allocator& operator=(const private_node_allocator&); @@ -301,7 +301,7 @@ class private_node_allocator //!Can throw boost::interprocess::bad_alloc private_node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other private_node_allocator. Increments the reference + //!Copy constructor from other private_node_allocator. Increments the reference //!count of the associated node pool. Never throws private_node_allocator(const private_node_allocator &other); @@ -328,7 +328,7 @@ class private_node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -352,7 +352,7 @@ class private_node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -367,7 +367,7 @@ class private_node_allocator std::pair<pointer, bool> allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -425,13 +425,13 @@ class private_node_allocator //!Equality test for same type //!of private_node_allocator template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator==(const private_node_allocator<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator==(const private_node_allocator<T, S, NodesPerBlock, F, OP> &alloc1, const private_node_allocator<T, S, NodesPerBlock, F, OP> &alloc2); //!Inequality test for same type //!of private_node_allocator template<class T, class S, std::size_t NodesPerBlock, std::size_t F, unsigned char OP> inline -bool operator!=(const private_node_allocator<T, S, NodesPerBlock, F, OP> &alloc1, +bool operator!=(const private_node_allocator<T, S, NodesPerBlock, F, OP> &alloc1, const private_node_allocator<T, S, NodesPerBlock, F, OP> &alloc2); #endif |