Warning, file /include/boost/interprocess/detail/managed_global_memory.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP
0012 #define BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP
0013
0014 #ifndef BOOST_CONFIG_HPP
0015 # include <boost/config.hpp>
0016 #endif
0017 0018 ">#
0019 #if defined(BOOST_HAS_PRAGMA_ONCE)
0020 #pragma once
0021 #endif
0022
0023 #include <boost/interprocess/detail/config_begin.hpp>
0024 #include <boost/interprocess/detail/workaround.hpp>
0025
0026 #include <boost/interprocess/offset_ptr.hpp>
0027 #include <boost/interprocess/sync/spin/mutex.hpp>
0028 #include <boost/interprocess/sync/spin/recursive_mutex.hpp>
0029 #include <boost/interprocess/detail/managed_memory_impl.hpp>
0030 #include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
0031 #include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
0032 #include <boost/interprocess/indexes/iset_index.hpp>
0033 #include <boost/interprocess/creation_tags.hpp>
0034 #include <boost/interprocess/permissions.hpp>
0035
0036 namespace boost{
0037 namespace interprocess{
0038 namespace ipcdetail{
0039
0040 struct intermodule_singleton_mutex_family
0041 {
0042 typedef boost::interprocess::ipcdetail::spin_mutex mutex_type;
0043 typedef boost::interprocess::ipcdetail::spin_recursive_mutex recursive_mutex_type;
0044 };
0045
0046 struct intermodule_types
0047 {
0048
0049
0050 typedef rbtree_best_fit<intermodule_singleton_mutex_family, offset_ptr<void> > mem_algo;
0051 template<class Device, bool FileBased>
0052 struct open_or_create
0053 {
0054 typedef managed_open_or_create_impl
0055 <Device, mem_algo::Alignment, FileBased, false> type;
0056 };
0057 };
0058
0059
0060 template<class Device, bool FileBased>
0061 class basic_managed_global_memory
0062 : public basic_managed_memory_impl
0063 < char
0064 , intermodule_types::mem_algo
0065 , iset_index
0066 , intermodule_types::open_or_create<Device, FileBased>::type::ManagedOpenOrCreateUserOffset
0067 >
0068 , private intermodule_types::open_or_create<Device, FileBased>::type
0069 {
0070 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0071 typedef typename intermodule_types::template open_or_create<Device, FileBased>::type base2_t;
0072
0073 typedef basic_managed_memory_impl
0074 < char
0075 , intermodule_types::mem_algo
0076 , iset_index
0077 , base2_t::ManagedOpenOrCreateUserOffset
0078 > base_t;
0079
0080 typedef create_open_func<base_t> create_open_func_t;
0081
0082 basic_managed_global_memory *get_this_pointer()
0083 { return this; }
0084
0085 public:
0086 typedef typename base_t::size_type size_type;
0087
0088 private:
0089 typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
0090 BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_global_memory)
0091 #endif
0092
0093 public:
0094
0095 basic_managed_global_memory (open_or_create_t,
0096 const char *name, size_type size,
0097 const void *addr = 0, const permissions& perm = permissions())
0098 : base_t()
0099 , base2_t(open_or_create_t(), name, size, read_write, addr,
0100 create_open_func_t(get_this_pointer(),
0101 DoOpenOrCreate), perm)
0102 {}
0103
0104 basic_managed_global_memory (open_only_t , const char* name,
0105 const void *addr = 0)
0106 : base_t()
0107 , base2_t(open_only_t(), name, read_write, addr,
0108 create_open_func_t(get_this_pointer(),
0109 DoOpen))
0110 {}
0111 };
0112
0113
0114 }
0115 }
0116 }
0117
0118 #include <boost/interprocess/detail/config_end.hpp>
0119
0120 #endif