From 00fd95526677d670d002ca81069636f0f74b91f7 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 28 Apr 2021 15:18:51 -0700 Subject: Code cleanup, fix database view paging and selection --- core/src/Model/Workflow/Workflow.hpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'core/src/Model/Workflow/Workflow.hpp') diff --git a/core/src/Model/Workflow/Workflow.hpp b/core/src/Model/Workflow/Workflow.hpp index db341af..139a96e 100644 --- a/core/src/Model/Workflow/Workflow.hpp +++ b/core/src/Model/Workflow/Workflow.hpp @@ -113,7 +113,7 @@ public: static const char* FormatType(Type type); static std::unique_ptr CreateByKind(Kind kind); - WorkflowNode(Type type, Kind kind); + WorkflowNode(Kind kind); virtual ~WorkflowNode() = default; WorkflowNode(const WorkflowNode&) = delete; @@ -179,10 +179,24 @@ private: bool mDepthsDirty = true; public: + /* Graph access */ + + const std::vector& GetConnections() const; + std::vector& GetConnections(); + const std::vector>& GetNodes() const; + std::vector>& GetNodes(); + const std::vector>& GetConstants() const; + std::vector>& GetConstants(); + WorkflowConnection* GetConnectionById(size_t id); WorkflowNode* GetStepById(size_t id); BaseValue* GetConstantById(size_t id); + const std::vector>& GetDepthGroups() const; + bool DoesDepthNeedsUpdate() const; + + /* Graph mutation */ + void AddStep(std::unique_ptr step); void RemoveStep(size_t id); @@ -192,8 +206,7 @@ public: bool DisconnectBySource(WorkflowNode& sourceNode, int sourcePin); bool DisconnectByDestination(WorkflowNode& destinationNode, int destinationPin); - const std::vector>& GetDepthGroups() const; - bool DoesDepthNeedsUpdate() const; + /* Graph rebuild */ struct GraphUpdate_Success {}; struct GraphUpdate_NoWorkToDo {}; @@ -213,6 +226,8 @@ public: /// When `getInfo == false, the corresponding error code is returned but without/with empty payloads. GraphUpdateResult UpdateGraph(bool getInfo = true); + /* Serialization */ + enum ReadResult { ReadSuccess, ReadInvalidVersion, -- cgit v1.2.3-70-g09d2