interprocess_fwd.hpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/interprocess for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_INTERPROCESS_FWD_HPP
  11. #define BOOST_INTERPROCESS_FWD_HPP
  12. #if defined (_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif
  15. #include <boost/interprocess/detail/config_begin.hpp>
  16. #include <boost/interprocess/detail/workaround.hpp>
  17. #include <cstddef>
  18. //////////////////////////////////////////////////////////////////////////////
  19. // Standard predeclarations
  20. //////////////////////////////////////////////////////////////////////////////
  21. /// @cond
  22. namespace boost{
  23. namespace intrusive{
  24. }}
  25. namespace boost{
  26. namespace interprocess{
  27. namespace bi = boost::intrusive;
  28. }}
  29. #include <utility>
  30. #include <memory>
  31. #include <functional>
  32. #include <iosfwd>
  33. #include <string>
  34. /// @endcond
  35. namespace boost { namespace interprocess {
  36. //////////////////////////////////////////////////////////////////////////////
  37. // permissions
  38. //////////////////////////////////////////////////////////////////////////////
  39. class permissions;
  40. //////////////////////////////////////////////////////////////////////////////
  41. // shared_memory
  42. //////////////////////////////////////////////////////////////////////////////
  43. class shared_memory_object;
  44. #if defined (BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  45. class windows_shared_memory;
  46. #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
  47. //////////////////////////////////////////////////////////////////////////////
  48. // mapped file/mapped region/mapped_file
  49. //////////////////////////////////////////////////////////////////////////////
  50. class file_mapping;
  51. class mapped_region;
  52. class mapped_file;
  53. //////////////////////////////////////////////////////////////////////////////
  54. // Mutexes
  55. //////////////////////////////////////////////////////////////////////////////
  56. class null_mutex;
  57. class interprocess_mutex;
  58. class interprocess_recursive_mutex;
  59. class named_mutex;
  60. class named_recursive_mutex;
  61. class interprocess_semaphore;
  62. class named_semaphore;
  63. //////////////////////////////////////////////////////////////////////////////
  64. // Mutex families
  65. //////////////////////////////////////////////////////////////////////////////
  66. struct mutex_family;
  67. struct null_mutex_family;
  68. //////////////////////////////////////////////////////////////////////////////
  69. // Other synchronization classes
  70. //////////////////////////////////////////////////////////////////////////////
  71. class barrier;
  72. class interprocess_sharable_mutex;
  73. class interprocess_condition;
  74. //////////////////////////////////////////////////////////////////////////////
  75. // Locks
  76. //////////////////////////////////////////////////////////////////////////////
  77. template <class Mutex>
  78. class scoped_lock;
  79. template <class SharableMutex>
  80. class sharable_lock;
  81. template <class UpgradableMutex>
  82. class upgradable_lock;
  83. //////////////////////////////////////////////////////////////////////////////
  84. // STL compatible allocators
  85. //////////////////////////////////////////////////////////////////////////////
  86. template<class T, class SegmentManager>
  87. class allocator;
  88. template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
  89. class node_allocator;
  90. template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
  91. class private_node_allocator;
  92. template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
  93. class cached_node_allocator;
  94. template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
  95. , unsigned char OverheadPercent = 5
  96. >
  97. class adaptive_pool;
  98. template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
  99. , unsigned char OverheadPercent = 5
  100. >
  101. class private_adaptive_pool;
  102. template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
  103. , unsigned char OverheadPercent = 5
  104. >
  105. class cached_adaptive_pool;
  106. //////////////////////////////////////////////////////////////////////////////
  107. // offset_ptr
  108. //////////////////////////////////////////////////////////////////////////////
  109. static const std::size_t offset_type_alignment = 0;
  110. template <class T, class DifferenceType = std::ptrdiff_t, class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
  111. class offset_ptr;
  112. //////////////////////////////////////////////////////////////////////////////
  113. // Memory allocation algorithms
  114. //////////////////////////////////////////////////////////////////////////////
  115. //Single segment memory allocation algorithms
  116. template<class MutexFamily, class VoidMutex = offset_ptr<void> >
  117. class simple_seq_fit;
  118. template<class MutexFamily, class VoidMutex = offset_ptr<void>, std::size_t MemAlignment = 0>
  119. class rbtree_best_fit;
  120. //////////////////////////////////////////////////////////////////////////////
  121. // Index Types
  122. //////////////////////////////////////////////////////////////////////////////
  123. template<class IndexConfig> class flat_map_index;
  124. template<class IndexConfig> class iset_index;
  125. template<class IndexConfig> class iunordered_set_index;
  126. template<class IndexConfig> class map_index;
  127. template<class IndexConfig> class null_index;
  128. template<class IndexConfig> class unordered_map_index;
  129. //////////////////////////////////////////////////////////////////////////////
  130. // Segment manager
  131. //////////////////////////////////////////////////////////////////////////////
  132. template <class CharType
  133. ,class MemoryAlgorithm
  134. ,template<class IndexConfig> class IndexType>
  135. class segment_manager;
  136. //////////////////////////////////////////////////////////////////////////////
  137. // External buffer managed memory classes
  138. //////////////////////////////////////////////////////////////////////////////
  139. template <class CharType
  140. ,class MemoryAlgorithm
  141. ,template<class IndexConfig> class IndexType>
  142. class basic_managed_external_buffer;
  143. typedef basic_managed_external_buffer
  144. <char
  145. ,rbtree_best_fit<null_mutex_family>
  146. ,iset_index>
  147. managed_external_buffer;
  148. typedef basic_managed_external_buffer
  149. <wchar_t
  150. ,rbtree_best_fit<null_mutex_family>
  151. ,iset_index>
  152. wmanaged_external_buffer;
  153. //////////////////////////////////////////////////////////////////////////////
  154. // managed memory classes
  155. //////////////////////////////////////////////////////////////////////////////
  156. template <class CharType
  157. ,class MemoryAlgorithm
  158. ,template<class IndexConfig> class IndexType>
  159. class basic_managed_shared_memory;
  160. typedef basic_managed_shared_memory
  161. <char
  162. ,rbtree_best_fit<mutex_family>
  163. ,iset_index>
  164. managed_shared_memory;
  165. typedef basic_managed_shared_memory
  166. <wchar_t
  167. ,rbtree_best_fit<mutex_family>
  168. ,iset_index>
  169. wmanaged_shared_memory;
  170. //////////////////////////////////////////////////////////////////////////////
  171. // Windows shared memory managed memory classes
  172. //////////////////////////////////////////////////////////////////////////////
  173. #if defined (BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  174. template <class CharType
  175. ,class MemoryAlgorithm
  176. ,template<class IndexConfig> class IndexType>
  177. class basic_managed_windows_shared_memory;
  178. typedef basic_managed_windows_shared_memory
  179. <char
  180. ,rbtree_best_fit<mutex_family>
  181. ,iset_index>
  182. managed_windows_shared_memory;
  183. typedef basic_managed_windows_shared_memory
  184. <wchar_t
  185. ,rbtree_best_fit<mutex_family>
  186. ,iset_index>
  187. wmanaged_windows_shared_memory;
  188. #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
  189. #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  190. template <class CharType
  191. ,class MemoryAlgorithm
  192. ,template<class IndexConfig> class IndexType>
  193. class basic_managed_xsi_shared_memory;
  194. typedef basic_managed_xsi_shared_memory
  195. <char
  196. ,rbtree_best_fit<mutex_family>
  197. ,iset_index>
  198. managed_xsi_shared_memory;
  199. typedef basic_managed_xsi_shared_memory
  200. <wchar_t
  201. ,rbtree_best_fit<mutex_family>
  202. ,iset_index>
  203. wmanaged_xsi_shared_memory;
  204. #endif //#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
  205. //////////////////////////////////////////////////////////////////////////////
  206. // Fixed address shared memory
  207. //////////////////////////////////////////////////////////////////////////////
  208. typedef basic_managed_shared_memory
  209. <char
  210. ,rbtree_best_fit<mutex_family, void*>
  211. ,iset_index>
  212. fixed_managed_shared_memory;
  213. typedef basic_managed_shared_memory
  214. <wchar_t
  215. ,rbtree_best_fit<mutex_family, void*>
  216. ,iset_index>
  217. wfixed_managed_shared_memory;
  218. //////////////////////////////////////////////////////////////////////////////
  219. // Heap memory managed memory classes
  220. //////////////////////////////////////////////////////////////////////////////
  221. template
  222. <class CharType
  223. ,class MemoryAlgorithm
  224. ,template<class IndexConfig> class IndexType>
  225. class basic_managed_heap_memory;
  226. typedef basic_managed_heap_memory
  227. <char
  228. ,rbtree_best_fit<null_mutex_family>
  229. ,iset_index>
  230. managed_heap_memory;
  231. typedef basic_managed_heap_memory
  232. <wchar_t
  233. ,rbtree_best_fit<null_mutex_family>
  234. ,iset_index>
  235. wmanaged_heap_memory;
  236. //////////////////////////////////////////////////////////////////////////////
  237. // Mapped file managed memory classes
  238. //////////////////////////////////////////////////////////////////////////////
  239. template
  240. <class CharType
  241. ,class MemoryAlgorithm
  242. ,template<class IndexConfig> class IndexType>
  243. class basic_managed_mapped_file;
  244. typedef basic_managed_mapped_file
  245. <char
  246. ,rbtree_best_fit<mutex_family>
  247. ,iset_index>
  248. managed_mapped_file;
  249. typedef basic_managed_mapped_file
  250. <wchar_t
  251. ,rbtree_best_fit<mutex_family>
  252. ,iset_index>
  253. wmanaged_mapped_file;
  254. //////////////////////////////////////////////////////////////////////////////
  255. // Exceptions
  256. //////////////////////////////////////////////////////////////////////////////
  257. class interprocess_exception;
  258. class lock_exception;
  259. class bad_alloc;
  260. //////////////////////////////////////////////////////////////////////////////
  261. // Bufferstream
  262. //////////////////////////////////////////////////////////////////////////////
  263. //bufferstream
  264. template <class CharT
  265. ,class CharTraits = std::char_traits<CharT> >
  266. class basic_bufferbuf;
  267. template <class CharT
  268. ,class CharTraits = std::char_traits<CharT> >
  269. class basic_ibufferstream;
  270. template <class CharT
  271. ,class CharTraits = std::char_traits<CharT> >
  272. class basic_obufferstream;
  273. template <class CharT
  274. ,class CharTraits = std::char_traits<CharT> >
  275. class basic_bufferstream;
  276. //////////////////////////////////////////////////////////////////////////////
  277. // Vectorstream
  278. //////////////////////////////////////////////////////////////////////////////
  279. template <class CharVector
  280. ,class CharTraits = std::char_traits<typename CharVector::value_type> >
  281. class basic_vectorbuf;
  282. template <class CharVector
  283. ,class CharTraits = std::char_traits<typename CharVector::value_type> >
  284. class basic_ivectorstream;
  285. template <class CharVector
  286. ,class CharTraits = std::char_traits<typename CharVector::value_type> >
  287. class basic_ovectorstream;
  288. template <class CharVector
  289. ,class CharTraits = std::char_traits<typename CharVector::value_type> >
  290. class basic_vectorstream;
  291. //////////////////////////////////////////////////////////////////////////////
  292. // Smart pointers
  293. //////////////////////////////////////////////////////////////////////////////
  294. template<class T, class Deleter>
  295. class scoped_ptr;
  296. template<class T, class VoidPointer>
  297. class intrusive_ptr;
  298. template<class T, class VoidAllocator, class Deleter>
  299. class shared_ptr;
  300. template<class T, class VoidAllocator, class Deleter>
  301. class weak_ptr;
  302. //////////////////////////////////////////////////////////////////////////////
  303. // IPC
  304. //////////////////////////////////////////////////////////////////////////////
  305. template<class VoidPointer>
  306. class message_queue_t;
  307. typedef message_queue_t<offset_ptr<void> > message_queue;
  308. }} //namespace boost { namespace interprocess {
  309. //////////////////////////////////////////////////////////////////////////////
  310. // CONTAINERS
  311. //////////////////////////////////////////////////////////////////////////////
  312. #include <boost/interprocess/detail/config_end.hpp>
  313. #endif //#ifndef BOOST_INTERPROCESS_FWD_HPP