38 lines
1000 B
C
38 lines
1000 B
C
|
|
/**
|
|||
|
|
* @file EqpmShm.h
|
|||
|
|
* @brief 共享内存 map,用于将后台规则数据提供给页面使用
|
|||
|
|
* @author your name (you@domain.com)
|
|||
|
|
* @version 0.1
|
|||
|
|
* @date 2023-10-18
|
|||
|
|
*
|
|||
|
|
* Copyright: Baosight Co. Ltd.
|
|||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|||
|
|
*
|
|||
|
|
*/
|
|||
|
|
#pragma once
|
|||
|
|
#include <mutex>
|
|||
|
|
#include "shm_header.h"
|
|||
|
|
namespace EqpmShm {
|
|||
|
|
|
|||
|
|
using namespace ShmHeader;
|
|||
|
|
|
|||
|
|
const static std::string dir_path = "/users/dsc/shm";
|
|||
|
|
const static std::string shm_file = "EqpmRecord"; ///<映射文件名
|
|||
|
|
const static std::string int_file = "Eqpmtime"; ///<映射文件名
|
|||
|
|
const double data_size = 500; ///< 数据大小 MB
|
|||
|
|
|
|||
|
|
static managed_mapped_file_t obj_mapped_file(
|
|||
|
|
bipc::open_or_create, (dir_path + "/" + shm_file + "_boost.mmap").c_str(),
|
|||
|
|
mix_cc::data_size::MB(data_size));
|
|||
|
|
|
|||
|
|
static void_allocator default_allocator(
|
|||
|
|
obj_mapped_file.get_segment_manager()); ///<默认分配器
|
|||
|
|
|
|||
|
|
///<定义数据
|
|||
|
|
struct EqpmRecord {
|
|||
|
|
int64_t stime;
|
|||
|
|
int64_t etime;
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} // namespace EqpmShm
|