intermodule_singleton.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2009-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_INTERMODULE_SINGLETON_HPP
  11. #define BOOST_INTERPROCESS_INTERMODULE_SINGLETON_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #
  16. #if defined(BOOST_HAS_PRAGMA_ONCE)
  17. #pragma once
  18. #endif
  19. #include <boost/interprocess/detail/config_begin.hpp>
  20. #include <boost/interprocess/detail/workaround.hpp>
  21. #ifdef BOOST_INTERPROCESS_WINDOWS
  22. #include <boost/interprocess/detail/windows_intermodule_singleton.hpp>
  23. #else
  24. #include <boost/interprocess/detail/portable_intermodule_singleton.hpp>
  25. #endif
  26. namespace boost{
  27. namespace interprocess{
  28. namespace ipcdetail{
  29. //Now this class is a singleton, initializing the singleton in
  30. //the first get() function call if LazyInit is false. If true
  31. //then the singleton will be initialized when loading the module.
  32. template<typename C, bool LazyInit = true, bool Phoenix = false>
  33. class intermodule_singleton
  34. #ifdef BOOST_INTERPROCESS_WINDOWS
  35. : public windows_intermodule_singleton<C, LazyInit, Phoenix>
  36. #else
  37. : public portable_intermodule_singleton<C, LazyInit, Phoenix>
  38. #endif
  39. {};
  40. } //namespace ipcdetail{
  41. } //namespace interprocess{
  42. } //namespace boost{
  43. #include <boost/interprocess/detail/config_end.hpp>
  44. #endif