aboutsummaryrefslogtreecommitdiff
path: root/app/source/Cplt/Model/Workflow/Evaluation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/source/Cplt/Model/Workflow/Evaluation.cpp')
-rw-r--r--app/source/Cplt/Model/Workflow/Evaluation.cpp51
1 files changed, 17 insertions, 34 deletions
diff --git a/app/source/Cplt/Model/Workflow/Evaluation.cpp b/app/source/Cplt/Model/Workflow/Evaluation.cpp
index 7035bf9..fc5f661 100644
--- a/app/source/Cplt/Model/Workflow/Evaluation.cpp
+++ b/app/source/Cplt/Model/Workflow/Evaluation.cpp
@@ -2,16 +2,14 @@
#include <queue>
-const char* WorkflowEvaluationError::FormatMessageType(enum MessageType messageType)
-{
+const char* WorkflowEvaluationError::FormatMessageType(enum MessageType messageType) {
switch (messageType) {
case Error: return "Error";
case Warning: return "Warning";
}
}
-const char* WorkflowEvaluationError::FormatPinType(enum PinType pinType)
-{
+const char* WorkflowEvaluationError::FormatPinType(enum PinType pinType) {
switch (pinType) {
case NoPin: return nullptr;
case InputPin: return "Input pin";
@@ -19,8 +17,7 @@ const char* WorkflowEvaluationError::FormatPinType(enum PinType pinType)
}
}
-std::string WorkflowEvaluationError::Format() const
-{
+std::string WorkflowEvaluationError::Format() const {
// TODO convert to std::format
std::string result;
@@ -39,10 +36,8 @@ std::string WorkflowEvaluationError::Format() const
return result;
}
-struct WorkflowEvaluationContext::RuntimeNode
-{
- enum EvaluationStatus
- {
+struct WorkflowEvaluationContext::RuntimeNode {
+ enum EvaluationStatus {
ST_Unevaluated,
ST_Success,
ST_Failed,
@@ -51,25 +46,21 @@ struct WorkflowEvaluationContext::RuntimeNode
EvaluationStatus Status = ST_Unevaluated;
};
-struct WorkflowEvaluationContext::RuntimeConnection
-{
+struct WorkflowEvaluationContext::RuntimeConnection {
std::unique_ptr<BaseValue> Value;
- bool IsAvailableValue() const
- {
+ bool IsAvailableValue() const {
return Value != nullptr;
}
};
WorkflowEvaluationContext::WorkflowEvaluationContext(Workflow& workflow)
- : mWorkflow{ &workflow }
-{
+ : mWorkflow{ &workflow } {
mRuntimeNodes.resize(workflow.mNodes.size());
mRuntimeConnections.resize(workflow.mConnections.size());
}
-BaseValue* WorkflowEvaluationContext::GetConnectionValue(size_t id, bool constant)
-{
+BaseValue* WorkflowEvaluationContext::GetConnectionValue(size_t id, bool constant) {
if (constant) {
return mWorkflow->GetConstantById(id);
} else {
@@ -77,8 +68,7 @@ BaseValue* WorkflowEvaluationContext::GetConnectionValue(size_t id, bool constan
}
}
-BaseValue* WorkflowEvaluationContext::GetConnectionValue(const WorkflowNode::InputPin& inputPin)
-{
+BaseValue* WorkflowEvaluationContext::GetConnectionValue(const WorkflowNode::InputPin& inputPin) {
if (inputPin.IsConnected()) {
return GetConnectionValue(inputPin.Connection, inputPin.IsConstantConnection());
} else {
@@ -86,20 +76,17 @@ BaseValue* WorkflowEvaluationContext::GetConnectionValue(const WorkflowNode::Inp
}
}
-void WorkflowEvaluationContext::SetConnectionValue(size_t id, std::unique_ptr<BaseValue> value)
-{
+void WorkflowEvaluationContext::SetConnectionValue(size_t id, std::unique_ptr<BaseValue> value) {
mRuntimeConnections[id].Value = std::move(value);
}
-void WorkflowEvaluationContext::SetConnectionValue(const WorkflowNode::OutputPin& outputPin, std::unique_ptr<BaseValue> value)
-{
+void WorkflowEvaluationContext::SetConnectionValue(const WorkflowNode::OutputPin& outputPin, std::unique_ptr<BaseValue> value) {
if (outputPin.IsConnected()) {
SetConnectionValue(outputPin.Connection, std::move(value));
}
}
-void WorkflowEvaluationContext::Run()
-{
+void WorkflowEvaluationContext::Run() {
int evaluatedCount = 0;
int erroredCount = 0;
@@ -129,8 +116,7 @@ void WorkflowEvaluationContext::Run()
}
}
-void WorkflowEvaluationContext::ReportError(std::string message, const WorkflowNode& node, int pinId, bool inputPin)
-{
+void WorkflowEvaluationContext::ReportError(std::string message, const WorkflowNode& node, int pinId, bool inputPin) {
mErrors.push_back(WorkflowEvaluationError{
.Message = std::move(message),
.NodeId = node.GetId(),
@@ -140,8 +126,7 @@ void WorkflowEvaluationContext::ReportError(std::string message, const WorkflowN
});
}
-void WorkflowEvaluationContext::ReportError(std::string message, const WorkflowNode& node)
-{
+void WorkflowEvaluationContext::ReportError(std::string message, const WorkflowNode& node) {
mErrors.push_back(WorkflowEvaluationError{
.Message = std::move(message),
.NodeId = node.GetId(),
@@ -151,8 +136,7 @@ void WorkflowEvaluationContext::ReportError(std::string message, const WorkflowN
});
}
-void WorkflowEvaluationContext::ReportWarning(std::string message, const WorkflowNode& node, int pinId, bool inputPin)
-{
+void WorkflowEvaluationContext::ReportWarning(std::string message, const WorkflowNode& node, int pinId, bool inputPin) {
mErrors.push_back(WorkflowEvaluationError{
.Message = std::move(message),
.NodeId = node.GetId(),
@@ -162,8 +146,7 @@ void WorkflowEvaluationContext::ReportWarning(std::string message, const Workflo
});
}
-void WorkflowEvaluationContext::ReportWarning(std::string message, const WorkflowNode& node)
-{
+void WorkflowEvaluationContext::ReportWarning(std::string message, const WorkflowNode& node) {
mErrors.push_back(WorkflowEvaluationError{
.Message = std::move(message),
.NodeId = node.GetId(),