diff options
Diffstat (limited to 'boost/interprocess/allocators/detail/allocator_common.hpp')
-rw-r--r-- | boost/interprocess/allocators/detail/allocator_common.hpp | 54 |
1 files changed, 27 insertions, 27 deletions
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) { |