实现策略配置功能

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

View File

@@ -1,7 +1,7 @@
#include "Communicator.h"
#include "CommEntity.h"
#include "TcpEntity.h"
std::shared_ptr<CommEntity> Communicator::createEntity(Fields& data)
std::shared_ptr<CommEntity> CommEntity::create(Fields& data)
{
std::string commType = data.value("commType");
std::string ip = data.value("ip");

View File

@@ -11,6 +11,8 @@ public:
CommEntity() {}
CommEntity(std::string type) : type(type) {}
static std::shared_ptr<CommEntity> create(Fields& data);
void setType(std::string type) { this->type = type; }
// 启动通讯连接
@@ -30,10 +32,3 @@ public:
bool isCloseRequest_ = false;
std::string type;
};
class Communicator
{
public:
static std::shared_ptr<CommEntity> createEntity(Fields& data);
};

View File

@@ -7,7 +7,7 @@
#include <thread>
#include <functional>
#include "Communicator.h"
#include "CommEntity.h"
using namespace std;