1 //////////////////////////////////////////////////////////////////////////////
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)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_INTERPROCESS_FWD_HPP
12 #define BOOST_INTERPROCESS_FWD_HPP
14 #ifndef BOOST_CONFIG_HPP
15 # include <boost/config.hpp>
17 #ifndef BOOST_CSTDINT_HPP
18 # include <boost/cstdint.hpp>
21 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 #include <boost/interprocess/detail/std_fwd.hpp>
28 //! This header file forward declares the basic interprocess types:
29 //! - boost::interprocess::offset_ptr;
30 //! - boost::interprocess::permissions;
31 //! - boost::interprocess::mapped_region;
32 //! - boost::interprocess::file_mapping;
33 //! - boost::interprocess::shared_memory_object;
34 //! - boost::interprocess::windows_shared_memory;
35 //! - boost::interprocess::xsi_shared_memory;
37 //! The following synchronization mechanisms and locks:
38 //! - boost::interprocess::null_mutex;
39 //! - boost::interprocess::interprocess_mutex;
40 //! - boost::interprocess::interprocess_recursive_mutex;
41 //! - boost::interprocess::interprocess_semaphore;
42 //! - boost::interprocess::named_mutex;
43 //! - boost::interprocess::named_recursive_mutex;
44 //! - boost::interprocess::named_semaphore;
45 //! - boost::interprocess::interprocess_sharable_mutex;
46 //! - boost::interprocess::interprocess_condition;
47 //! - boost::interprocess::scoped_lock;
48 //! - boost::interprocess::sharable_lock;
49 //! - boost::interprocess::upgradable_lock;
51 //! The following mutex families:
52 //! - boost::interprocess::mutex_family;
53 //! - boost::interprocess::null_mutex_family;
55 //! The following allocators:
56 //! - boost::interprocess::allocator;
57 //! - boost::interprocess::node_allocator;
58 //! - boost::interprocess::private_node_allocator;
59 //! - boost::interprocess::cached_node_allocator;
60 //! - boost::interprocess::adaptive_pool;
61 //! - boost::interprocess::private_adaptive_pool;
62 //! - boost::interprocess::cached_adaptive_pool;
64 //! The following allocation algorithms:
65 //! - boost::interprocess::simple_seq_fit;
66 //! - boost::interprocess::rbtree_best_fit;
68 //! The following index types:
69 //! - boost::interprocess::flat_map_index;
70 //! - boost::interprocess::iset_index;
71 //! - boost::interprocess::iunordered_set_index;
72 //! - boost::interprocess::map_index;
73 //! - boost::interprocess::null_index;
74 //! - boost::interprocess::unordered_map_index;
76 //! The following managed memory types:
77 //! - boost::interprocess::segment_manager;
78 //! - boost::interprocess::basic_managed_external_buffer
79 //! - boost::interprocess::managed_external_buffer
80 //! - boost::interprocess::wmanaged_external_buffer
81 //! - boost::interprocess::basic_managed_shared_memory
82 //! - boost::interprocess::managed_shared_memory
83 //! - boost::interprocess::wmanaged_shared_memory
84 //! - boost::interprocess::basic_managed_windows_shared_memory
85 //! - boost::interprocess::managed_windows_shared_memory
86 //! - boost::interprocess::wmanaged_windows_shared_memory
87 //! - boost::interprocess::basic_managed_xsi_shared_memory
88 //! - boost::interprocess::managed_xsi_shared_memory
89 //! - boost::interprocess::wmanaged_xsi_shared_memory
90 //! - boost::interprocess::fixed_managed_shared_memory
91 //! - boost::interprocess::wfixed_managed_shared_memory
92 //! - boost::interprocess::basic_managed_heap_memory
93 //! - boost::interprocess::managed_heap_memory
94 //! - boost::interprocess::wmanaged_heap_memory
95 //! - boost::interprocess::basic_managed_mapped_file
96 //! - boost::interprocess::managed_mapped_file
97 //! - boost::interprocess::wmanaged_mapped_file
99 //! The following exception types:
100 //! - boost::interprocess::interprocess_exception
101 //! - boost::interprocess::lock_exception
102 //! - boost::interprocess::bad_alloc
104 //! The following stream types:
105 //! - boost::interprocess::basic_bufferbuf
106 //! - boost::interprocess::basic_ibufferstream
107 //! - boost::interprocess::basic_obufferstream
108 //! - boost::interprocess::basic_bufferstream
109 //! - boost::interprocess::basic_vectorbuf
110 //! - boost::interprocess::basic_ivectorstream
111 //! - boost::interprocess::basic_ovectorstream
112 //! - boost::interprocess::basic_vectorstream
114 //! The following smart pointer types:
115 //! - boost::interprocess::scoped_ptr
116 //! - boost::interprocess::intrusive_ptr
117 //! - boost::interprocess::shared_ptr
118 //! - boost::interprocess::weak_ptr
120 //! The following interprocess communication types:
121 //! - boost::interprocess::message_queue_t;
122 //! - boost::interprocess::message_queue;
124 #include <boost/interprocess/detail/config_begin.hpp>
125 #include <boost/interprocess/detail/workaround.hpp>
127 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
131 //////////////////////////////////////////////////////////////////////////////
132 // Standard predeclarations
133 //////////////////////////////////////////////////////////////////////////////
135 namespace boost{ namespace intrusive{ } }
136 namespace boost{ namespace interprocess{ namespace bi = boost::intrusive; } }
138 namespace boost { namespace interprocess {
140 //////////////////////////////////////////////////////////////////////////////
142 //////////////////////////////////////////////////////////////////////////////
146 //////////////////////////////////////////////////////////////////////////////
148 //////////////////////////////////////////////////////////////////////////////
150 class shared_memory_object;
152 #if defined (BOOST_INTERPROCESS_WINDOWS)
153 class windows_shared_memory;
154 #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
156 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
157 class xsi_shared_memory;
158 #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
160 //////////////////////////////////////////////////////////////////////////////
161 // file mapping / mapped region
162 //////////////////////////////////////////////////////////////////////////////
167 //////////////////////////////////////////////////////////////////////////////
169 //////////////////////////////////////////////////////////////////////////////
173 class interprocess_mutex;
174 class interprocess_recursive_mutex;
177 class named_recursive_mutex;
179 class interprocess_semaphore;
180 class named_semaphore;
182 //////////////////////////////////////////////////////////////////////////////
184 //////////////////////////////////////////////////////////////////////////////
187 struct null_mutex_family;
189 //////////////////////////////////////////////////////////////////////////////
190 // Other synchronization classes
191 //////////////////////////////////////////////////////////////////////////////
193 class interprocess_sharable_mutex;
194 class interprocess_condition;
196 //////////////////////////////////////////////////////////////////////////////
198 //////////////////////////////////////////////////////////////////////////////
200 template <class Mutex>
203 template <class SharableMutex>
206 template <class UpgradableMutex>
207 class upgradable_lock;
209 //////////////////////////////////////////////////////////////////////////////
210 // STL compatible allocators
211 //////////////////////////////////////////////////////////////////////////////
213 template<class T, class SegmentManager>
216 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
217 class node_allocator;
219 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
220 class private_node_allocator;
222 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
223 class cached_node_allocator;
225 template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
226 , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
229 template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
230 , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
231 class private_adaptive_pool;
233 template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
234 , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
235 class cached_adaptive_pool;
238 //////////////////////////////////////////////////////////////////////////////
240 //////////////////////////////////////////////////////////////////////////////
242 static const std::size_t offset_type_alignment = 0;
244 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
245 # ifdef BOOST_HAS_INTPTR_T
246 using ::boost::uintptr_t;
248 typedef std::size_t uintptr_t;
252 template < class T, class DifferenceType = std::ptrdiff_t
253 , class OffsetType = uintptr_t, std::size_t Alignment = offset_type_alignment>
256 //////////////////////////////////////////////////////////////////////////////
257 // Memory allocation algorithms
258 //////////////////////////////////////////////////////////////////////////////
260 //Single segment memory allocation algorithms
261 template<class MutexFamily, class VoidMutex = offset_ptr<void> >
262 class simple_seq_fit;
264 template<class MutexFamily, class VoidMutex = offset_ptr<void>, std::size_t MemAlignment = 0>
265 class rbtree_best_fit;
267 //////////////////////////////////////////////////////////////////////////////
269 //////////////////////////////////////////////////////////////////////////////
271 template<class IndexConfig> class flat_map_index;
272 template<class IndexConfig> class iset_index;
273 template<class IndexConfig> class iunordered_set_index;
274 template<class IndexConfig> class map_index;
275 template<class IndexConfig> class null_index;
276 template<class IndexConfig> class unordered_map_index;
278 //////////////////////////////////////////////////////////////////////////////
280 //////////////////////////////////////////////////////////////////////////////
282 template <class CharType
283 ,class MemoryAlgorithm
284 ,template<class IndexConfig> class IndexType>
285 class segment_manager;
287 //////////////////////////////////////////////////////////////////////////////
288 // External buffer managed memory classes
289 //////////////////////////////////////////////////////////////////////////////
291 template <class CharType
292 ,class MemoryAlgorithm
293 ,template<class IndexConfig> class IndexType>
294 class basic_managed_external_buffer;
296 typedef basic_managed_external_buffer
298 ,rbtree_best_fit<null_mutex_family>
300 managed_external_buffer;
302 typedef basic_managed_external_buffer
304 ,rbtree_best_fit<null_mutex_family>
306 wmanaged_external_buffer;
308 //////////////////////////////////////////////////////////////////////////////
309 // managed memory classes
310 //////////////////////////////////////////////////////////////////////////////
312 template <class CharType
313 ,class MemoryAlgorithm
314 ,template<class IndexConfig> class IndexType>
315 class basic_managed_shared_memory;
317 typedef basic_managed_shared_memory
319 ,rbtree_best_fit<mutex_family>
321 managed_shared_memory;
323 typedef basic_managed_shared_memory
325 ,rbtree_best_fit<mutex_family>
327 wmanaged_shared_memory;
330 //////////////////////////////////////////////////////////////////////////////
331 // Windows shared memory managed memory classes
332 //////////////////////////////////////////////////////////////////////////////
334 #if defined (BOOST_INTERPROCESS_WINDOWS)
336 template <class CharType
337 ,class MemoryAlgorithm
338 ,template<class IndexConfig> class IndexType>
339 class basic_managed_windows_shared_memory;
341 typedef basic_managed_windows_shared_memory
343 ,rbtree_best_fit<mutex_family>
345 managed_windows_shared_memory;
347 typedef basic_managed_windows_shared_memory
349 ,rbtree_best_fit<mutex_family>
351 wmanaged_windows_shared_memory;
353 #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
355 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
357 template <class CharType
358 ,class MemoryAlgorithm
359 ,template<class IndexConfig> class IndexType>
360 class basic_managed_xsi_shared_memory;
362 typedef basic_managed_xsi_shared_memory
364 ,rbtree_best_fit<mutex_family>
366 managed_xsi_shared_memory;
368 typedef basic_managed_xsi_shared_memory
370 ,rbtree_best_fit<mutex_family>
372 wmanaged_xsi_shared_memory;
374 #endif //#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
376 //////////////////////////////////////////////////////////////////////////////
377 // Fixed address shared memory
378 //////////////////////////////////////////////////////////////////////////////
380 typedef basic_managed_shared_memory
382 ,rbtree_best_fit<mutex_family, void*>
384 fixed_managed_shared_memory;
386 typedef basic_managed_shared_memory
388 ,rbtree_best_fit<mutex_family, void*>
390 wfixed_managed_shared_memory;
392 //////////////////////////////////////////////////////////////////////////////
393 // Heap memory managed memory classes
394 //////////////////////////////////////////////////////////////////////////////
398 ,class MemoryAlgorithm
399 ,template<class IndexConfig> class IndexType>
400 class basic_managed_heap_memory;
402 typedef basic_managed_heap_memory
404 ,rbtree_best_fit<null_mutex_family>
408 typedef basic_managed_heap_memory
410 ,rbtree_best_fit<null_mutex_family>
412 wmanaged_heap_memory;
414 //////////////////////////////////////////////////////////////////////////////
415 // Mapped file managed memory classes
416 //////////////////////////////////////////////////////////////////////////////
420 ,class MemoryAlgorithm
421 ,template<class IndexConfig> class IndexType>
422 class basic_managed_mapped_file;
424 typedef basic_managed_mapped_file
426 ,rbtree_best_fit<mutex_family>
430 typedef basic_managed_mapped_file
432 ,rbtree_best_fit<mutex_family>
434 wmanaged_mapped_file;
436 //////////////////////////////////////////////////////////////////////////////
438 //////////////////////////////////////////////////////////////////////////////
440 class interprocess_exception;
441 class lock_exception;
444 //////////////////////////////////////////////////////////////////////////////
446 //////////////////////////////////////////////////////////////////////////////
449 template <class CharT
450 ,class CharTraits = std::char_traits<CharT> >
451 class basic_bufferbuf;
453 template <class CharT
454 ,class CharTraits = std::char_traits<CharT> >
455 class basic_ibufferstream;
457 template <class CharT
458 ,class CharTraits = std::char_traits<CharT> >
459 class basic_obufferstream;
461 template <class CharT
462 ,class CharTraits = std::char_traits<CharT> >
463 class basic_bufferstream;
465 //////////////////////////////////////////////////////////////////////////////
467 //////////////////////////////////////////////////////////////////////////////
469 template <class CharVector
470 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
471 class basic_vectorbuf;
473 template <class CharVector
474 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
475 class basic_ivectorstream;
477 template <class CharVector
478 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
479 class basic_ovectorstream;
481 template <class CharVector
482 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
483 class basic_vectorstream;
485 //////////////////////////////////////////////////////////////////////////////
487 //////////////////////////////////////////////////////////////////////////////
489 template<class T, class Deleter>
492 template<class T, class VoidPointer>
495 template<class T, class VoidAllocator, class Deleter>
498 template<class T, class VoidAllocator, class Deleter>
501 //////////////////////////////////////////////////////////////////////////////
503 //////////////////////////////////////////////////////////////////////////////
505 template<class VoidPointer>
506 class message_queue_t;
508 typedef message_queue_t<offset_ptr<void> > message_queue;
510 }} //namespace boost { namespace interprocess {
512 #endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
514 #include <boost/interprocess/detail/config_end.hpp>
516 #endif //#ifndef BOOST_INTERPROCESS_FWD_HPP