实现策略配置功能

This commit is contained in:
lixiaoyuan
2025-08-28 18:42:37 +08:00
parent 8f6c83147b
commit dda905cda0
47 changed files with 1311 additions and 863 deletions

34
src/protocol/CommEntity.h Normal file
View File

@@ -0,0 +1,34 @@
#pragma once
#include <memory>
#include <string>
#include "common/Fields.h"
class CommEntity
{
public:
CommEntity() {}
CommEntity(std::string type) : type(type) {}
static std::shared_ptr<CommEntity> create(Fields& data);
void setType(std::string type) { this->type = type; }
// 启动通讯连接
virtual int start() { return 0; };
// 关闭通讯连接
virtual void close() { isCloseRequest_ = true; };
std::string id() { return id_; }
bool isAlive() { return isAlive_; }
bool isConnected() { return isConnected_; }
public:
std::string id_;
bool isAlive_ = false;
bool isConnected_ = false;
bool isCloseRequest_ = false;
std::string type;
};