#ifndef __WORKFLOW_NODES_HPP__ #define __WORKFLOW_NODES_HPP__ #include "imgui.h" extern "C" { #include "stdint.h" } #include // // 并行工作链 // class Parallel_Working_List // { // private: // // 节点计数 // size_t node_count; // // 内部迭代器 // class iterator // { // }; // public: // iterator begin() { return iterator(arr); } // iterator end() { return iterator(arr + SIZE); } // }; // 节点类型枚举 typedef enum { NODE_TYPE_MSG_LINE_INPUT, // 消息输入节点 NODE_TYPE_CSV_EXPORTER, // CSV输出节点 } NodeType; // 节点基类 class Node_Class { protected: int id; // 节点ID bool initial_state; // 初始状态 ImVec2 initial_position; // 初始位置 public: // 初始化列表构造 explicit Node_Class(int id, ImVec2 initial_position = ImVec2(0, 0)) : id(id), initial_state(true), initial_position(initial_position) {} int getID() { return this->id; } /** * 显示节点并获取状态(子类必须实现) * @param null * @return 0 -> normal : 1-> close */ virtual bool show_and_get_state(void) = 0; virtual ~Node_Class() = default; // 抽象基类必须有虚析构函数 }; // 消息输出节点 class MsgLine_Input_Node_Class : public Node_Class { public: explicit MsgLine_Input_Node_Class(int id, ImVec2 initial_position = ImVec2(0, 0)) : Node_Class(id, initial_position) {}; bool show_and_get_state(void) override; }; // 节点编辑器类 class Workflow_Editor_Class { protected: // 节点列表 std::vector Node_List; public: // 构造函数 Workflow_Editor_Class(); // 析构函数 ~Workflow_Editor_Class(); // 显示工作流节点编辑器 void Show(void); // 新增节点 void Add_Node(NodeType type, ImVec2 initial_position = ImVec2(0, 0)); }; #endif