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);
55SCORE_PLUGIN_SCENARIO_EXPORT
56void restoreCablesWithoutTouchingPorts(
57 const SerializedCables& cbls, const score::DocumentContext& ctx);
58
61SCORE_PLUGIN_SCENARIO_EXPORT
62void loadCables(
63 const ObjectPath& old_path, const ObjectPath& new_path,
64 Dataflow::SerializedCables& cables, const score::DocumentContext& ctx);
65
70SCORE_PLUGIN_SCENARIO_EXPORT
71void unstripCables(const ObjectPath& new_path, Dataflow::SerializedCables& cables);
72
74{
75 QString name;
76 Process::PortType type;
77 QByteArray data;
78};
79
83SCORE_PLUGIN_SCENARIO_EXPORT
84void reloadPortsInNewProcess(
85 const std::vector<SavedPort>& m_oldInlets,
86 const std::vector<SavedPort>& m_oldOutlets,
87 const Dataflow::SerializedCables& m_oldCables, Process::ProcessModel& cmt,
88 const score::DocumentContext& ctx);
89
91SCORE_PLUGIN_SCENARIO_EXPORT
92void reloadPortsInNewProcess(
93 const std::vector<SavedPort>& m_oldInlets,
94 const std::vector<SavedPort>& m_oldOutlets, Process::ProcessModel& cmt);
95}
96
97template <>
98struct is_custom_serialized<Dataflow::SavedPort> : std::true_type
99{
100};
101
102template <>
103struct TSerializer<DataStream, Dataflow::SavedPort>
104{
105 static void readFrom(DataStream::Serializer& s, const Dataflow::SavedPort& tv)
106 {
107 s.stream() << tv.name << tv.type << tv.data;
108 }
109
110 static void writeTo(DataStream::Deserializer& s, Dataflow::SavedPort& tv)
111 {
112 s.stream() >> tv.name >> tv.type >> tv.data;
113 }
114};
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:74
Definition CableData.hpp:18
Definition VisitorInterface.hpp:13
Definition DocumentContext.hpp:18