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