#pragma once #include namespace EqpmShm { namespace SHM = mix_cc::shm; namespace bipc = mix_cc::shm::bip; const static std::string dir_path = "/users/dsc/shm"; const static std::string shm_file = "EqpmRecord"; ///<映射文件名 const double data_size = 500; ///< 数据大小 MB static bipc::managed_mapped_file obj_mapped_file( bipc::open_or_create, (dir_path + "/" + shm_file + "_boost.mmap").c_str(), mix_cc::data_size::MB(data_size)); /** * @brief 每日的长度、重量 */ struct EqpmRecord { double weight; double length; }; /** * @brief 记录的开始时间,结束时间 */ struct TimeRecord { int stime; int etime; }; /*单例 map 记录每天的重量 长度*/ const static bipc::offset_ptr> EqpmRecordPtr = SHM::MapBuilder::find_or_construct(&obj_mapped_file, shm_file); /*单例 TimeRecord 保持 记录的起止时间*/ const static bipc::offset_ptr TimeRecordPtr = obj_mapped_file.find_or_construct("TimeRecord")(); } // namespace EqpmShm