#include#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //std::pair #include //std::memset #include //std::bad_alloc #include //std::logic_error namespace boost { namespace interprocess { inline void assert_not_copyable(const char* kind_of_derived) { (void)kind_of_derived; // avoid a warning BOOST_STATIC_ASSERT_MSG(!boost::type_traits::ice_or< boost::is_copy_constructible ::value, boost::is_copy_assignable ::value>::value, "Managed memory derived class requires that its derived class is non-copyable. Inherit privately from boost::interprocess::detail::non_copyable"); } inline const char *get_shared_memory_error(error_code_t error_code) { switch(error_code){ case already_exists_error: return "Already exists"; case not_found_error: return "Not found"; case no_such_process_error: return "No such process"; case permission_denied_error: return "Permission denied"; case size_error: return "Size error"; case no_free_handles_error: return "No free handles"; case no_memory_error: return "No memory"; case no_resources_error: return "No resources"; case invalid_argument_error: return "Invalid argument"; case not_supported_error: return "Not supported"; default: break; } return "Unknown error code"; } inline void throw_shared_exception(error_code_t error_code) { static const std::string TEMPLATE_ERROR_MSG = std::string("boost::interprocess_exception::") + std::string("[%d] %s"); std::string error_msg(boost::interprocess::get_shared_memory_error(error_code)); throw interprocess_exception(( error_msg.empty() ? "Unknown boost::interprocess_exception" :( boost::format(TEMPLATE_ERROR_MSG) %error_code%error_msg.c_str() ).str() )); } inline void assert_is_power_2(std::size_t num) { if(!is_power_of_2(num)){ throw interprocess_exception("Size must be a power of two"); } } class null_mutex_family { public: typedef boost::interprocess::detail::interprocess_recursive_mutex interprocess_mutex; typedef boost::interprocess::detail::interprocess_recursive_shared_mutex interprocess_shared_mutex; }; } //namespace interprocess { } //namespace boost { #endif //#ifndef BOOST_INTERPROCESS_FWD_HPP