我是C ++的新手,我不理解这段程序中发生了什么:
class FasterRCNN {
private:
int m_base_model;
std::string m_key_mutex = "";
HANDLE m_mutex = INVALID_HANDLE_VALUE;
std::string m_key_shmem = "";
HANDLE m_shmem = INVALID_HANDLE_VALUE;
DWORD m_size = 0;
char* m_buffer = nullptr;
std::vector<std::string> m_class_map;
public:
void Create(int base_model, std::string model_path, std::string classfile, DWORD size = 10000, float filter_threshold = 0.4F) {
m_base_model = base_model;
m_key_shmem = this->GetKey() + "_shmem";
m_key_mutex = this->GetKey() + "_mutex";
m_size = size;
m_mutex = ::CreateMutexA(nullptr, FALSE, m_key_mutex.c_str());
m_shmem = ::CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, m_size, m_key_shmem.c_str());
m_buffer = (char*)::MapViewOfFile(m_shmem, FILE_MAP_ALL_ACCESS, 0, 0, m_size);
m_buffer[0] = 0;
我不明白 m_buffer 是如何在最后几行获得它的值的。 我知道:
m_buffer [0]类似于标志:
// 0 =负载模型
// 1 =发送图片路径
// 2 =检测
// 3 =接收
// 9 =终止信号
我可以通过使用线程窗口来理解吗?