Updated Boost libraries to version 1.49, and recompiled them with NDK r8d

This commit is contained in:
pelya
2013-01-05 20:34:39 +02:00
parent 1c1e8f84ad
commit ebebac16b6
3885 changed files with 464519 additions and 52852 deletions
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
// (C) Copyright Ion Gaztanaga 2005-2011. 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)
//
@@ -32,7 +32,7 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/smart_ptr/deleter.hpp>
#include <boost/interprocess/detail/move.hpp>
#include <boost/move/move.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <cstddef> //std::size_t
#include <string> //char_traits
@@ -74,12 +74,14 @@ class segment_manager_base
//Experimental. Don't use
typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain;
typedef typename MemoryAlgorithm::difference_type difference_type;
typedef typename MemoryAlgorithm::size_type size_type;
/// @endcond
//!This constant indicates the payload size
//!associated with each allocation of the memory algorithm
static const std::size_t PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation;
static const size_type PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation;
//!Constructor of the segment_manager_base
//!
@@ -92,7 +94,7 @@ class segment_manager_base
//!dynamic allocation
//!
//!Can throw
segment_manager_base(std::size_t size, std::size_t reserved_bytes)
segment_manager_base(size_type size, size_type reserved_bytes)
: MemoryAlgorithm(size, reserved_bytes)
{
BOOST_ASSERT((sizeof(segment_manager_base<MemoryAlgorithm>) == sizeof(MemoryAlgorithm)));
@@ -100,22 +102,22 @@ class segment_manager_base
//!Returns the size of the memory
//!segment
std::size_t get_size() const
size_type get_size() const
{ return MemoryAlgorithm::get_size(); }
//!Returns the number of free bytes of the memory
//!segment
std::size_t get_free_memory() const
size_type get_free_memory() const
{ return MemoryAlgorithm::get_free_memory(); }
//!Obtains the minimum size needed by
//!the segment manager
static std::size_t get_min_size (std::size_t size)
static size_type get_min_size (size_type size)
{ return MemoryAlgorithm::get_min_size(size); }
//!Allocates nbytes bytes. This function is only used in
//!single-segment management. Never throws
void * allocate (std::size_t nbytes, std::nothrow_t)
void * allocate (size_type nbytes, std::nothrow_t)
{ return MemoryAlgorithm::allocate(nbytes); }
/// @cond
@@ -123,46 +125,46 @@ class segment_manager_base
//Experimental. Dont' use.
//!Allocates n_elements of
//!elem_size bytes. Throws bad_alloc on failure.
multiallocation_chain allocate_many(std::size_t elem_bytes, std::size_t num_elements)
multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
{
multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements));
if(mem.empty()) throw bad_alloc();
return boost::interprocess::move(mem);
return boost::move(mem);
}
//!Allocates n_elements, each one of
//!element_lenghts[i]*sizeof_element bytes. Throws bad_alloc on failure.
multiallocation_chain allocate_many
(const std::size_t *element_lenghts, std::size_t n_elements, std::size_t sizeof_element = 1)
(const size_type *element_lenghts, size_type n_elements, size_type sizeof_element = 1)
{
multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element));
if(mem.empty()) throw bad_alloc();
return boost::interprocess::move(mem);
return boost::move(mem);
}
//!Allocates n_elements of
//!elem_size bytes. Returns a default constructed iterator on failure.
multiallocation_chain allocate_many
(std::size_t elem_bytes, std::size_t num_elements, std::nothrow_t)
(size_type elem_bytes, size_type num_elements, std::nothrow_t)
{ return MemoryAlgorithm::allocate_many(elem_bytes, num_elements); }
//!Allocates n_elements, each one of
//!element_lenghts[i]*sizeof_element bytes.
//!Returns a default constructed iterator on failure.
multiallocation_chain allocate_many
(const std::size_t *elem_sizes, std::size_t n_elements, std::size_t sizeof_element, std::nothrow_t)
(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, std::nothrow_t)
{ return MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element); }
//!Deallocates elements pointed by the
//!multiallocation iterator range.
void deallocate_many(multiallocation_chain chain)
{ MemoryAlgorithm::deallocate_many(boost::interprocess::move(chain)); }
{ MemoryAlgorithm::deallocate_many(boost::move(chain)); }
/// @endcond
//!Allocates nbytes bytes. Throws boost::interprocess::bad_alloc
//!on failure
void * allocate(std::size_t nbytes)
void * allocate(size_type nbytes)
{
void * ret = MemoryAlgorithm::allocate(nbytes);
if(!ret)
@@ -172,12 +174,12 @@ class segment_manager_base
//!Allocates nbytes bytes. This function is only used in
//!single-segment management. Never throws
void * allocate_aligned (std::size_t nbytes, std::size_t alignment, std::nothrow_t)
void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t)
{ return MemoryAlgorithm::allocate_aligned(nbytes, alignment); }
//!Allocates nbytes bytes. This function is only used in
//!single-segment management. Throws bad_alloc when fails
void * allocate_aligned(std::size_t nbytes, std::size_t alignment)
void * allocate_aligned(size_type nbytes, size_type alignment)
{
void * ret = MemoryAlgorithm::allocate_aligned(nbytes, alignment);
if(!ret)
@@ -187,8 +189,8 @@ class segment_manager_base
template<class T>
std::pair<T *, bool>
allocation_command (boost::interprocess::allocation_type command, std::size_t limit_size,
std::size_t preferred_size,std::size_t &received_size,
allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
size_type preferred_size,size_type &received_size,
T *reuse_ptr = 0)
{
std::pair<T *, bool> ret = MemoryAlgorithm::allocation_command
@@ -200,9 +202,9 @@ class segment_manager_base
}
std::pair<void *, bool>
raw_allocation_command (boost::interprocess::allocation_type command, std::size_t limit_objects,
std::size_t preferred_objects,std::size_t &received_objects,
void *reuse_ptr = 0, std::size_t sizeof_object = 1)
raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
size_type preferred_objects,size_type &received_objects,
void *reuse_ptr = 0, size_type sizeof_object = 1)
{
std::pair<void *, bool> ret = MemoryAlgorithm::raw_allocation_command
( command | boost::interprocess::nothrow_allocation, limit_objects, preferred_objects, received_objects
@@ -219,7 +221,7 @@ class segment_manager_base
//!Increases managed memory in extra_size bytes more. This only works
//!with single-segment management.
void grow(std::size_t extra_size)
void grow(size_type extra_size)
{ MemoryAlgorithm::grow(extra_size); }
//!Decreases managed memory to the minimum. This only works
@@ -243,17 +245,17 @@ class segment_manager_base
{ MemoryAlgorithm::zero_free_memory(); }
//!Returns the size of the buffer previously allocated pointed by ptr
std::size_t size(const void *ptr) const
size_type size(const void *ptr) const
{ return MemoryAlgorithm::size(ptr); }
/// @cond
protected:
void * prot_anonymous_construct
(std::size_t num, bool dothrow, detail::in_place_interface &table)
(size_type num, bool dothrow, ipcdetail::in_place_interface &table)
{
typedef detail::block_header block_header_t;
block_header_t block_info ( table.size*num
, table.alignment
typedef ipcdetail::block_header<size_type> block_header_t;
block_header_t block_info ( size_type(table.size*num)
, size_type(table.alignment)
, anonymous_type
, 1
, 0);
@@ -272,7 +274,7 @@ class segment_manager_base
}
//Build scoped ptr to avoid leaks with constructor exception
detail::mem_algo_deallocator<MemoryAlgorithm> mem(ptr_struct, *this);
ipcdetail::mem_algo_deallocator<MemoryAlgorithm> mem(ptr_struct, *this);
//Now construct the header
block_header_t * hdr = new(ptr_struct) block_header_t(block_info);
@@ -280,7 +282,7 @@ class segment_manager_base
ptr = hdr->value();
//Now call constructors
detail::array_construct(ptr, num, table);
ipcdetail::array_construct(ptr, num, table);
//All constructors successful, we don't want erase memory
mem.release();
@@ -288,11 +290,11 @@ class segment_manager_base
}
//!Calls the destructor and makes an anonymous deallocate
void prot_anonymous_destroy(const void *object, detail::in_place_interface &table)
void prot_anonymous_destroy(const void *object, ipcdetail::in_place_interface &table)
{
//Get control data from associated with this object
typedef detail::block_header block_header_t;
typedef ipcdetail::block_header<size_type> block_header_t;
block_header_t *ctrl_data = block_header_t::block_header_from_value(object, table.size, table.alignment);
//-------------------------------
@@ -307,7 +309,7 @@ class segment_manager_base
//Call destructors and free memory
//Build scoped ptr to avoid leaks with destructor exception
std::size_t destroyed = 0;
table.destroy_n(const_cast<void*>(object), ctrl_data->m_value_bytes/table.size, destroyed);
table.destroy_n(const_cast<void*>(object), ctrl_data->m_value_bytes/table.size, destroyed);
this->deallocate(ctrl_data);
}
/// @endcond
@@ -341,35 +343,37 @@ class segment_manager
segment_manager(const segment_manager &);
segment_manager &operator=(const segment_manager &);
typedef segment_manager_base<MemoryAlgorithm> Base;
typedef detail::block_header block_header_t;
/// @endcond
public:
typedef MemoryAlgorithm memory_algorithm;
typedef typename Base::void_pointer void_pointer;
typedef typename Base::size_type size_type;
typedef typename Base::difference_type difference_type;
typedef CharType char_type;
typedef segment_manager_base<MemoryAlgorithm> segment_manager_base_type;
static const std::size_t PayloadPerAllocation = Base::PayloadPerAllocation;
static const size_type PayloadPerAllocation = Base::PayloadPerAllocation;
/// @cond
private:
typedef detail::index_config<CharType, MemoryAlgorithm> index_config_named;
typedef detail::index_config<char, MemoryAlgorithm> index_config_unique;
typedef ipcdetail::block_header<size_type> block_header_t;
typedef ipcdetail::index_config<CharType, MemoryAlgorithm> index_config_named;
typedef ipcdetail::index_config<char, MemoryAlgorithm> index_config_unique;
typedef IndexType<index_config_named> index_type;
typedef detail::bool_<is_intrusive_index<index_type>::value > is_intrusive_t;
typedef detail::bool_<is_node_index<index_type>::value> is_node_index_t;
typedef ipcdetail::bool_<is_intrusive_index<index_type>::value > is_intrusive_t;
typedef ipcdetail::bool_<is_node_index<index_type>::value> is_node_index_t;
public:
typedef IndexType<index_config_named> named_index_t;
typedef IndexType<index_config_unique> unique_index_t;
typedef detail::char_ptr_holder<CharType> char_ptr_holder_t;
typedef detail::segment_manager_iterator_transform
typedef ipcdetail::char_ptr_holder<CharType> char_ptr_holder_t;
typedef ipcdetail::segment_manager_iterator_transform
<typename named_index_t::const_iterator
,is_intrusive_index<index_type>::value> named_transform;
typedef detail::segment_manager_iterator_transform
typedef ipcdetail::segment_manager_iterator_transform
<typename unique_index_t::const_iterator
,is_intrusive_index<index_type>::value> unique_transform;
/// @endcond
@@ -387,14 +391,14 @@ class segment_manager
template<class T>
struct construct_proxy
{
typedef detail::named_proxy<segment_manager, T, false> type;
typedef ipcdetail::named_proxy<segment_manager, T, false> type;
};
//!Constructor proxy object definition helper class
template<class T>
struct construct_iter_proxy
{
typedef detail::named_proxy<segment_manager, T, true> type;
typedef ipcdetail::named_proxy<segment_manager, T, true> type;
};
/// @endcond
@@ -403,7 +407,7 @@ class segment_manager
//!"size" is the size of the memory segment where
//!the segment manager is being constructed.
//!Can throw
segment_manager(std::size_t size)
segment_manager(size_type size)
: Base(size, priv_get_reserved_bytes())
, m_header(static_cast<Base*>(get_this_pointer()))
{
@@ -415,28 +419,28 @@ class segment_manager
//!and the object count. On failure the first member of the
//!returned pair is 0.
template <class T>
std::pair<T*, std::size_t> find (const CharType* name)
std::pair<T*, size_type> find (const CharType* name)
{ return this->priv_find_impl<T>(name, true); }
//!Tries to find a previous unique allocation. Returns the address
//!and the object count. On failure the first member of the
//!returned pair is 0.
template <class T>
std::pair<T*, std::size_t> find (const detail::unique_instance_t* name)
std::pair<T*, size_type> find (const ipcdetail::unique_instance_t* name)
{ return this->priv_find_impl<T>(name, true); }
//!Tries to find a previous named allocation. Returns the address
//!and the object count. On failure the first member of the
//!returned pair is 0. This search is not mutex-protected!
template <class T>
std::pair<T*, std::size_t> find_no_lock (const CharType* name)
std::pair<T*, size_type> find_no_lock (const CharType* name)
{ return this->priv_find_impl<T>(name, false); }
//!Tries to find a previous unique allocation. Returns the address
//!and the object count. On failure the first member of the
//!returned pair is 0. This search is not mutex-protected!
template <class T>
std::pair<T*, std::size_t> find_no_lock (const detail::unique_instance_t* name)
std::pair<T*, size_type> find_no_lock (const ipcdetail::unique_instance_t* name)
{ return this->priv_find_impl<T>(name, false); }
//!Returns throwing "construct" proxy
@@ -521,9 +525,9 @@ class segment_manager
//!Destroys a previously created unique instance.
//!Returns false if the object was not present.
template <class T>
bool destroy(const detail::unique_instance_t *)
bool destroy(const ipcdetail::unique_instance_t *)
{
detail::placement_destroy<T> dtor;
ipcdetail::placement_destroy<T> dtor;
return this->priv_generic_named_destroy<char>
(typeid(T).name(), m_header.m_unique_index, dtor, is_intrusive_t());
}
@@ -533,7 +537,7 @@ class segment_manager
template <class T>
bool destroy(const CharType *name)
{
detail::placement_destroy<T> dtor;
ipcdetail::placement_destroy<T> dtor;
return this->priv_generic_named_destroy<CharType>
(name, m_header.m_named_index, dtor, is_intrusive_t());
}
@@ -544,8 +548,8 @@ class segment_manager
void destroy_ptr(const T *p)
{
//If T is void transform it to char
typedef typename detail::char_if_void<T>::type data_t;
detail::placement_destroy<data_t> dtor;
typedef typename ipcdetail::char_if_void<T>::type data_t;
ipcdetail::placement_destroy<data_t> dtor;
priv_destroy_ptr(p, dtor);
}
@@ -558,7 +562,7 @@ class segment_manager
//!Returns the length of an object created with construct/find_or_construct
//!functions. Does not throw.
template<class T>
static std::size_t get_instance_length(const T *ptr)
static size_type get_instance_length(const T *ptr)
{ return priv_get_instance_length(block_header_t::block_header_from_value(ptr), sizeof(T)); }
//!Returns is the the name of an object created with construct/find_or_construct
@@ -570,7 +574,7 @@ class segment_manager
//!Preallocates needed index resources to optimize the
//!creation of "num" named objects in the managed memory segment.
//!Can throw boost::interprocess::bad_alloc if there is no enough memory.
void reserve_named_objects(std::size_t num)
void reserve_named_objects(size_type num)
{
//-------------------------------
scoped_lock<rmutex> guard(m_header);
@@ -581,7 +585,7 @@ class segment_manager
//!Preallocates needed index resources to optimize the
//!creation of "num" unique objects in the managed memory segment.
//!Can throw boost::interprocess::bad_alloc if there is no enough memory.
void reserve_unique_objects(std::size_t num)
void reserve_unique_objects(size_type num)
{
//-------------------------------
scoped_lock<rmutex> guard(m_header);
@@ -602,7 +606,7 @@ class segment_manager
//!Returns the number of named objects stored in
//!the segment.
std::size_t get_num_named_objects()
size_type get_num_named_objects()
{
//-------------------------------
scoped_lock<rmutex> guard(m_header);
@@ -612,7 +616,7 @@ class segment_manager
//!Returns the number of unique objects stored in
//!the segment.
std::size_t get_num_unique_objects()
size_type get_num_unique_objects()
{
//-------------------------------
scoped_lock<rmutex> guard(m_header);
@@ -622,7 +626,7 @@ class segment_manager
//!Obtains the minimum size needed by the
//!segment manager
static std::size_t get_min_size()
static size_type get_min_size()
{ return Base::get_min_size(priv_get_reserved_bytes()); }
//!Returns a constant iterator to the beginning of the information about
@@ -694,10 +698,10 @@ class segment_manager
//!encapsulated in an object function.
template<class T>
T *generic_construct(const CharType *name,
std::size_t num,
size_type num,
bool try2find,
bool dothrow,
detail::in_place_interface &table)
ipcdetail::in_place_interface &table)
{
return static_cast<T*>
(priv_generic_construct(name, num, try2find, dothrow, table));
@@ -708,12 +712,12 @@ class segment_manager
//!and the object count. On failure the first member of the
//!returned pair is 0.
template <class T>
std::pair<T*, std::size_t> priv_find_impl (const CharType* name, bool lock)
std::pair<T*, size_type> priv_find_impl (const CharType* name, bool lock)
{
//The name can't be null, no anonymous object can be found by name
BOOST_ASSERT(name != 0);
detail::placement_destroy<T> table;
std::size_t size;
ipcdetail::placement_destroy<T> table;
size_type size;
void *ret;
if(name == reinterpret_cast<const CharType*>(-1)){
@@ -722,30 +726,30 @@ class segment_manager
else{
ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, size, is_intrusive_t(), lock);
}
return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
return std::pair<T*, size_type>(static_cast<T*>(ret), size);
}
//!Tries to find a previous unique allocation. Returns the address
//!and the object count. On failure the first member of the
//!returned pair is 0.
template <class T>
std::pair<T*, std::size_t> priv_find__impl (const detail::unique_instance_t* name, bool lock)
std::pair<T*, size_type> priv_find__impl (const ipcdetail::unique_instance_t* name, bool lock)
{
detail::placement_destroy<T> table;
std::size_t size;
ipcdetail::placement_destroy<T> table;
size_type size;
void *ret = priv_generic_find<char>(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock);
return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
return std::pair<T*, size_type>(static_cast<T*>(ret), size);
}
void *priv_generic_construct(const CharType *name,
std::size_t num,
size_type num,
bool try2find,
bool dothrow,
detail::in_place_interface &table)
ipcdetail::in_place_interface &table)
{
void *ret;
//Security overflow check
if(num > ((std::size_t)-1)/table.size){
if(num > ((std::size_t)-1)/table.size){
if(dothrow)
throw bad_alloc();
else
@@ -765,7 +769,7 @@ class segment_manager
return ret;
}
void priv_destroy_ptr(const void *ptr, detail::in_place_interface &dtor)
void priv_destroy_ptr(const void *ptr, ipcdetail::in_place_interface &dtor)
{
block_header_t *ctrl_data = block_header_t::block_header_from_value(ptr, dtor.size, dtor.alignment);
switch(ctrl_data->alloc_type()){
@@ -808,7 +812,7 @@ class segment_manager
return name;
}
static std::size_t priv_get_instance_length(block_header_t *ctrl_data, std::size_t sizeofvalue)
static size_type priv_get_instance_length(block_header_t *ctrl_data, size_type sizeofvalue)
{
//Get header
BOOST_ASSERT((ctrl_data->value_bytes() %sizeofvalue) == 0);
@@ -824,7 +828,7 @@ class segment_manager
return (instance_type)ctrl_data->alloc_type();
}
static std::size_t priv_get_reserved_bytes()
static size_type priv_get_reserved_bytes()
{
//Get the number of bytes until the end of (*this)
//beginning in the end of the Base base.
@@ -834,22 +838,22 @@ class segment_manager
template <class CharT>
void *priv_generic_find
(const CharT* name,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
std::size_t &length,
detail::true_ is_intrusive,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
size_type &length,
ipcdetail::true_ is_intrusive,
bool use_lock)
{
(void)is_intrusive;
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef detail::index_key<CharT, void_pointer> index_key_t;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef ipcdetail::index_key<CharT, void_pointer> index_key_t;
typedef typename index_type::iterator index_it;
//-------------------------------
scoped_lock<rmutex> guard(priv_get_lock(use_lock));
//-------------------------------
//Find name in index
detail::intrusive_compare_key<CharT> key
ipcdetail::intrusive_compare_key<CharT> key
(name, std::char_traits<CharT>::length(name));
index_it it = index.find(key);
@@ -874,14 +878,14 @@ class segment_manager
template <class CharT>
void *priv_generic_find
(const CharT* name,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
std::size_t &length,
detail::false_ is_intrusive,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
size_type &length,
ipcdetail::false_ is_intrusive,
bool use_lock)
{
(void)is_intrusive;
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef typename index_type::key_type key_type;
typedef typename index_type::iterator index_it;
@@ -899,7 +903,7 @@ class segment_manager
if(it != index.end()){
//Get header
block_header_t *ctrl_data = reinterpret_cast<block_header_t*>
(detail::get_pointer(it->second.m_ptr));
(ipcdetail::to_raw_pointer(it->second.m_ptr));
//Sanity check
BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
@@ -913,23 +917,23 @@ class segment_manager
template <class CharT>
bool priv_generic_named_destroy
(block_header_t *block_header,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
detail::true_ is_node_index)
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
ipcdetail::true_ is_node_index)
{
(void)is_node_index;
typedef typename IndexType<detail::index_config<CharT, MemoryAlgorithm> >::iterator index_it;
typedef typename IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> >::iterator index_it;
index_it *ihdr = block_header_t::to_first_header<index_it>(block_header);
index_it *ihdr = block_header_t::template to_first_header<index_it>(block_header);
return this->priv_generic_named_destroy_impl<CharT>(*ihdr, index, table);
}
template <class CharT>
bool priv_generic_named_destroy
(block_header_t *block_header,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
detail::false_ is_node_index)
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
ipcdetail::false_ is_node_index)
{
(void)is_node_index;
CharT *name = static_cast<CharT*>(block_header->template name<CharT>());
@@ -938,13 +942,13 @@ class segment_manager
template <class CharT>
bool priv_generic_named_destroy(const CharT *name,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
detail::true_ is_intrusive_index)
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
ipcdetail::true_ is_intrusive_index)
{
(void)is_intrusive_index;
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef detail::index_key<CharT, void_pointer> index_key_t;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef ipcdetail::index_key<CharT, void_pointer> index_key_t;
typedef typename index_type::iterator index_it;
typedef typename index_type::value_type intrusive_value_type;
@@ -952,7 +956,7 @@ class segment_manager
scoped_lock<rmutex> guard(m_header);
//-------------------------------
//Find name in index
detail::intrusive_compare_key<CharT> key
ipcdetail::intrusive_compare_key<CharT> key
(name, std::char_traits<CharT>::length(name));
index_it it = index.find(key);
@@ -989,12 +993,12 @@ class segment_manager
template <class CharT>
bool priv_generic_named_destroy(const CharT *name,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
detail::false_ is_intrusive_index)
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
ipcdetail::false_ is_intrusive_index)
{
(void)is_intrusive_index;
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef typename index_type::iterator index_it;
typedef typename index_type::key_type key_type;
@@ -1016,22 +1020,22 @@ class segment_manager
template <class CharT>
bool priv_generic_named_destroy_impl
(const typename IndexType<detail::index_config<CharT, MemoryAlgorithm> >::iterator &it,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table)
(const typename IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> >::iterator &it,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table)
{
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef typename index_type::iterator index_it;
//Get allocation parameters
block_header_t *ctrl_data = reinterpret_cast<block_header_t*>
(detail::get_pointer(it->second.m_ptr));
(ipcdetail::to_raw_pointer(it->second.m_ptr));
char *stored_name = static_cast<char*>(static_cast<void*>(const_cast<CharT*>(it->first.name())));
(void)stored_name;
//Check if the distance between the name pointer and the memory pointer
//is correct (this can detect incorrect type in destruction)
std::size_t num = ctrl_data->m_value_bytes/table.size;
std::size_t num = ctrl_data->m_value_bytes/table.size;
void *values = ctrl_data->value();
//Sanity check
@@ -1047,7 +1051,7 @@ class segment_manager
void *memory;
if(is_node_index_t::value){
index_it *ihdr = block_header_t::
index_it *ihdr = block_header_t::template
to_first_header<index_it>(ctrl_data);
ihdr->~index_it();
memory = ihdr;
@@ -1057,32 +1061,32 @@ class segment_manager
}
//Call destructors and free memory
std::size_t destroyed;
std::size_t destroyed;
table.destroy_n(values, num, destroyed);
this->deallocate(memory);
return true;
}
template<class CharT>
void * priv_generic_named_construct(std::size_t type,
void * priv_generic_named_construct(unsigned char type,
const CharT *name,
std::size_t num,
size_type num,
bool try2find,
bool dothrow,
detail::in_place_interface &table,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::true_ is_intrusive)
ipcdetail::in_place_interface &table,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::true_ is_intrusive)
{
(void)is_intrusive;
std::size_t namelen = std::char_traits<CharT>::length(name);
std::size_t namelen = std::char_traits<CharT>::length(name);
block_header_t block_info ( table.size*num
, table.alignment
block_header_t block_info ( size_type(table.size*num)
, size_type(table.alignment)
, type
, sizeof(CharT)
, namelen);
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef typename index_type::iterator index_it;
typedef std::pair<index_it, bool> index_ib;
@@ -1106,7 +1110,7 @@ class segment_manager
typedef typename index_type::value_type intrusive_value_type;
BOOST_TRY{
detail::intrusive_compare_key<CharT> key(name, namelen);
ipcdetail::intrusive_compare_key<CharT> key(name, namelen);
insert_ret = index.insert_check(key, commit_data);
}
//Ignore exceptions
@@ -1139,11 +1143,11 @@ class segment_manager
//Check if there is enough memory
if(dothrow){
buffer_ptr = this->allocate
(block_info.total_size_with_header<intrusive_value_type>());
(block_info.template total_size_with_header<intrusive_value_type>());
}
else{
buffer_ptr = this->allocate
(block_info.total_size_with_header<intrusive_value_type>(), std::nothrow_t());
(block_info.template total_size_with_header<intrusive_value_type>(), std::nothrow_t());
if(!buffer_ptr)
return 0;
}
@@ -1172,7 +1176,7 @@ class segment_manager
//Avoid constructions if constructor is trivial
//Build scoped ptr to avoid leaks with constructor exception
detail::mem_algo_deallocator<segment_manager_base_type> mem
ipcdetail::mem_algo_deallocator<segment_manager_base_type> mem
(buffer_ptr, *static_cast<segment_manager_base_type*>(this));
//Initialize the node value_eraser to erase inserted node
@@ -1182,7 +1186,7 @@ class segment_manager
value_eraser<index_type> v_eraser(index, it);
//Construct array, this can throw
detail::array_construct(ptr, num, table);
ipcdetail::array_construct(ptr, num, table);
//Release rollbacks since construction was successful
v_eraser.release();
@@ -1193,25 +1197,25 @@ class segment_manager
//!Generic named new function for
//!named functions
template<class CharT>
void * priv_generic_named_construct(std::size_t type,
void * priv_generic_named_construct(unsigned char type,
const CharT *name,
std::size_t num,
size_type num,
bool try2find,
bool dothrow,
detail::in_place_interface &table,
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::false_ is_intrusive)
ipcdetail::in_place_interface &table,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::false_ is_intrusive)
{
(void)is_intrusive;
std::size_t namelen = std::char_traits<CharT>::length(name);
block_header_t block_info ( table.size*num
, table.alignment
block_header_t block_info ( size_type(table.size*num)
, size_type(table.alignment)
, type
, sizeof(CharT)
, namelen);
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
typedef typename index_type::key_type key_type;
typedef typename index_type::mapped_type mapped_type;
typedef typename index_type::value_type value_type;
@@ -1251,7 +1255,7 @@ class segment_manager
if(!insert_ret.second){
if(try2find){
block_header_t *hdr = static_cast<block_header_t*>
(detail::get_pointer(it->second.m_ptr));
(ipcdetail::to_raw_pointer(it->second.m_ptr));
return hdr->value();
}
return 0;
@@ -1266,7 +1270,7 @@ class segment_manager
//Allocate and construct the headers
if(is_node_index_t::value){
std::size_t total_size = block_info.total_size_with_header<index_it>();
size_type total_size = block_info.template total_size_with_header<index_it>();
if(dothrow){
buffer_ptr = this->allocate(total_size);
}
@@ -1276,7 +1280,7 @@ class segment_manager
return 0;
}
index_it *idr = new(buffer_ptr) index_it(it);
hdr = block_header_t::from_first_header<index_it>(idr);
hdr = block_header_t::template from_first_header<index_it>(idr);
}
else{
if(dothrow){
@@ -1305,11 +1309,11 @@ class segment_manager
it->second.m_ptr = hdr;
//Build scoped ptr to avoid leaks with constructor exception
detail::mem_algo_deallocator<segment_manager_base_type> mem
ipcdetail::mem_algo_deallocator<segment_manager_base_type> mem
(buffer_ptr, *static_cast<segment_manager_base_type*>(this));
//Construct array, this can throw
detail::array_construct(ptr, num, table);
ipcdetail::array_construct(ptr, num, table);
//All constructors successful, we don't want to release memory
mem.release();
@@ -1332,7 +1336,7 @@ class segment_manager
if(use_lock){
local.lock();
}
return scoped_lock<rmutex>(boost::interprocess::move(local));
return scoped_lock<rmutex>(boost::move(local));
}
//!This struct includes needed data and derives from