Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
flow_info.h
1#pragma once
2
3#include <QString>
4#include <QVector>
5
6#include "config.h"
7#include "idocument.h"
8
9class NodeSaveInfo;
10
14class FlowSaveInfo : public IFlow
15{
16public:
21
27 FlowSaveInfo(const FlowConfig& config);
28
34 QString getid() const override;
35
41 QString getname() const override;
42
48 QString getowner() const override;
49
55 bool getmodifiable() const override;
56
62 int getlinksTo() const override;
63
69 Types::CallType gettype() const override;
70
76 koda::types::TypeReference getreturnType() const override;
77
83 QVector<std::shared_ptr<IParameter>> getarguments() const override;
84
90 QVector<std::shared_ptr<INode>> getnodes() const override;
91
96 QVector<std::shared_ptr<ITransition>> gettransitions() const override;
97
103 QVector<std::shared_ptr<ITransition>> gettransitions(const QString& id) const override;
104
105 void addTransition(std::shared_ptr<ITransition> transition);
106
107 void removeTransition(std::shared_ptr<ITransition> transition);
108
114 void setId(const QString& arg);
115
121 void setName(const QString& arg);
122
128 void setOwner(const QString& arg);
129
135 void setModifiable(bool arg);
136
142 void setLinksTo(int arg);
143
149 void setType(Types::CallType arg);
150
156 void setReturnType(const koda::types::TypeReference& arg);
157
163 void addArgument(std::shared_ptr<IParameter> arg);
164
171 void setArgument(uint32_t index, std::shared_ptr<IParameter> arg);
172
179 std::shared_ptr<IParameter> getArgument(uint32_t index);
180
186 void removeArgument(std::shared_ptr<IParameter> arg);
187
193 void addNode(std::shared_ptr<INode> arg);
194
200 void removeNode(std::shared_ptr<INode> arg);
201
207 QJsonObject toJson() const;
208
215 static FlowSaveInfo fromJson(const QJsonObject& data);
216
224 friend QDataStream& operator<<(QDataStream& out, const FlowSaveInfo& info);
225
233 friend QDataStream& operator>>(QDataStream& in, FlowSaveInfo& info);
234
235private:
236 QString mId;
237 QString mName;
238 QString mOwner;
241
242 Types::CallType mType;
243 koda::types::TypeReference mReturnType;
244 QVector<std::shared_ptr<INode>> mNodes;
245 QVector<std::shared_ptr<IParameter>> mArguments;
246 QVector<std::shared_ptr<ITransition>> mTransitions;
247};
248
256QDataStream& operator<<(QDataStream& out, const QVector<std::shared_ptr<FlowSaveInfo>>& nodes);
257
265QDataStream& operator>>(QDataStream& in, QVector<std::shared_ptr<FlowSaveInfo>>& nodes);
266
274QDataStream& operator<<(QDataStream& out, const QVector<std::shared_ptr<IFlow>>& nodes);
275
283QDataStream& operator>>(QDataStream& in, QVector<std::shared_ptr<IFlow>>& nodes);
Configuration for a flow or process.
Definition config.h:70
void addNode(std::shared_ptr< INode > arg)
Adds a node to the flow.
Definition flow_info.cpp:165
void removeArgument(std::shared_ptr< IParameter > arg)
Removes an argument from the flow.
Definition flow_info.cpp:160
void removeNode(std::shared_ptr< INode > arg)
Removes a node from the flow.
Definition flow_info.cpp:178
QString getowner() const override
Gets the owner of the flow.
Definition flow_info.cpp:50
void setArgument(uint32_t index, std::shared_ptr< IParameter > arg)
Sets an argument at a specific index in the flow.
Definition flow_info.cpp:145
bool mModifiable
The owner of the flow.
Definition flow_info.h:239
QString mName
The ID of the flow.
Definition flow_info.h:237
QVector< std::shared_ptr< IParameter > > mArguments
A vector of shared pointers to INode objects representing the nodes.
Definition flow_info.h:245
friend QDataStream & operator>>(QDataStream &in, FlowSaveInfo &info)
Overloads the >> operator to deserialize a FlowSaveInfo object from a QDataStream.
Definition flow_info.cpp:317
FlowSaveInfo()
Constructs an empty FlowSaveInfo object.
Definition flow_info.cpp:15
QString getname() const override
Gets the name of the flow.
Definition flow_info.cpp:45
QVector< std::shared_ptr< IParameter > > getarguments() const override
Gets the arguments of the flow.
Definition flow_info.cpp:75
void setOwner(const QString &arg)
Sets the owner of the flow.
Definition flow_info.cpp:120
void setReturnType(const koda::types::TypeReference &arg)
Sets the return type of the property.
Definition flow_info.cpp:140
int mLinksTo
Whether the flow is modifiable.
Definition flow_info.h:240
void setId(const QString &arg)
Sets the ID of the flow.
Definition flow_info.cpp:110
int getlinksTo() const override
Gets the number of links to the flow.
Definition flow_info.cpp:65
QString mOwner
The name of the flow.
Definition flow_info.h:238
bool getmodifiable() const override
Checks if the flow is modifiable.
Definition flow_info.cpp:55
friend QDataStream & operator<<(QDataStream &out, const FlowSaveInfo &info)
Overloads the << operator to serialize a FlowSaveInfo object to a QDataStream.
Definition flow_info.cpp:300
QVector< std::shared_ptr< ITransition > > gettransitions() const override
Gets the transitions of the flow.
Definition flow_info.cpp:85
void setName(const QString &arg)
Sets the name of the flow.
Definition flow_info.cpp:115
QVector< std::shared_ptr< INode > > getnodes() const override
Gets the nodes of the flow.
Definition flow_info.cpp:80
koda::types::TypeReference mReturnType
The type of the call.
Definition flow_info.h:243
QVector< std::shared_ptr< INode > > mNodes
The return type of the property.
Definition flow_info.h:244
koda::types::TypeReference getreturnType() const override
Gets the return type of the property.
Definition flow_info.cpp:70
void addArgument(std::shared_ptr< IParameter > arg)
Adds an argument to the flow.
Definition flow_info.cpp:155
void setLinksTo(int arg)
Sets the number of links to the flow.
Definition flow_info.cpp:130
static FlowSaveInfo fromJson(const QJsonObject &data)
Creates a FlowSaveInfo object from a JSON object.
Definition flow_info.cpp:218
QVector< std::shared_ptr< ITransition > > mTransitions
A vector of shared pointers to IParameter objects representing the arguments.
Definition flow_info.h:246
Types::CallType mType
The number of links to the flow.
Definition flow_info.h:242
QString getid() const override
Gets the ID of the flow.
Definition flow_info.cpp:40
std::shared_ptr< IParameter > getArgument(uint32_t index)
Gets an argument at a specific index in the flow.
Definition flow_info.cpp:150
QJsonObject toJson() const
Converts the flow save info to a JSON object.
Definition flow_info.cpp:185
void setType(Types::CallType arg)
Sets the type of the call.
Definition flow_info.cpp:135
Types::CallType gettype() const override
Gets the type of the call.
Definition flow_info.cpp:60
void setModifiable(bool arg)
Sets whether the flow is modifiable.
Definition flow_info.cpp:125
Represents a node that can be saved and loaded.
Definition node_info.h:17