1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2005-2011. 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 #if defined (_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/interprocess/detail/config_begin.hpp>
19 #include <boost/interprocess/detail/workaround.hpp>
23 //////////////////////////////////////////////////////////////////////////////
24 // Standard predeclarations
25 //////////////////////////////////////////////////////////////////////////////
34 namespace interprocess{
35 namespace bi = boost::intrusive;
46 namespace boost { namespace interprocess {
48 //////////////////////////////////////////////////////////////////////////////
50 //////////////////////////////////////////////////////////////////////////////
54 //////////////////////////////////////////////////////////////////////////////
56 //////////////////////////////////////////////////////////////////////////////
58 class shared_memory_object;
60 #if defined (BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
61 class windows_shared_memory;
62 #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
64 //////////////////////////////////////////////////////////////////////////////
65 // mapped file/mapped region/mapped_file
66 //////////////////////////////////////////////////////////////////////////////
72 //////////////////////////////////////////////////////////////////////////////
74 //////////////////////////////////////////////////////////////////////////////
78 class interprocess_mutex;
79 class interprocess_recursive_mutex;
82 class named_recursive_mutex;
84 class interprocess_semaphore;
85 class named_semaphore;
87 //////////////////////////////////////////////////////////////////////////////
89 //////////////////////////////////////////////////////////////////////////////
92 struct null_mutex_family;
94 //////////////////////////////////////////////////////////////////////////////
95 // Other synchronization classes
96 //////////////////////////////////////////////////////////////////////////////
99 class interprocess_sharable_mutex;
100 class interprocess_condition;
102 //////////////////////////////////////////////////////////////////////////////
104 //////////////////////////////////////////////////////////////////////////////
106 template <class Mutex>
109 template <class SharableMutex>
112 template <class UpgradableMutex>
113 class upgradable_lock;
115 //////////////////////////////////////////////////////////////////////////////
116 // STL compatible allocators
117 //////////////////////////////////////////////////////////////////////////////
119 template<class T, class SegmentManager>
122 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
123 class node_allocator;
125 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
126 class private_node_allocator;
128 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
129 class cached_node_allocator;
131 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
132 , unsigned char OverheadPercent = 5
136 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
137 , unsigned char OverheadPercent = 5
139 class private_adaptive_pool;
141 template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
142 , unsigned char OverheadPercent = 5
144 class cached_adaptive_pool;
147 //////////////////////////////////////////////////////////////////////////////
149 //////////////////////////////////////////////////////////////////////////////
151 static const std::size_t offset_type_alignment = 0;
153 template <class T, class DifferenceType = std::ptrdiff_t, class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
156 //////////////////////////////////////////////////////////////////////////////
157 // Memory allocation algorithms
158 //////////////////////////////////////////////////////////////////////////////
160 //Single segment memory allocation algorithms
161 template<class MutexFamily, class VoidMutex = offset_ptr<void> >
162 class simple_seq_fit;
164 template<class MutexFamily, class VoidMutex = offset_ptr<void>, std::size_t MemAlignment = 0>
165 class rbtree_best_fit;
167 //////////////////////////////////////////////////////////////////////////////
169 //////////////////////////////////////////////////////////////////////////////
171 template<class IndexConfig> class flat_map_index;
172 template<class IndexConfig> class iset_index;
173 template<class IndexConfig> class iunordered_set_index;
174 template<class IndexConfig> class map_index;
175 template<class IndexConfig> class null_index;
176 template<class IndexConfig> class unordered_map_index;
178 //////////////////////////////////////////////////////////////////////////////
180 //////////////////////////////////////////////////////////////////////////////
182 template <class CharType
183 ,class MemoryAlgorithm
184 ,template<class IndexConfig> class IndexType>
185 class segment_manager;
187 //////////////////////////////////////////////////////////////////////////////
188 // External buffer managed memory classes
189 //////////////////////////////////////////////////////////////////////////////
191 template <class CharType
192 ,class MemoryAlgorithm
193 ,template<class IndexConfig> class IndexType>
194 class basic_managed_external_buffer;
196 typedef basic_managed_external_buffer
198 ,rbtree_best_fit<null_mutex_family>
200 managed_external_buffer;
202 typedef basic_managed_external_buffer
204 ,rbtree_best_fit<null_mutex_family>
206 wmanaged_external_buffer;
208 //////////////////////////////////////////////////////////////////////////////
209 // managed memory classes
210 //////////////////////////////////////////////////////////////////////////////
212 template <class CharType
213 ,class MemoryAlgorithm
214 ,template<class IndexConfig> class IndexType>
215 class basic_managed_shared_memory;
217 typedef basic_managed_shared_memory
219 ,rbtree_best_fit<mutex_family>
221 managed_shared_memory;
223 typedef basic_managed_shared_memory
225 ,rbtree_best_fit<mutex_family>
227 wmanaged_shared_memory;
230 //////////////////////////////////////////////////////////////////////////////
231 // Windows shared memory managed memory classes
232 //////////////////////////////////////////////////////////////////////////////
234 #if defined (BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
236 template <class CharType
237 ,class MemoryAlgorithm
238 ,template<class IndexConfig> class IndexType>
239 class basic_managed_windows_shared_memory;
241 typedef basic_managed_windows_shared_memory
243 ,rbtree_best_fit<mutex_family>
245 managed_windows_shared_memory;
247 typedef basic_managed_windows_shared_memory
249 ,rbtree_best_fit<mutex_family>
251 wmanaged_windows_shared_memory;
253 #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
255 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
257 template <class CharType
258 ,class MemoryAlgorithm
259 ,template<class IndexConfig> class IndexType>
260 class basic_managed_xsi_shared_memory;
262 typedef basic_managed_xsi_shared_memory
264 ,rbtree_best_fit<mutex_family>
266 managed_xsi_shared_memory;
268 typedef basic_managed_xsi_shared_memory
270 ,rbtree_best_fit<mutex_family>
272 wmanaged_xsi_shared_memory;
274 #endif //#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
276 //////////////////////////////////////////////////////////////////////////////
277 // Fixed address shared memory
278 //////////////////////////////////////////////////////////////////////////////
280 typedef basic_managed_shared_memory
282 ,rbtree_best_fit<mutex_family, void*>
284 fixed_managed_shared_memory;
286 typedef basic_managed_shared_memory
288 ,rbtree_best_fit<mutex_family, void*>
290 wfixed_managed_shared_memory;
292 //////////////////////////////////////////////////////////////////////////////
293 // Heap memory managed memory classes
294 //////////////////////////////////////////////////////////////////////////////
298 ,class MemoryAlgorithm
299 ,template<class IndexConfig> class IndexType>
300 class basic_managed_heap_memory;
302 typedef basic_managed_heap_memory
304 ,rbtree_best_fit<null_mutex_family>
308 typedef basic_managed_heap_memory
310 ,rbtree_best_fit<null_mutex_family>
312 wmanaged_heap_memory;
314 //////////////////////////////////////////////////////////////////////////////
315 // Mapped file managed memory classes
316 //////////////////////////////////////////////////////////////////////////////
320 ,class MemoryAlgorithm
321 ,template<class IndexConfig> class IndexType>
322 class basic_managed_mapped_file;
324 typedef basic_managed_mapped_file
326 ,rbtree_best_fit<mutex_family>
330 typedef basic_managed_mapped_file
332 ,rbtree_best_fit<mutex_family>
334 wmanaged_mapped_file;
336 //////////////////////////////////////////////////////////////////////////////
338 //////////////////////////////////////////////////////////////////////////////
340 class interprocess_exception;
341 class lock_exception;
344 //////////////////////////////////////////////////////////////////////////////
346 //////////////////////////////////////////////////////////////////////////////
349 template <class CharT
350 ,class CharTraits = std::char_traits<CharT> >
351 class basic_bufferbuf;
353 template <class CharT
354 ,class CharTraits = std::char_traits<CharT> >
355 class basic_ibufferstream;
357 template <class CharT
358 ,class CharTraits = std::char_traits<CharT> >
359 class basic_obufferstream;
361 template <class CharT
362 ,class CharTraits = std::char_traits<CharT> >
363 class basic_bufferstream;
365 //////////////////////////////////////////////////////////////////////////////
367 //////////////////////////////////////////////////////////////////////////////
369 template <class CharVector
370 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
371 class basic_vectorbuf;
373 template <class CharVector
374 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
375 class basic_ivectorstream;
377 template <class CharVector
378 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
379 class basic_ovectorstream;
381 template <class CharVector
382 ,class CharTraits = std::char_traits<typename CharVector::value_type> >
383 class basic_vectorstream;
385 //////////////////////////////////////////////////////////////////////////////
387 //////////////////////////////////////////////////////////////////////////////
389 template<class T, class Deleter>
392 template<class T, class VoidPointer>
395 template<class T, class VoidAllocator, class Deleter>
398 template<class T, class VoidAllocator, class Deleter>
401 //////////////////////////////////////////////////////////////////////////////
403 //////////////////////////////////////////////////////////////////////////////
405 template<class VoidPointer>
406 class message_queue_t;
408 typedef message_queue_t<offset_ptr<void> > message_queue;
410 }} //namespace boost { namespace interprocess {
412 //////////////////////////////////////////////////////////////////////////////
414 //////////////////////////////////////////////////////////////////////////////
416 #include <boost/interprocess/detail/config_end.hpp>
418 #endif //#ifndef BOOST_INTERPROCESS_FWD_HPP