diff options
Diffstat (limited to 'boost/interprocess/managed_xsi_shared_memory.hpp')
-rw-r--r-- | boost/interprocess/managed_xsi_shared_memory.hpp | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/boost/interprocess/managed_xsi_shared_memory.hpp b/boost/interprocess/managed_xsi_shared_memory.hpp index dc909f6824..f7a4b35c35 100644 --- a/boost/interprocess/managed_xsi_shared_memory.hpp +++ b/boost/interprocess/managed_xsi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. 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) // @@ -11,7 +11,7 @@ #ifndef BOOST_INTERPROCESS_MANAGED_XSI_SHARED_MEMORY_HPP #define BOOST_INTERPROCESS_MANAGED_XSI_SHARED_MEMORY_HPP -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#if defined(_MSC_VER) # pragma once #endif @@ -28,7 +28,7 @@ #include <boost/interprocess/creation_tags.hpp> //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp> +#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp> #include <boost/interprocess/sync/mutex_family.hpp> #include <boost/interprocess/indexes/iset_index.hpp> @@ -36,9 +36,20 @@ namespace boost { namespace interprocess { +namespace ipcdetail { + +template<class AllocationAlgorithm> +struct xsishmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl //!FileBased, StoreDevice + < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> type; +}; + +} //namespace ipcdetail { + //!A basic X/Open System Interface (XSI) shared memory named object creation class. Initializes the //!shared memory segment. Inherits all basic functionality from -//!basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>*/ +//!basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType> template < class CharType, @@ -48,19 +59,15 @@ template class basic_managed_xsi_shared_memory : public ipcdetail::basic_managed_memory_impl <CharType, AllocationAlgorithm, IndexType - ,ipcdetail::managed_open_or_create_impl - < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment - , false, true>::ManagedOpenOrCreateUserOffset> - , private ipcdetail::managed_open_or_create_impl - <xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> + ,ipcdetail::xsishmem_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset> + , private ipcdetail::xsishmem_open_or_create<AllocationAlgorithm>::type { - /// @cond + #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) public: typedef xsi_shared_memory_file_wrapper device_type; public: - typedef ipcdetail::managed_open_or_create_impl - <xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> base2_t; + typedef typename ipcdetail::xsishmem_open_or_create<AllocationAlgorithm>::type base2_t; typedef ipcdetail::basic_managed_memory_impl <CharType, AllocationAlgorithm, IndexType, base2_t::ManagedOpenOrCreateUserOffset> base_t; @@ -73,7 +80,7 @@ class basic_managed_xsi_shared_memory private: typedef typename base_t::char_ptr_holder_t char_ptr_holder_t; BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_xsi_shared_memory) - /// @endcond + #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED public: //functions typedef typename base_t::size_type size_type; @@ -94,7 +101,7 @@ class basic_managed_xsi_shared_memory //!Creates shared memory and creates and places the segment manager. //!This can throw. - basic_managed_xsi_shared_memory(create_only_t create_only, const xsi_key &key, + basic_managed_xsi_shared_memory(create_only_t, const xsi_key &key, std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() , base2_t(create_only, key, size, read_write, addr, @@ -105,7 +112,7 @@ class basic_managed_xsi_shared_memory //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_xsi_shared_memory (open_or_create_t open_or_create, + basic_managed_xsi_shared_memory (open_or_create_t, const xsi_key &key, std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() @@ -127,7 +134,7 @@ class basic_managed_xsi_shared_memory //!Connects to a created shared memory and its segment manager. //!This can throw. - basic_managed_xsi_shared_memory (open_only_t open_only, const xsi_key &key, + basic_managed_xsi_shared_memory (open_only_t, const xsi_key &key, const void *addr = 0) : base_t() , base2_t(open_only, key, read_write, addr, @@ -170,7 +177,7 @@ class basic_managed_xsi_shared_memory int get_shmid() const { return base2_t::get_device().get_shmid(); } - /// @cond + #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) //!Tries to find a previous named allocation address. Returns a memory //!buffer and the object count. If not found returned pointer is 0. @@ -186,9 +193,29 @@ class basic_managed_xsi_shared_memory } } - /// @endcond + #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED }; +#ifdef BOOST_INTERPROCESS_DOXYGEN_INVOKED + +//!Typedef for a default basic_managed_xsi_shared_memory +//!of narrow characters +typedef basic_managed_xsi_shared_memory + <char + ,rbtree_best_fit<mutex_family> + ,iset_index> +managed_xsi_shared_memory; + +//!Typedef for a default basic_managed_xsi_shared_memory +//!of wide characters +typedef basic_managed_xsi_shared_memory + <wchar_t + ,rbtree_best_fit<mutex_family> + ,iset_index> +wmanaged_xsi_shared_memory; + +#endif //#ifdef BOOST_INTERPROCESS_DOXYGEN_INVOKED + } //namespace interprocess { } //namespace boost { |