Fixed a bug in the Del_Link method where node connection deletion failed when source id and target id were swapped. && Added a Get_Socket_Str method to the base connector class, allowing external code to query the socket to determine whether a connection is allowed. && Added a boolean-type connector. && Input connectors can now be initialized to exclusive input mode, meaning that an input connector of this type allows only one input at a time, establishing a new connection will disconnect the existing one. && Added a message filter node that allows incoming messages to pass through when the input conditions are met.

This commit is contained in:
2026-05-18 19:48:22 +08:00
parent 68fba7efd5
commit 35636fd438
3 changed files with 374 additions and 39 deletions
+61 -6
View File
@@ -16,10 +16,11 @@ class Abs_Connector // 抽象接口类
public:
typedef enum
{
CONNECTOR_TYPE_UNKNOWN, // 未知连接点类型
CONNECTOR_TYPE_OUTPUT, // 输出
CONNECTOR_TYPE_INPUT, // 输入
} Connector_Type_Enum; // 接口类型枚举
CONNECTOR_TYPE_UNKNOWN, // 未知连接点类型
CONNECTOR_TYPE_OUTPUT, // 输出
CONNECTOR_TYPE_INPUT, // 输入
CONNECTOR_TYPE_INPUT_EXCLUSIVE, // 独占输入,新连接必须断开旧连接
} Connector_Type_Enum; // 接口类型枚举
typedef struct
{
@@ -80,6 +81,9 @@ public:
// 获取接口类型
virtual Connector_Type_Enum Get_Type(void);
// 获取套接字字符串
virtual const char *Get_Socket_Str(void);
// 绘制连接点
virtual void Show(void) = 0;
};
@@ -94,6 +98,7 @@ public:
NODE_TYPE_UNKNOWN, // 未知节点类型
NODE_TYPE_CONNECTOR_TEST, // 接口测试节点
NODE_TYPE_MSG_LINE_INPUT, // 消息输入节点
NODE_TYPE_FILTER, // 筛选器节点
NODE_TYPE_CSV_EXPORTER, // CSV输出节点
} Node_Type_Enum; // 节点类型枚举
@@ -151,6 +156,34 @@ public:
// ====================================接口类声明================================================
// Boolean 状态输出接口
class Boolean_OutPut_Connector : public Abs_Connector
{
public:
// 显式禁用默认构造
Boolean_OutPut_Connector() = delete;
// 必要构造
explicit Boolean_OutPut_Connector(Independent_ID_Generator *ID_Generator);
// 绘制接口
virtual void Show(void);
};
// Boolean 状态输入接口
class Boolean_InPut_Connector : public Abs_Connector
{
public:
// 显式禁用默认构造
Boolean_InPut_Connector() = delete;
// 必要构造
explicit Boolean_InPut_Connector(Independent_ID_Generator *ID_Generator, bool exclusive_flag = false);
// 绘制接口
virtual void Show(void);
};
// DLT信息输出接口
class MSG_OutPut_Connector : public Abs_Connector
{
@@ -173,7 +206,7 @@ public:
MSG_InPut_Connector() = delete;
// 必要构造
explicit MSG_InPut_Connector(Independent_ID_Generator *ID_Generator);
explicit MSG_InPut_Connector(Independent_ID_Generator *ID_Generator, bool exclusive_flag = false);
// 绘制接口
virtual void Show(void);
@@ -187,7 +220,7 @@ public:
CSV_Column_Input_Connector() = delete;
// 必要构造
explicit CSV_Column_Input_Connector(Independent_ID_Generator *ID_Generator);
explicit CSV_Column_Input_Connector(Independent_ID_Generator *ID_Generator, bool exclusive_flag = false);
// 绘制接口
virtual void Show(void);
@@ -266,4 +299,26 @@ public:
virtual bool Execute_Process(void);
};
// 筛选器节点
class Filter_Node : public Abs_Node
{
private:
float node_width = 0;
public:
// 显式禁用默认构造
Filter_Node() = delete;
// 必要构造
Filter_Node(Independent_ID_Generator *Node_ID_Generator,
Independent_ID_Generator *Connector_ID_Generator,
ImVec2 initial_position = ImVec2(0, 0));
// 绘制节点
virtual void Show(void);
// 执行处理流程
virtual bool Execute_Process(void);
};
#endif