Loading...
Searching...
No Matches
CableHelpers.hpp
1#pragma once
2
3#include <Process/Dataflow/CableData.hpp>
4#include <Process/Dataflow/PortType.hpp>
5
7#include <score/serialization/IsTemplate.hpp>
8
9#include <ossia/detail/json.hpp>
10
11#include <score_plugin_scenario_export.h>
12
13#include <vector>
14
16namespace Process
17{
18class Cable;
19struct CableData;
20class ProcessModel;
21}
22namespace Dataflow
23{
24using SerializedCables = std::vector<std::pair<Id<Process::Cable>, Process::CableData>>;
25
27SCORE_PLUGIN_SCENARIO_EXPORT
28std::vector<Process::Cable*>
29getCablesInChildObjects(QObjectList objs, const score::DocumentContext& ctx);
30
32SCORE_PLUGIN_SCENARIO_EXPORT
33SerializedCables saveCables(QObjectList objs, const score::DocumentContext& ctx);
34
37SCORE_PLUGIN_SCENARIO_EXPORT
38SerializedCables serializedCablesFromCableJson(
39 const ObjectPath& old_path, const ObjectPath& new_path,
40 const rapidjson::Document::Array& arr);
41SCORE_PLUGIN_SCENARIO_EXPORT
42SerializedCables serializedCablesFromCableJson(
43 const ObjectPath& old_path, const rapidjson::Document::Array& arr);
44
46SCORE_PLUGIN_SCENARIO_EXPORT
47void removeCables(const SerializedCables& cbls, const score::DocumentContext& ctx);
48
51SCORE_PLUGIN_SCENARIO_EXPORT
52void restoreCables(const SerializedCables& cbls, const score::DocumentContext& ctx);
53
56SCORE_PLUGIN_SCENARIO_EXPORT
57void loadCables(
58 const ObjectPath& old_path, const ObjectPath& new_path,
59 Dataflow::SerializedCables& cables, const score::DocumentContext& ctx);
60
65SCORE_PLUGIN_SCENARIO_EXPORT
66void unstripCables(const ObjectPath& new_path, Dataflow::SerializedCables& cables);
67
69{
70 QString name;
71 Process::PortType type;
72 QByteArray data;
73};
74
78SCORE_PLUGIN_SCENARIO_EXPORT
79void reloadPortsInNewProcess(
80 const std::vector<SavedPort>& m_oldInlets,
81 const std::vector<SavedPort>& m_oldOutlets,
82 const Dataflow::SerializedCables& m_oldCables, Process::ProcessModel& cmt,
83 const score::DocumentContext& ctx);
84
86SCORE_PLUGIN_SCENARIO_EXPORT
87void reloadPortsInNewProcess(
88 const std::vector<SavedPort>& m_oldInlets,
89 const std::vector<SavedPort>& m_oldOutlets, Process::ProcessModel& cmt);
90}
91
92template <>
93struct is_custom_serialized<Dataflow::SavedPort> : std::true_type
94{
95};
96
97template <>
98struct TSerializer<DataStream, Dataflow::SavedPort>
99{
100 static void readFrom(DataStream::Serializer& s, const Dataflow::SavedPort& tv)
101 {
102 s.stream() << tv.name << tv.type << tv.data;
103 }
104
105 static void writeTo(DataStream::Deserializer& s, Dataflow::SavedPort& tv)
106 {
107 s.stream() >> tv.name >> tv.type >> tv.data;
108 }
109};
Definition VisitorInterface.hpp:53
Definition DataStreamVisitor.hpp:27
Definition DataStreamVisitor.hpp:202
The ObjectPath class.
Definition ObjectPath.hpp:37
The Process class.
Definition score-lib-process/Process/Process.hpp:61
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1115
Definition CableHelpers.hpp:69
Definition CableData.hpp:18
Definition VisitorInterface.hpp:13
Definition DocumentContext.hpp:18