|
Boost-Commit : |
From: igaztanaga_at_[hidden]
Date: 2007-09-26 11:07:33
Author: igaztanaga
Date: 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
New Revision: 39545
URL: http://svn.boost.org/trac/boost/changeset/39545
Log:
Changes introduced by the new intrusive version.
Text files modified:
trunk/boost/interprocess/detail/algorithms.hpp | 166 +++------------------------------------
trunk/boost/interprocess/detail/config_begin.hpp | 39 +++-----
trunk/boost/interprocess/detail/file_wrapper.hpp | 60 +++++++------
trunk/boost/interprocess/detail/in_place_interface.hpp | 5
trunk/boost/interprocess/detail/managed_memory_impl.hpp | 45 +++++++++-
trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp | 6
trunk/boost/interprocess/detail/move.hpp | 24 +++--
trunk/boost/interprocess/detail/named_proxy.hpp | 30 +++---
trunk/boost/interprocess/detail/os_file_functions.hpp | 2
trunk/boost/interprocess/detail/segment_manager_helper.hpp | 26 ++---
trunk/boost/interprocess/detail/type_traits.hpp | 25 +++++
trunk/boost/interprocess/detail/utilities.hpp | 85 +++++++++++++------
trunk/boost/interprocess/detail/win32_api.hpp | 24 ++---
trunk/boost/interprocess/detail/workaround.hpp | 4
14 files changed, 241 insertions(+), 300 deletions(-)
Modified: trunk/boost/interprocess/detail/algorithms.hpp
==============================================================================
--- trunk/boost/interprocess/detail/algorithms.hpp (original)
+++ trunk/boost/interprocess/detail/algorithms.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -20,13 +20,11 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/iterators.hpp>
-#include <boost/interprocess/detail/mpl.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
#include <boost/get_pointer.hpp>
#include <boost/detail/no_exceptions_support.hpp>
namespace boost {
-namespace interprocess {
+namespace interprocess {
template<class T>
struct has_own_construct_from_it
@@ -34,96 +32,16 @@
static const bool value = false;
};
-template<class FwdIt, class T>
-void uninitialized_fill(FwdIt first, FwdIt last, const T& val)
-{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- //Save initial position
- FwdIt init = first;
-
- BOOST_TRY{
- //Construct objects
- for (; first != last; ++first){
- new(detail::get_pointer(&*first))value_type(val);
- }
- }
- BOOST_CATCH(...){
- //Call destructors
- for (; init != first; ++init){
- detail::get_pointer(&*init)->~value_type();
- }
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-}
-
-template<class FwdIt, class Count, class T>
-void uninitialized_fill_n(FwdIt first, Count count,
- const T& val)
-{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- //Save initial position
- FwdIt init = first;
-
- BOOST_TRY{
- //Construct objects
- for (; count--; ++first){
- new(detail::get_pointer(&*first))value_type(val);
- }
- }
- BOOST_CATCH(...){
- //Call destructors
- for (; init != first; ++init){
- detail::get_pointer(&*init)->~value_type();
- }
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-}
-
-template<class InIt, class OutIt>
-InIt copy_n(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest)
-{
- for (; length--; ++dest, ++first)
- *dest = *first;
- return first;
-}
-
-template<class InIt, class FwdIt>
-typename std::iterator_traits<InIt>::difference_type
- n_uninitialized_copy(InIt first, InIt last, FwdIt dest)
-{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- //Save initial destination position
- FwdIt dest_init = dest;
- typename std::iterator_traits<InIt>::difference_type constructed = 0;
- BOOST_TRY{
- //Try to build objects
- for (; first != last; ++dest, ++first, ++constructed){
- new(detail::get_pointer(&*dest))value_type(*first);
- }
- }
- BOOST_CATCH(...){
- //Call destructors
- for (; dest_init != dest; ++dest_init){
- detail::get_pointer(&*dest_init)->~value_type();
- }
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
- return (constructed);
-}
-
namespace detail {
template<class T, class InpIt>
-inline void construct_in_place(T* dest, const InpIt &source, detail::true_)
+inline void construct_in_place_impl(T* dest, const InpIt &source, detail::true_)
{
T::construct(dest, *source);
}
template<class T, class InpIt>
-inline void construct_in_place(T* dest, const InpIt &source, detail::false_)
+inline void construct_in_place_impl(T* dest, const InpIt &source, detail::false_)
{
new(dest)T(*source);
}
@@ -134,7 +52,7 @@
inline void construct_in_place(T* dest, InpIt source)
{
typedef detail::bool_<has_own_construct_from_it<T>::value> boolean_t;
- detail::construct_in_place(dest, source, boolean_t());
+ detail::construct_in_place_impl(dest, source, boolean_t());
}
template<class T, class U, class D>
@@ -143,28 +61,12 @@
new(dest)T();
}
-template<class InIt, class FwdIt> inline
-FwdIt uninitialized_copy(InIt first, InIt last, FwdIt dest)
+template<class InIt, class OutIt>
+InIt copy_n(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest)
{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- //Save initial destination position
- FwdIt dest_init = dest;
- typename std::iterator_traits<InIt>::difference_type constructed = 0;
- BOOST_TRY{
- //Try to build objects
- for (; first != last; ++dest, ++first, ++constructed){
- new(detail::get_pointer(&*dest))value_type(*first);
- }
- }
- BOOST_CATCH(...){
- //Call destructors
- for (; dest_init != dest; ++dest_init){
- detail::get_pointer(&*dest_init)->~value_type();
- }
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
- return (dest);
+ for (; length--; ++dest, ++first)
+ *dest = *first;
+ return first;
}
template<class InIt, class FwdIt> inline
@@ -201,63 +103,23 @@
// copies [first2, last2) into
// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)).
template <class InpIt1, class InpIt2, class FwdIt>
-FwdIt uninitialized_copy_copy(InpIt1 first1, InpIt1 last1,
- InpIt2 first2, InpIt2 last2,
- FwdIt result)
+FwdIt uninitialized_copy_copy
+ (InpIt1 first1, InpIt1 last1, InpIt2 first2, InpIt2 last2, FwdIt result)
{
typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- FwdIt mid = boost::interprocess::uninitialized_copy(first1, last1, result);
+ FwdIt mid = std::uninitialized_copy(first1, last1, result);
BOOST_TRY {
- return boost::interprocess::uninitialized_copy(first2, last2, mid);
+ return std::uninitialized_copy(first2, last2, mid);
}
BOOST_CATCH(...){
for(;result != mid; ++result){
- detail::get_pointer(&*result)->~value_type();
+ result->~value_type();
}
BOOST_RETHROW
}
BOOST_CATCH_END
}
-// uninitialized_copy_n_copy_n
-// Copies [first1, first1 + n1) into [result, result + n1), and
-// copies [first2, first2 + n2) into
-// [result + n1, result + n1 + n2).
-template <class InpIt1, class InpIt2, class FwdIt>
-InpIt2 uninitialized_copy_n_copy_n
- (InpIt1 first1,
- typename std::iterator_traits<InpIt1>::difference_type n1,
- InpIt2 first2,
- typename std::iterator_traits<InpIt2>::difference_type n2,
- FwdIt result)
-{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- typename std::iterator_traits<InpIt1>::difference_type c1 = n1+1;
- typename std::iterator_traits<InpIt2>::difference_type c2 = n2+1;
- FwdIt dest_init = result;
-
- BOOST_TRY{
- //Try to build objects
- for (; --c1; ++result, ++first1){
- new(detail::get_pointer(&*result))value_type(*first1);
- }
- for (; --c2; ++result, ++first2){
- new(detail::get_pointer(&*result))value_type(*first2);
- }
- }
- BOOST_CATCH(...){
- //Call destructors
- typename std::iterator_traits<FwdIt>::
- difference_type c = (n1 - c1) + (n2 - c2);
- for (; c--; ++dest_init){
- detail::get_pointer(&*dest_init)->~value_type();
- }
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
- return first2;
-}
-
} //namespace interprocess {
} //namespace boost {
Modified: trunk/boost/interprocess/detail/config_begin.hpp
==============================================================================
--- trunk/boost/interprocess/detail/config_begin.hpp (original)
+++ trunk/boost/interprocess/detail/config_begin.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -9,29 +9,22 @@
#define _CRT_SECURE_NO_DEPRECATE
#endif
#pragma warning (push)
- //
- //'function' : resolved overload was found by argument-dependent lookup
- //A function found by argument-dependent lookup (Koenig lookup) was eventually
- //chosen by overload resolution.
- //
- //In Visual C++ .NET and earlier compilers, a different function would have
- //been called. To pick the original function, use an explicitly qualified name.
- //
-
- //warning C4275: non dll-interface class 'x' used as base for
- //dll-interface class 'Y'
- #pragma warning (disable : 4275)
- //warning C4251: 'x' : class 'y' needs to have dll-interface to
- //be used by clients of class 'z'
- #pragma warning (disable : 4251)
- #pragma warning (disable : 4675)
- #pragma warning (disable : 4996)
- #pragma warning (disable : 4503)
+ #pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned
#pragma warning (disable : 4284) // odd return type for operator->
#pragma warning (disable : 4244) // possible loss of data
- #pragma warning (disable : 4521) ////Disable "multiple copy constructors specified"
- #pragma warning (disable : 4522)
- #pragma warning (disable : 4146)
- #pragma warning (disable : 4503) //Decorated name length exceeded
- #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data
+ #pragma warning (disable : 4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
+ #pragma warning (disable : 4267) // conversion from 'X' to 'Y', possible loss of data
+ #pragma warning (disable : 4275) // non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
+ #pragma warning (disable : 4355) // 'this' : used in base member initializer list
+ #pragma warning (disable : 4503) // 'identifier' : decorated name length exceeded, name was truncated
+ #pragma warning (disable : 4511) // copy constructor could not be generated
+ #pragma warning (disable : 4512) // assignment operator could not be generated
+ #pragma warning (disable : 4514) // unreferenced inline removed
+ #pragma warning (disable : 4521) // Disable "multiple copy constructors specified"
+ #pragma warning (disable : 4522) // 'class' : multiple assignment operators specified
+ #pragma warning (disable : 4675) // 'method' should be declared 'static' and have exactly one parameter
+ #pragma warning (disable : 4710) // function not inlined
+ #pragma warning (disable : 4711) // function selected for automatic inline expansion
+ #pragma warning (disable : 4786) // identifier truncated in debug info
+ #pragma warning (disable : 4996) // 'function': was declared deprecated
#endif
Modified: trunk/boost/interprocess/detail/file_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/file_wrapper.hpp (original)
+++ trunk/boost/interprocess/detail/file_wrapper.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -26,28 +26,29 @@
{
public:
- /*!Default constructor. Represents an empty file_wrapper.*/
+ //!Default constructor.
+ //!Represents an empty file_wrapper.
file_wrapper();
- /*!Creates a shared memory object with name "name" and mode "mode", with the access mode "mode"
- If the file previously exists, throws an error.*/
+ //!Creates a file object with name "name" and mode "mode", with the access mode "mode"
+ //!If the file previously exists, throws an error.
file_wrapper(create_only_t, const char *name, mode_t mode)
{ this->priv_open_or_create(detail::DoCreate, name, mode); }
- /*!Tries to create a file with name "name" and mode "mode", with the
- access mode "mode". If the file previously exists, it tries to open it with mode "mode".
- Otherwise throws an error.*/
+ //!Tries to create a file with name "name" and mode "mode", with the
+ //!access mode "mode". If the file previously exists, it tries to open it with mode "mode".
+ //!Otherwise throws an error.
file_wrapper(open_or_create_t, const char *name, mode_t mode)
- { this->priv_open_or_create(detail::DoCreateOrOpen, name, mode); }
+ { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode); }
- /*!Tries to open a shared memory object with name "name", with the access mode "mode".
- If the file does not previously exist, it throws an error.*/
+ //!Tries to open a file with name "name", with the access mode "mode".
+ //!If the file does not previously exist, it throws an error.
file_wrapper(open_only_t, const char *name, mode_t mode)
{ this->priv_open_or_create(detail::DoOpen, name, mode); }
- /*!Moves the ownership of "moved"'s shared memory object to *this.
- After the call, "moved" does not represent any shared memory object.
- Does not throw*/
+ //!Moves the ownership of "moved"'s file to *this.
+ //!After the call, "moved" does not represent any file.
+ //!Does not throw
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
file_wrapper
(detail::moved_object<file_wrapper> &moved)
@@ -57,9 +58,9 @@
{ this->swap(moved); }
#endif
- /*!Moves the ownership of "moved"'s shared memory to *this.
- After the call, "moved" does not represent any shared memory.
- Does not throw*/
+ //!Moves the ownership of "moved"'s file to *this.
+ //!After the call, "moved" does not represent any file.
+ //!Does not throw
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
file_wrapper &operator=
(detail::moved_object<file_wrapper> &moved)
@@ -77,33 +78,37 @@
}
#endif
- /*!Swaps to shared_memory_objects. Does not throw*/
+ //!Swaps to file_wrappers.
+ //!Does not throw
void swap(file_wrapper &other);
- /*!Erases a shared memory object from the system.*/
+ //!Erases a file from the system.
+ //!Returns false on error. Never throws
static bool remove(const char *name);
- /*!Sets the size of the shared memory mapping*/
+ //!Sets the size of the fil
void truncate(offset_t length);
- /*!Closes the shared memory mapping. All mapped regions are still
- valid after destruction. The shared memory object still exists and
- can be newly opened.*/
+ //!Closes the
+ //!file
~file_wrapper();
- /*!Returns the name of the file.*/
+ //!Returns the name of the file
+ //!used in the constructor
const char *get_name() const;
- /*!Returns access mode*/
+ //!Returns access mode
+ //!used in the constructor
mode_t get_mode() const;
- /*!Get mapping handle*/
+ //!Get mapping handle
+ //!to use with mapped_region
mapping_handle_t get_mapping_handle() const;
private:
- /*!Closes a previously opened file mapping. Never throws.*/
+ //!Closes a previously opened file mapping. Never throws.
void priv_close();
- /*!Closes a previously opened file mapping. Never throws.*/
+ //!Closes a previously opened file mapping. Never throws.
bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode);
file_handle_t m_handle;
@@ -118,7 +123,6 @@
inline file_wrapper::~file_wrapper()
{ this->priv_close(); }
-/*!Returns the name of the file.*/
inline const char *file_wrapper::get_name() const
{ return m_filename.c_str(); }
@@ -155,7 +159,7 @@
case detail::DoCreate:
m_handle = create_new_file(filename, mode);
break;
- case detail::DoCreateOrOpen:
+ case detail::DoOpenOrCreate:
m_handle = create_or_open_file(filename, mode);
break;
default:
Modified: trunk/boost/interprocess/detail/in_place_interface.hpp
==============================================================================
--- trunk/boost/interprocess/detail/in_place_interface.hpp (original)
+++ trunk/boost/interprocess/detail/in_place_interface.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -20,9 +20,8 @@
#include <boost/interprocess/detail/type_traits.hpp>
#include <typeinfo> //typeid
-/*!\file
- Describes an abstract interface for placement construction and destruction.
-*/
+//!\file
+//!Describes an abstract interface for placement construction and destruction.
namespace boost {
namespace interprocess {
Modified: trunk/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_memory_impl.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -86,8 +86,11 @@
typedef typename MemoryAlgorithm::mutex_family mutex_family;
typedef CharType char_t;
typedef std::ptrdiff_t handle_t;
- typedef typename segment_manager::const_named_iterator const_named_iterator;
- typedef typename segment_manager::const_unique_iterator const_unique_iterator;
+ typedef typename segment_manager::
+ const_named_iterator const_named_iterator;
+ typedef typename segment_manager::
+ const_unique_iterator const_unique_iterator;
+
/// @cond
//Experimental. Don't use.
@@ -294,16 +297,16 @@
//Experimental. Don't use.
//!Allocates n_elements of elem_size bytes.
- multiallocation_iterator allocate_many(std::size_t elem_size, std::size_t min_elements, std::size_t preferred_elements, std::size_t &received_elements)
- { return mp_header->allocate_many(elem_size, min_elements, preferred_elements, received_elements); }
+ multiallocation_iterator allocate_many(std::size_t elem_bytes, std::size_t num_elements)
+ { return mp_header->allocate_many(elem_bytes, num_elements); }
//!Allocates n_elements, each one of elem_sizes[i] bytes.
multiallocation_iterator allocate_many(const std::size_t *elem_sizes, std::size_t n_elements)
{ return mp_header->allocate_many(elem_sizes, n_elements); }
//!Allocates n_elements of elem_size bytes.
- multiallocation_iterator allocate_many(std::size_t elem_size, std::size_t min_elements, std::size_t preferred_elements, std::size_t &received_elements, std::nothrow_t nothrow)
- { return mp_header->allocate_many(elem_size, min_elements, preferred_elements, received_elements, nothrow); }
+ multiallocation_iterator allocate_many(std::size_t elem_bytes, std::size_t num_elements, std::nothrow_t nothrow)
+ { return mp_header->allocate_many(elem_bytes, num_elements, nothrow); }
//!Allocates n_elements, each one of elem_sizes[i] bytes.
multiallocation_iterator allocate_many(const std::size_t *elem_sizes, std::size_t n_elements, std::nothrow_t nothrow)
@@ -662,6 +665,36 @@
const_unique_iterator unique_end() const
{ return mp_header->unique_end(); }
+ //!This is the default allocator to allocate types T
+ //!from this managed segment
+ template<class T>
+ struct allocator
+ {
+ typedef typename segment_manager::template allocator<T>::type type;
+ };
+
+ //!Returns an instance of the default allocator for type T
+ //!initialized that allocates memory from this segment manager.
+ template<class T>
+ typename allocator<T>::type
+ get_allocator()
+ { return mp_header->get_allocator<T>(); }
+
+ //!This is the default deleter to delete types T
+ //!from this managed segment.
+ template<class T>
+ struct deleter
+ {
+ typedef typename segment_manager::template deleter<T>::type type;
+ };
+
+ //!Returns an instance of the default allocator for type T
+ //!initialized that allocates memory from this segment manager.
+ template<class T>
+ typename deleter<T>::type
+ get_deleter()
+ { return mp_header->get_deleter<T>(); }
+
protected:
//!Sets the base address of the memory in this process.
//!This is very low level, so use it only if you know what are
Modified: trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -90,7 +90,7 @@
{
m_name = name;
priv_open_or_create
- ( detail::DoCreateOrOpen
+ ( detail::DoOpenOrCreate
, size
, mode
, addr
@@ -140,7 +140,7 @@
{
m_name = name;
priv_open_or_create
- ( detail::DoCreateOrOpen
+ ( detail::DoOpenOrCreate
, size
, mode
, addr
@@ -281,7 +281,7 @@
create_device<FileBased>(dev, m_name.c_str(), size, file_like_t());
created = true;
}
- else if(type == detail::DoCreateOrOpen){
+ else if(type == detail::DoOpenOrCreate){
//This loop is very ugly, but brute force is sometimes better
//than diplomacy. If someone knows how to open or create a
//file and know if we have really created it or just open it
Modified: trunk/boost/interprocess/detail/move.hpp
==============================================================================
--- trunk/boost/interprocess/detail/move.hpp (original)
+++ trunk/boost/interprocess/detail/move.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -18,13 +18,14 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-/*!\file
- Describes a function and a type to emulate move semantics.
-*/
+//!\file
+//!Describes a function and a type to emulate move semantics.
+
namespace boost {
namespace interprocess {
-/*!Trait class to detect if a type is movable*/
+//!Trait class to detect if a type is
+//!movable
template <class T>
struct is_movable
{
@@ -43,7 +44,8 @@
namespace interprocess {
namespace detail {
-/*!An object that represents a moved object.*/
+//!An object that represents a
+//!moved object.
template<class T>
struct moved_object
{
@@ -69,8 +71,10 @@
template <typename T>
class move_return
{
+ typedef moved_object<T> moved_type;
private:
- T m_moved;
+ mutable T m_moved;
+
public:
typedef T type;
@@ -83,8 +87,8 @@
: m_moved(const_cast<move_return&>(operand))
{}
- operator moved_object<T>()
- { return moved_object<T>(m_moved); }
+ operator moved_type() const
+ { return moved_type(m_moved); }
};
template <typename T>
@@ -102,8 +106,8 @@
namespace boost {
namespace interprocess {
-/*!A function that converts an object to a moved object so that
- it can match a function taking a detail::moved_object object.*/
+//!A function that converts an object to a moved object so that
+//!it can match a function taking a detail::moved_object object.
template<class Object>
typename detail::move_type<Object>::type move
(const Object &object)
Modified: trunk/boost/interprocess/detail/named_proxy.hpp
==============================================================================
--- trunk/boost/interprocess/detail/named_proxy.hpp (original)
+++ trunk/boost/interprocess/detail/named_proxy.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -28,15 +28,15 @@
#include <boost/interprocess/detail/mpl.hpp>
#include <iterator>
-/*!\file
- Describes a proxy class that implements named allocation syntax.
-*/
+//!\file
+//!Describes a proxy class that implements named allocation syntax.
namespace boost {
namespace interprocess {
namespace detail {
-/*!Function object that makes placement new without arguments*/
+//!Function object that makes placement new
+//!without arguments
template<class T>
struct Ctor0Arg : public placement_destroy<T>
{
@@ -120,20 +120,19 @@
//bind rvalues with non-const references, we have to be ugly
#define BOOST_INTERPROCESS_AUX_PARAM_LIST(z, n, data) \
const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
-/**/
+//!
#define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
-/**/
+//!
#define BOOST_INTERPROCESS_AUX_PARAM_INC(z, n, data) \
BOOST_PP_CAT(++m_p, n) \
-/**/
+//!
#define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
-
-/**/
+//!
#define BOOST_PP_LOCAL_MACRO(n) \
template<class T, bool is_iterator, BOOST_PP_ENUM_PARAMS(n, class P) > \
@@ -180,7 +179,7 @@
\
BOOST_PP_REPEAT(n, BOOST_INTERPROCESS_AUX_PARAM_DEFINE, _) \
}; \
-/**/
+//!
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS)
@@ -213,23 +212,24 @@
, m_find(find), m_dothrow(dothrow)
{}
- /*!makes a named allocation and calls the default constructor*/
+ //!makes a named allocation and calls the
+ //!default constructor
T *operator()() const
{
Ctor0Arg<T> ctor_obj;
return mp_mngr->template
generic_construct<T>(mp_name, m_num, m_find, m_dothrow, ctor_obj);
}
- /**/
+ //!
// Boost preprocessor used to create operator() overloads
#define BOOST_INTERPROCESS_AUX_TYPE_LIST(z, n, data) \
BOOST_PP_CAT(P, n) \
- /**/
+ //!
#define BOOST_INTERPROCESS_AUX_PARAM_LIST(z, n, data) \
const BOOST_PP_CAT(P, n) BOOST_PP_CAT(&p, n) \
- /**/
+ //!
#define BOOST_PP_LOCAL_MACRO(n) \
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
@@ -242,7 +242,7 @@
return mp_mngr->template generic_construct<T> \
(mp_name, m_num, m_find, m_dothrow, ctor_obj); \
} \
- /**/
+ //!
#define BOOST_PP_LOCAL_LIMITS ( 1, BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS )
#include BOOST_PP_LOCAL_ITERATE()
Modified: trunk/boost/interprocess/detail/os_file_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_file_functions.hpp (original)
+++ trunk/boost/interprocess/detail/os_file_functions.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -159,8 +159,6 @@
return (acquired = true);
}
-
-
inline bool release_file_lock(file_handle_t hnd)
{
const unsigned long len = 0xffffffff;
Modified: trunk/boost/interprocess/detail/segment_manager_helper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/segment_manager_helper.hpp (original)
+++ trunk/boost/interprocess/detail/segment_manager_helper.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -31,11 +31,9 @@
#include <exception>
#endif
-/*!\file
- Describes the object placed in a memory segment that provides
- named object allocation capabilities for single-segment and
- multi-segment allocations.
-*/
+//!\file
+//!Describes the object placed in a memory segment that provides
+//!named object allocation capabilities.
namespace boost{
namespace interprocess{
@@ -133,22 +131,22 @@
{ return m_num_char; }
std::size_t name_offset() const
- {
+ {
return value_offset() + get_rounded_size(m_value_bytes, sizeof_char());
}
void *value() const
- {
+ {
return detail::char_ptr_cast(this) + value_offset();
}
std::size_t value_offset() const
- {
+ {
return get_rounded_size(sizeof(block_header), m_value_alignment);
}
template<class CharType>
- bool less(const block_header &b) const
+ bool less_comp(const block_header &b) const
{
return m_num_char < b.m_num_char ||
(m_num_char < b.m_num_char &&
@@ -157,7 +155,7 @@
}
template<class CharType>
- bool equal(const block_header &b) const
+ bool equal_comp(const block_header &b) const
{
return m_num_char == b.m_num_char &&
std::char_traits<CharType>::compare
@@ -294,10 +292,10 @@
}
bool operator <(const intrusive_value_type_impl<Hook, CharType> & other) const
- { return this->get_block_header()->template less<CharType>(*other.get_block_header()); }
+ { return (this->get_block_header())->template less_comp<CharType>(*other.get_block_header()); }
bool operator ==(const intrusive_value_type_impl<Hook, CharType> & other) const
- { return this->get_block_header()->template equal<CharType>(*other.get_block_header()); }
+ { return (this->get_block_header())->template equal_comp<CharType>(*other.get_block_header()); }
static intrusive_value_type_impl *get_intrusive_value_type(block_header *hdr)
{
@@ -395,8 +393,8 @@
template<class VoidPointer>
struct index_data
{
- typedef VoidPointer void_ptr;
- void_ptr m_ptr;
+ typedef VoidPointer void_pointer;
+ void_pointer m_ptr;
index_data(void *ptr) : m_ptr(ptr){}
void *value() const
Modified: trunk/boost/interprocess/detail/type_traits.hpp
==============================================================================
--- trunk/boost/interprocess/detail/type_traits.hpp (original)
+++ trunk/boost/interprocess/detail/type_traits.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -141,12 +141,31 @@
static yes_type is_same_tester(V*, V*);
static no_type is_same_tester(...);
- static T t;
- static U u;
+ static T *t;
+ static U *u;
- static const bool value = sizeof(yes_type) == sizeof(is_same_tester(&t,&u));
+ static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
};
/*
+template <template<class P> typename T, template<typename P2> typename U>
+struct is_same
+{
+ typedef char yes_type;
+ struct no_type
+ {
+ char padding[8];
+ };
+
+ template <template<class P3> typename V>
+ static yes_type is_same_tester(V<P3>*, V<P3>*);
+ static no_type is_same_tester(...);
+
+ static T<int> *t;
+ static U<int> *u;
+
+ static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
+};*/
+/*
template< typename T >
struct is_pointer_impl
{
Modified: trunk/boost/interprocess/detail/utilities.hpp
==============================================================================
--- trunk/boost/interprocess/detail/utilities.hpp (original)
+++ trunk/boost/interprocess/detail/utilities.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -105,9 +105,10 @@
template <class Allocator>
struct scoped_array_deallocator
{
- typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::size_type size_type;
- scoped_array_deallocator(pointer p, Allocator& a, std::size_t length)
+ scoped_array_deallocator(pointer p, Allocator& a, size_type length)
: m_ptr(p), m_alloc(a), m_length(length) {}
~scoped_array_deallocator()
@@ -119,7 +120,20 @@
private:
pointer m_ptr;
Allocator& m_alloc;
- std::size_t m_length;
+ size_type m_length;
+};
+
+template <class Allocator>
+struct null_scoped_array_deallocator
+{
+ typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::size_type size_type;
+
+ null_scoped_array_deallocator(pointer, Allocator&, size_type)
+ {}
+
+ void release()
+ {}
};
//!A deleter for scoped_ptr that destroys
@@ -127,17 +141,22 @@
template <class Allocator>
struct scoped_destructor_n
{
- typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::pointer pointer;
typedef typename Allocator::value_type value_type;
+ typedef typename Allocator::size_type size_type;
pointer m_p;
- std::size_t m_n;
+ size_type m_n;
- scoped_destructor_n(pointer p, std::size_t n)
- : m_p(p), m_n(n){}
+ scoped_destructor_n(pointer p, size_type n)
+ : m_p(p), m_n(n)
+ {}
void release()
{ m_p = 0; }
+
+ void increment_size(size_type inc)
+ { m_n += inc; }
~scoped_destructor_n()
{
@@ -148,6 +167,24 @@
}
};
+//!A deleter for scoped_ptr that destroys
+//!an object using a STL allocator.
+template <class Allocator>
+struct null_scoped_destructor_n
+{
+ typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::size_type size_type;
+
+ null_scoped_destructor_n(pointer, size_type)
+ {}
+
+ void increment_size(size_type)
+ {}
+
+ void release()
+ {}
+};
+
template <class A>
class allocator_destroyer
{
@@ -187,9 +224,9 @@
++m_itbeg;
}
}
-
- void release()
- { m_itbeg = multiallocation_iterator(); }
+
+ void increment()
+ { ++m_itbeg; }
};
@@ -223,7 +260,7 @@
{ m_itbeg = multiallocation_iterator(); }
};
-/*!Forces a cast from any pointer to char * pointer*/
+//!Forces a cast from any pointer to char *pointer
template<class T>
inline char* char_ptr_cast(T *ptr)
{
@@ -282,8 +319,8 @@
static const std::size_t value = 0;
};
-/*!Obtains a generic pointer of the same type that
- can point to other pointed type: Ptr<?> -> Ptr<NewValueType>*/
+//!Obtains a generic pointer of the same type that
+//!can point to other pointed type: Ptr<?> -> Ptr<NewValueType>
template<class T, class U>
struct pointer_to_other;
@@ -316,9 +353,9 @@
} //namespace detail {
-/*!Trait class to detect if an index is a node
- index. This allows more efficient operations
- when deallocating named objects.*/
+//!Trait class to detect if an index is a node
+//!index. This allows more efficient operations
+//!when deallocating named objects.
template <class Index>
struct is_node_index
{
@@ -326,24 +363,16 @@
};
-/*!Trait class to detect if an index is an intrusive
- index. This will embed the derivation hook in each
- allocation header, to provide memory for the intrusive
- container.*/
+//!Trait class to detect if an index is an intrusive
+//!index. This will embed the derivation hook in each
+//!allocation header, to provide memory for the intrusive
+//!container.
template <class Index>
struct is_intrusive_index
{
enum { value = false };
};
-/*!Trait class to detect if an smart pointer has
- multi-segment addressing capabilities.*/
-template <class Ptr>
-struct is_multisegment_ptr
-{
- enum { value = false };
-};
-
template <class SizeType>
SizeType
get_next_capacity(const SizeType max_size
Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp (original)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -11,22 +11,21 @@
#ifndef BOOST_INTERPROCESS_WIN32_SYNC_PRIMITIVES_HPP
#define BOOST_INTERPROCESS_WIN32_SYNC_PRIMITIVES_HPP
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <stddef.h>
+
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
# pragma once
+# pragma comment( lib, "advapi32.lib" )
#endif
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-
#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
# include <stddef.h>
# include <stdarg.h>
# include <boost/detail/interlocked.hpp>
-# if !defined(__MINGW32__)
-# pragma comment( lib, "advapi32.lib" )//auto-unlink security features
-# endif
#else
-# error "This file can only be included in Windows OS"
+# error "This file can only be included in Windows OS"
#endif
//The structures used in Interprocess with the
@@ -248,10 +247,9 @@
extern "C" __declspec(dllimport) int __stdcall LockFileEx(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped);
extern "C" __declspec(dllimport) int __stdcall UnlockFileEx(void *hnd, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped);
extern "C" __declspec(dllimport) int __stdcall WriteFile(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped);
-extern "C" __declspec(dllimport) int __stdcall InitializeSecurityDescriptor
- (void *pSecurityDescriptor, unsigned long dwRevision);
-extern "C" __declspec(dllimport) int __stdcall SetSecurityDescriptorDacl
- ( void *pSecurityDescriptor, int bDaclPresent, interprocess_acl *pDacl, int bDaclDefaulted);
+extern "C" __declspec(dllimport) int __stdcall InitializeSecurityDescriptor(interprocess_security_descriptor *pSecurityDescriptor, unsigned long dwRevision);
+extern "C" __declspec(dllimport) int __stdcall SetSecurityDescriptorDacl(interprocess_security_descriptor *pSecurityDescriptor, int bDaclPresent, interprocess_acl *pDacl, int bDaclDefaulted);
+
/*
extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
@@ -362,7 +360,7 @@
static inline void * open_file_mapping (unsigned long access, const char *name)
{ return OpenFileMappingA (access, 0, name); }
-static inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned long highoffset, unsigned long lowoffset, std::size_t numbytes, void *base_addr)
+static inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned long highoffset, unsigned long lowoffset, size_t numbytes, void *base_addr)
{ return MapViewOfFileEx(handle, file_access, highoffset, lowoffset, numbytes, base_addr); }
static inline void *create_file(const char *name, unsigned long access, unsigned long creation_flags, unsigned long attributes = 0)
@@ -374,7 +372,7 @@
static inline void get_system_info(system_info *info)
{ GetSystemInfo(info); }
-static inline int flush_view_of_file(void *base_addr, std::size_t numbytes)
+static inline int flush_view_of_file(void *base_addr, size_t numbytes)
{ return FlushViewOfFile(base_addr, numbytes); }
static inline bool get_file_size(void *handle, __int64 &size)
Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2007-09-26 11:07:29 EDT (Wed, 26 Sep 2007)
@@ -48,6 +48,10 @@
#define BOOST_INTERPROCESS_POSIX_TIMEOUTS
#endif
+ #if defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES - 0 > 0)
+ #define BOOST_INTERPROCESS_POSIX_SEMAPHORES
+ #endif
+
#endif
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk