#include namespace mix_cc { namespace shm { namespace utility { maybe get_mapped_path_maybe() { return fp::lift_maybe([](json config_info){ return config_info.at("file_path").get(); },read_config_maybe("utility", "shm")); } bip::managed_mapped_file get_managed_mapped_file( const std::string& file_path, const std::string& mapped_file_name, const data_size_t& size) { return bip::managed_mapped_file( bip::open_or_create, (file_path + "/" + mapped_file_name).c_str(), size); } bool remove_mapped_file(const std::string& file_path, const std::string& file_name) { int ret = 1; if (!boost::filesystem::remove(file_path + file_name)) { ret = 0; if (!bip::file_mapping::remove((file_path + file_name).c_str())) { ret = -1; } } return ret; } bip::managed_shared_memory get_managed_memory_segment( const std::string& segment_name, const data_size_t& size) { return bip::managed_shared_memory(bip::open_or_create, segment_name.c_str(), size); } } // namespace utility } // namespace shm } // namespace mix_cc