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 
11 #ifndef BOOST_INTERPROCESS_FWD_HPP
12 #define BOOST_INTERPROCESS_FWD_HPP
13 
14 #ifndef BOOST_CONFIG_HPP
15 #  include <boost/config.hpp>
16 #endif
17 #
18 #if defined(BOOST_HAS_PRAGMA_ONCE)
19 #  pragma once
20 #endif
21 
22 #include <boost/interprocess/detail/std_fwd.hpp>
23 
24 //! \file
25 //! This header file forward declares the basic interprocess types:
26 //!   - boost::interprocess::offset_ptr;
27 //!   - boost::interprocess::permissions;
28 //!   - boost::interprocess::mapped_region;
29 //!   - boost::interprocess::file_mapping;
30 //!   - boost::interprocess::shared_memory_object;
31 //!   - boost::interprocess::windows_shared_memory;
32 //!   - boost::interprocess::xsi_shared_memory;
33 //!
34 //! The following synchronization mechanisms and locks:
35 //!   - boost::interprocess::null_mutex;
36 //!   - boost::interprocess::interprocess_mutex;
37 //!   - boost::interprocess::interprocess_recursive_mutex;
38 //!   - boost::interprocess::interprocess_semaphore;
39 //!   - boost::interprocess::named_mutex;
40 //!   - boost::interprocess::named_recursive_mutex;
41 //!   - boost::interprocess::named_semaphore;
42 //!   - boost::interprocess::interprocess_sharable_mutex;
43 //!   - boost::interprocess::interprocess_condition;
44 //!   - boost::interprocess::scoped_lock;
45 //!   - boost::interprocess::sharable_lock;
46 //!   - boost::interprocess::upgradable_lock;
47 //!
48 //! The following mutex families:
49 //!   - boost::interprocess::mutex_family;
50 //!   - boost::interprocess::null_mutex_family;
51 //!
52 //! The following allocators:
53 //!   - boost::interprocess::allocator;
54 //!   - boost::interprocess::node_allocator;
55 //!   - boost::interprocess::private_node_allocator;
56 //!   - boost::interprocess::cached_node_allocator;
57 //!   - boost::interprocess::adaptive_pool;
58 //!   - boost::interprocess::private_adaptive_pool;
59 //!   - boost::interprocess::cached_adaptive_pool;
60 //!
61 //! The following allocation algorithms:
62 //!   - boost::interprocess::simple_seq_fit;
63 //!   - boost::interprocess::rbtree_best_fit;
64 //!
65 //! The following index types:
66 //!   - boost::interprocess::flat_map_index;
67 //!   - boost::interprocess::iset_index;
68 //!   - boost::interprocess::iunordered_set_index;
69 //!   - boost::interprocess::map_index;
70 //!   - boost::interprocess::null_index;
71 //!   - boost::interprocess::unordered_map_index;
72 //!
73 //! The following managed memory types:
74 //!   - boost::interprocess::segment_manager;
75 //!   - boost::interprocess::basic_managed_external_buffer
76 //!   - boost::interprocess::managed_external_buffer
77 //!   - boost::interprocess::wmanaged_external_buffer
78 //!   - boost::interprocess::basic_managed_shared_memory
79 //!   - boost::interprocess::managed_shared_memory
80 //!   - boost::interprocess::wmanaged_shared_memory
81 //!   - boost::interprocess::basic_managed_windows_shared_memory
82 //!   - boost::interprocess::managed_windows_shared_memory
83 //!   - boost::interprocess::wmanaged_windows_shared_memory
84 //!   - boost::interprocess::basic_managed_xsi_shared_memory
85 //!   - boost::interprocess::managed_xsi_shared_memory
86 //!   - boost::interprocess::wmanaged_xsi_shared_memory
87 //!   - boost::interprocess::fixed_managed_shared_memory
88 //!   - boost::interprocess::wfixed_managed_shared_memory
89 //!   - boost::interprocess::basic_managed_heap_memory
90 //!   - boost::interprocess::managed_heap_memory
91 //!   - boost::interprocess::wmanaged_heap_memory
92 //!   - boost::interprocess::basic_managed_mapped_file
93 //!   - boost::interprocess::managed_mapped_file
94 //!   - boost::interprocess::wmanaged_mapped_file
95 //!
96 //! The following exception types:
97 //!   - boost::interprocess::interprocess_exception
98 //!   - boost::interprocess::lock_exception
99 //!   - boost::interprocess::bad_alloc
100 //!
101 //! The following stream types:
102 //!   - boost::interprocess::basic_bufferbuf
103 //!   - boost::interprocess::basic_ibufferstream
104 //!   - boost::interprocess::basic_obufferstream
105 //!   - boost::interprocess::basic_bufferstream
106 //!   - boost::interprocess::basic_vectorbuf
107 //!   - boost::interprocess::basic_ivectorstream
108 //!   - boost::interprocess::basic_ovectorstream
109 //!   - boost::interprocess::basic_vectorstream
110 //!
111 //! The following smart pointer types:
112 //!   - boost::interprocess::scoped_ptr
113 //!   - boost::interprocess::intrusive_ptr
114 //!   - boost::interprocess::shared_ptr
115 //!   - boost::interprocess::weak_ptr
116 //!
117 //! The following interprocess communication types:
118 //!   - boost::interprocess::message_queue_t;
119 //!   - boost::interprocess::message_queue;
120 
121 #include <boost/interprocess/detail/config_begin.hpp>
122 #include <boost/interprocess/detail/workaround.hpp>
123 
124 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
125 
126 #include <cstddef>
127 
128 //////////////////////////////////////////////////////////////////////////////
129 //                        Standard predeclarations
130 //////////////////////////////////////////////////////////////////////////////
131 
132 namespace boost{  namespace intrusive{ }  }
133 namespace boost{  namespace interprocess{ namespace bi = boost::intrusive; }  }
134 
135 namespace boost { namespace interprocess {
136 
137 //////////////////////////////////////////////////////////////////////////////
138 //                            permissions
139 //////////////////////////////////////////////////////////////////////////////
140 
141 class permissions;
142 
143 //////////////////////////////////////////////////////////////////////////////
144 //                            shared_memory
145 //////////////////////////////////////////////////////////////////////////////
146 
147 class shared_memory_object;
148 
149 #if defined (BOOST_INTERPROCESS_WINDOWS)
150 class windows_shared_memory;
151 #endif   //#if defined (BOOST_INTERPROCESS_WINDOWS)
152 
153 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
154 class xsi_shared_memory;
155 #endif   //#if defined (BOOST_INTERPROCESS_WINDOWS)
156 
157 //////////////////////////////////////////////////////////////////////////////
158 //              file mapping / mapped region
159 //////////////////////////////////////////////////////////////////////////////
160 
161 class file_mapping;
162 class mapped_region;
163 
164 //////////////////////////////////////////////////////////////////////////////
165 //                               Mutexes
166 //////////////////////////////////////////////////////////////////////////////
167 
168 class null_mutex;
169 
170 class interprocess_mutex;
171 class interprocess_recursive_mutex;
172 
173 class named_mutex;
174 class named_recursive_mutex;
175 
176 class interprocess_semaphore;
177 class named_semaphore;
178 
179 //////////////////////////////////////////////////////////////////////////////
180 //                         Mutex families
181 //////////////////////////////////////////////////////////////////////////////
182 
183 struct mutex_family;
184 struct null_mutex_family;
185 
186 //////////////////////////////////////////////////////////////////////////////
187 //                   Other synchronization classes
188 //////////////////////////////////////////////////////////////////////////////
189 
190 class interprocess_sharable_mutex;
191 class interprocess_condition;
192 
193 //////////////////////////////////////////////////////////////////////////////
194 //                              Locks
195 //////////////////////////////////////////////////////////////////////////////
196 
197 template <class Mutex>
198 class scoped_lock;
199 
200 template <class SharableMutex>
201 class sharable_lock;
202 
203 template <class UpgradableMutex>
204 class upgradable_lock;
205 
206 //////////////////////////////////////////////////////////////////////////////
207 //                      STL compatible allocators
208 //////////////////////////////////////////////////////////////////////////////
209 
210 template<class T, class SegmentManager>
211 class allocator;
212 
213 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
214 class node_allocator;
215 
216 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
217 class private_node_allocator;
218 
219 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
220 class cached_node_allocator;
221 
222 template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
223         , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
224 class adaptive_pool;
225 
226 template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
227         , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
228 class private_adaptive_pool;
229 
230 template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
231         , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
232 class cached_adaptive_pool;
233 
234 
235 //////////////////////////////////////////////////////////////////////////////
236 //                            offset_ptr
237 //////////////////////////////////////////////////////////////////////////////
238 
239 static const std::size_t offset_type_alignment = 0;
240 
241 template < class T, class DifferenceType = std::ptrdiff_t
242          , class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
243 class offset_ptr;
244 
245 //////////////////////////////////////////////////////////////////////////////
246 //                    Memory allocation algorithms
247 //////////////////////////////////////////////////////////////////////////////
248 
249 //Single segment memory allocation algorithms
250 template<class MutexFamily, class VoidMutex = offset_ptr<void> >
251 class simple_seq_fit;
252 
253 template<class MutexFamily, class VoidMutex = offset_ptr<void>, std::size_t MemAlignment = 0>
254 class rbtree_best_fit;
255 
256 //////////////////////////////////////////////////////////////////////////////
257 //                         Index Types
258 //////////////////////////////////////////////////////////////////////////////
259 
260 template<class IndexConfig> class flat_map_index;
261 template<class IndexConfig> class iset_index;
262 template<class IndexConfig> class iunordered_set_index;
263 template<class IndexConfig> class map_index;
264 template<class IndexConfig> class null_index;
265 template<class IndexConfig> class unordered_map_index;
266 
267 //////////////////////////////////////////////////////////////////////////////
268 //                         Segment manager
269 //////////////////////////////////////////////////////////////////////////////
270 
271 template <class CharType
272          ,class MemoryAlgorithm
273          ,template<class IndexConfig> class IndexType>
274 class segment_manager;
275 
276 //////////////////////////////////////////////////////////////////////////////
277 //                  External buffer managed memory classes
278 //////////////////////////////////////////////////////////////////////////////
279 
280 template <class CharType
281          ,class MemoryAlgorithm
282          ,template<class IndexConfig> class IndexType>
283 class basic_managed_external_buffer;
284 
285 typedef basic_managed_external_buffer
286    <char
287    ,rbtree_best_fit<null_mutex_family>
288    ,iset_index>
289 managed_external_buffer;
290 
291 typedef basic_managed_external_buffer
292    <wchar_t
293    ,rbtree_best_fit<null_mutex_family>
294    ,iset_index>
295 wmanaged_external_buffer;
296 
297 //////////////////////////////////////////////////////////////////////////////
298 //                      managed memory classes
299 //////////////////////////////////////////////////////////////////////////////
300 
301 template <class CharType
302          ,class MemoryAlgorithm
303          ,template<class IndexConfig> class IndexType>
304 class basic_managed_shared_memory;
305 
306 typedef basic_managed_shared_memory
307    <char
308    ,rbtree_best_fit<mutex_family>
309    ,iset_index>
310 managed_shared_memory;
311 
312 typedef basic_managed_shared_memory
313    <wchar_t
314    ,rbtree_best_fit<mutex_family>
315    ,iset_index>
316 wmanaged_shared_memory;
317 
318 
319 //////////////////////////////////////////////////////////////////////////////
320 //                      Windows shared memory managed memory classes
321 //////////////////////////////////////////////////////////////////////////////
322 
323 #if defined (BOOST_INTERPROCESS_WINDOWS)
324 
325 template <class CharType
326          ,class MemoryAlgorithm
327          ,template<class IndexConfig> class IndexType>
328 class basic_managed_windows_shared_memory;
329 
330 typedef basic_managed_windows_shared_memory
331    <char
332    ,rbtree_best_fit<mutex_family>
333    ,iset_index>
334 managed_windows_shared_memory;
335 
336 typedef basic_managed_windows_shared_memory
337    <wchar_t
338    ,rbtree_best_fit<mutex_family>
339    ,iset_index>
340 wmanaged_windows_shared_memory;
341 
342 #endif   //#if defined (BOOST_INTERPROCESS_WINDOWS)
343 
344 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
345 
346 template <class CharType
347          ,class MemoryAlgorithm
348          ,template<class IndexConfig> class IndexType>
349 class basic_managed_xsi_shared_memory;
350 
351 typedef basic_managed_xsi_shared_memory
352    <char
353    ,rbtree_best_fit<mutex_family>
354    ,iset_index>
355 managed_xsi_shared_memory;
356 
357 typedef basic_managed_xsi_shared_memory
358    <wchar_t
359    ,rbtree_best_fit<mutex_family>
360    ,iset_index>
361 wmanaged_xsi_shared_memory;
362 
363 #endif //#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
364 
365 //////////////////////////////////////////////////////////////////////////////
366 //                      Fixed address shared memory
367 //////////////////////////////////////////////////////////////////////////////
368 
369 typedef basic_managed_shared_memory
370    <char
371    ,rbtree_best_fit<mutex_family, void*>
372    ,iset_index>
373 fixed_managed_shared_memory;
374 
375 typedef basic_managed_shared_memory
376    <wchar_t
377    ,rbtree_best_fit<mutex_family, void*>
378    ,iset_index>
379 wfixed_managed_shared_memory;
380 
381 //////////////////////////////////////////////////////////////////////////////
382 //                      Heap memory managed memory classes
383 //////////////////////////////////////////////////////////////////////////////
384 
385 template
386    <class CharType
387    ,class MemoryAlgorithm
388    ,template<class IndexConfig> class IndexType>
389 class basic_managed_heap_memory;
390 
391 typedef basic_managed_heap_memory
392    <char
393    ,rbtree_best_fit<null_mutex_family>
394    ,iset_index>
395 managed_heap_memory;
396 
397 typedef basic_managed_heap_memory
398    <wchar_t
399    ,rbtree_best_fit<null_mutex_family>
400    ,iset_index>
401 wmanaged_heap_memory;
402 
403 //////////////////////////////////////////////////////////////////////////////
404 //                         Mapped file managed memory classes
405 //////////////////////////////////////////////////////////////////////////////
406 
407 template
408    <class CharType
409    ,class MemoryAlgorithm
410    ,template<class IndexConfig> class IndexType>
411 class basic_managed_mapped_file;
412 
413 typedef basic_managed_mapped_file
414    <char
415    ,rbtree_best_fit<mutex_family>
416    ,iset_index>
417 managed_mapped_file;
418 
419 typedef basic_managed_mapped_file
420    <wchar_t
421    ,rbtree_best_fit<mutex_family>
422    ,iset_index>
423 wmanaged_mapped_file;
424 
425 //////////////////////////////////////////////////////////////////////////////
426 //                            Exceptions
427 //////////////////////////////////////////////////////////////////////////////
428 
429 class interprocess_exception;
430 class lock_exception;
431 class bad_alloc;
432 
433 //////////////////////////////////////////////////////////////////////////////
434 //                            Bufferstream
435 //////////////////////////////////////////////////////////////////////////////
436 
437 //bufferstream
438 template <class CharT
439          ,class CharTraits = std::char_traits<CharT> >
440 class basic_bufferbuf;
441 
442 template <class CharT
443          ,class CharTraits = std::char_traits<CharT> >
444 class basic_ibufferstream;
445 
446 template <class CharT
447          ,class CharTraits = std::char_traits<CharT> >
448 class basic_obufferstream;
449 
450 template <class CharT
451          ,class CharTraits = std::char_traits<CharT> >
452 class basic_bufferstream;
453 
454 //////////////////////////////////////////////////////////////////////////////
455 //                            Vectorstream
456 //////////////////////////////////////////////////////////////////////////////
457 
458 template <class CharVector
459          ,class CharTraits = std::char_traits<typename CharVector::value_type> >
460 class basic_vectorbuf;
461 
462 template <class CharVector
463          ,class CharTraits = std::char_traits<typename CharVector::value_type> >
464 class basic_ivectorstream;
465 
466 template <class CharVector
467          ,class CharTraits = std::char_traits<typename CharVector::value_type> >
468 class basic_ovectorstream;
469 
470 template <class CharVector
471          ,class CharTraits = std::char_traits<typename CharVector::value_type> >
472 class basic_vectorstream;
473 
474 //////////////////////////////////////////////////////////////////////////////
475 //                             Smart pointers
476 //////////////////////////////////////////////////////////////////////////////
477 
478 template<class T, class Deleter>
479 class scoped_ptr;
480 
481 template<class T, class VoidPointer>
482 class intrusive_ptr;
483 
484 template<class T, class VoidAllocator, class Deleter>
485 class shared_ptr;
486 
487 template<class T, class VoidAllocator, class Deleter>
488 class weak_ptr;
489 
490 //////////////////////////////////////////////////////////////////////////////
491 //                                  IPC
492 //////////////////////////////////////////////////////////////////////////////
493 
494 template<class VoidPointer>
495 class message_queue_t;
496 
497 typedef message_queue_t<offset_ptr<void> > message_queue;
498 
499 }}  //namespace boost { namespace interprocess {
500 
501 #endif   //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
502 
503 #include <boost/interprocess/detail/config_end.hpp>
504 
505 #endif //#ifndef BOOST_INTERPROCESS_FWD_HPP
506