CableHelpers.hpp
1 #pragma once
2 
3 #include <Process/Dataflow/CableData.hpp>
4 #include <Process/Dataflow/PortType.hpp>
5 
6 #include <ossia/detail/json.hpp>
7 
8 #include <score_plugin_scenario_export.h>
9 
10 #include <vector>
11 
13 namespace Process
14 {
15 class Cable;
16 struct CableData;
17 class ProcessModel;
18 }
19 namespace Dataflow
20 {
21 using SerializedCables = std::vector<std::pair<Id<Process::Cable>, Process::CableData>>;
22 
24 SCORE_PLUGIN_SCENARIO_EXPORT
25 std::vector<Process::Cable*>
26 getCablesInChildObjects(QObjectList objs, const score::DocumentContext& ctx);
27 
29 SCORE_PLUGIN_SCENARIO_EXPORT
30 SerializedCables saveCables(QObjectList objs, const score::DocumentContext& ctx);
31 
34 SCORE_PLUGIN_SCENARIO_EXPORT
35 SerializedCables serializedCablesFromCableJson(
36  const ObjectPath& old_path, const ObjectPath& new_path,
37  const rapidjson::Document::Array& arr);
38 SCORE_PLUGIN_SCENARIO_EXPORT
39 SerializedCables serializedCablesFromCableJson(
40  const ObjectPath& old_path, const rapidjson::Document::Array& arr);
41 
43 SCORE_PLUGIN_SCENARIO_EXPORT
44 void removeCables(const SerializedCables& cbls, const score::DocumentContext& ctx);
45 
48 SCORE_PLUGIN_SCENARIO_EXPORT
49 void restoreCables(const SerializedCables& cbls, const score::DocumentContext& ctx);
50 
53 SCORE_PLUGIN_SCENARIO_EXPORT
54 void loadCables(
55  const ObjectPath& old_path, const ObjectPath& new_path,
56  Dataflow::SerializedCables& cables, const score::DocumentContext& ctx);
57 
62 SCORE_PLUGIN_SCENARIO_EXPORT
63 void unstripCables(const ObjectPath& new_path, Dataflow::SerializedCables& cables);
64 
65 struct SavedPort
66 {
67  QString name;
68  Process::PortType type;
69  QByteArray data;
70 };
71 
75 SCORE_PLUGIN_SCENARIO_EXPORT
76 void reloadPortsInNewProcess(
77  const std::vector<SavedPort>& m_oldInlets,
78  const std::vector<SavedPort>& m_oldOutlets,
79  const Dataflow::SerializedCables& m_oldCables, Process::ProcessModel& cmt,
80  const score::DocumentContext& ctx);
81 
83 SCORE_PLUGIN_SCENARIO_EXPORT
84 void reloadPortsInNewProcess(
85  const std::vector<SavedPort>& m_oldInlets,
86  const std::vector<SavedPort>& m_oldOutlets, Process::ProcessModel& cmt);
87 }
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:1324
Definition: CableHelpers.hpp:66
Definition: CableData.hpp:18
Definition: DocumentContext.hpp:18