Maki
Formally verified 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:
20 explicit FlowSaveInfo();
21
27 explicit FlowSaveInfo(const FlowConfig& config);
28
29 void print(const QString& indent = "") const;
30
36 QString getid() const override;
37
43 QString getname() const override;
44
50 QString getowner() const override;
51
57 bool getmodifiable() const override;
58
64 int getlinksTo() const override;
65
71 Types::CallType gettype() const override;
72
78 koda::types::TypeReference getreturnType() const override;
79
85 QVector<std::shared_ptr<IParameter>> getarguments() const override;
86
92 QVector<std::shared_ptr<INode>> getnodes() const override;
93
98 QVector<std::shared_ptr<ITransition>> gettransitions() const override;
99
105 QVector<std::shared_ptr<ITransition>> gettransitions(const QString& id) const override;
106
107 void addTransition(std::shared_ptr<ITransition> transition);
108
109 void removeTransition(const QString& transitionId);
110
116 void setId(const QString& arg);
117
123 void setName(const QString& arg);
124
130 void setOwner(const QString& arg);
131
137 void setModifiable(bool arg);
138
144 void setLinksTo(int arg);
145
151 void setType(Types::CallType arg);
152
158 void setReturnType(const koda::types::TypeReference& arg);
159
165 void addArgument(std::shared_ptr<IParameter> arg);
166
173 void setArgument(uint32_t index, std::shared_ptr<IParameter> arg);
174
181 std::shared_ptr<IParameter> getArgument(uint32_t index);
182
188 void removeArgument(std::shared_ptr<IParameter> arg);
189
195 void addNode(std::shared_ptr<INode> arg);
196
202 void removeNode(const QString& nodeId);
203
209 QJsonObject toJson() const;
210
217 static FlowSaveInfo fromJson(const QJsonObject& data);
218
226 friend QDataStream& operator<<(QDataStream& out, const FlowSaveInfo& info);
227
235 friend QDataStream& operator>>(QDataStream& in, FlowSaveInfo& info);
236
237private:
238 friend class DocumentCloner;
239
240 QString mId;
241 QString mName;
242 QString mOwner;
245
246 Types::CallType mType;
247 koda::types::TypeReference mReturnType;
248 QVector<std::shared_ptr<INode>> mNodes;
249 QVector<std::shared_ptr<IParameter>> mArguments;
250 QVector<std::shared_ptr<ITransition>> mTransitions;
251};
252
260QDataStream& operator<<(QDataStream& out, const QVector<std::shared_ptr<FlowSaveInfo>>& nodes);
261
269QDataStream& operator>>(QDataStream& in, QVector<std::shared_ptr<FlowSaveInfo>>& nodes);
270
278QDataStream& operator<<(QDataStream& out, const QVector<std::shared_ptr<IFlow>>& nodes);
279
287QDataStream& operator>>(QDataStream& in, QVector<std::shared_ptr<IFlow>>& nodes);
288
289typedef std::shared_ptr<FlowSaveInfo> PFlowSaveInfo;
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:206
void removeArgument(std::shared_ptr< IParameter > arg)
Removes an argument from the flow.
Definition flow_info.cpp:197
QString getowner() const override
Gets the owner of the flow.
Definition flow_info.cpp:68
void setArgument(uint32_t index, std::shared_ptr< IParameter > arg)
Sets an argument at a specific index in the flow.
Definition flow_info.cpp:174
bool mModifiable
The owner of the flow.
Definition flow_info.h:243
QString mName
The ID of the flow.
Definition flow_info.h:241
QVector< std::shared_ptr< IParameter > > mArguments
A vector of shared pointers to INode objects representing the nodes.
Definition flow_info.h:249
friend QDataStream & operator>>(QDataStream &in, FlowSaveInfo &info)
Overloads the >> operator to deserialize a FlowSaveInfo object from a QDataStream.
Definition flow_info.cpp:372
FlowSaveInfo()
Constructs an empty FlowSaveInfo object.
Definition flow_info.cpp:18
QString getname() const override
Gets the name of the flow.
Definition flow_info.cpp:63
QVector< std::shared_ptr< IParameter > > getarguments() const override
Gets the arguments of the flow.
Definition flow_info.cpp:93
void setOwner(const QString &arg)
Sets the owner of the flow.
Definition flow_info.cpp:149
void setReturnType(const koda::types::TypeReference &arg)
Sets the return type of the property.
Definition flow_info.cpp:169
int mLinksTo
Whether the flow is modifiable.
Definition flow_info.h:244
void setId(const QString &arg)
Sets the ID of the flow.
Definition flow_info.cpp:139
int getlinksTo() const override
Gets the number of links to the flow.
Definition flow_info.cpp:83
void removeNode(const QString &nodeId)
Removes a node from the flow.
Definition flow_info.cpp:226
QString mOwner
The name of the flow.
Definition flow_info.h:242
bool getmodifiable() const override
Checks if the flow is modifiable.
Definition flow_info.cpp:73
friend QDataStream & operator<<(QDataStream &out, const FlowSaveInfo &info)
Overloads the << operator to serialize a FlowSaveInfo object to a QDataStream.
Definition flow_info.cpp:355
QVector< std::shared_ptr< ITransition > > gettransitions() const override
Gets the transitions of the flow.
Definition flow_info.cpp:103
void setName(const QString &arg)
Sets the name of the flow.
Definition flow_info.cpp:144
QVector< std::shared_ptr< INode > > getnodes() const override
Gets the nodes of the flow.
Definition flow_info.cpp:98
koda::types::TypeReference mReturnType
The type of the call.
Definition flow_info.h:247
QVector< std::shared_ptr< INode > > mNodes
The return type of the property.
Definition flow_info.h:248
koda::types::TypeReference getreturnType() const override
Gets the return type of the property.
Definition flow_info.cpp:88
void addArgument(std::shared_ptr< IParameter > arg)
Adds an argument to the flow.
Definition flow_info.cpp:188
void setLinksTo(int arg)
Sets the number of links to the flow.
Definition flow_info.cpp:159
static FlowSaveInfo fromJson(const QJsonObject &data)
Creates a FlowSaveInfo object from a JSON object.
Definition flow_info.cpp:273
QVector< std::shared_ptr< ITransition > > mTransitions
A vector of shared pointers to IParameter objects representing the arguments.
Definition flow_info.h:250
Types::CallType mType
The number of links to the flow.
Definition flow_info.h:246
QString getid() const override
Gets the ID of the flow.
Definition flow_info.cpp:58
std::shared_ptr< IParameter > getArgument(uint32_t index)
Gets an argument at a specific index in the flow.
Definition flow_info.cpp:183
QJsonObject toJson() const
Converts the flow save info to a JSON object.
Definition flow_info.cpp:240
void setType(Types::CallType arg)
Sets the type of the call.
Definition flow_info.cpp:164
Types::CallType gettype() const override
Gets the type of the call.
Definition flow_info.cpp:78
void setModifiable(bool arg)
Sets whether the flow is modifiable.
Definition flow_info.cpp:154
Represents a node that can be saved and loaded.
Definition node_info.h:16