Loading...
Searching...
No Matches
Cable.hpp
1#pragma once
2#include <State/Address.hpp>
3
4#include <Process/Dataflow/CableData.hpp>
5
6#include <score/model/IdentifiedObject.hpp>
7#include <score/model/path/Path.hpp>
8#include <score/selection/Selectable.hpp>
9
10#include <score_lib_process_export.h>
11
12#include <verdigris>
13
14namespace ossia
15{
16class graph_node;
17struct outlet;
18struct inlet;
19struct graph_edge;
20using node_ptr = std::shared_ptr<graph_node>;
21using outlet_ptr = outlet*;
22using inlet_ptr = inlet*;
23using edge_ptr = std::shared_ptr<graph_edge>;
24}
25namespace Dataflow
26{
27class DocumentPlugin;
28}
29namespace Process
30{
31class Node;
32class Port;
33class Outlet;
34class Inlet;
35class Cable;
36
37class SCORE_LIB_PROCESS_EXPORT Cable final : public IdentifiedObject<Cable>
38{
39 W_OBJECT(Cable)
40 SCORE_SERIALIZE_FRIENDS
41
42public:
43 Selectable selection{this};
44 Cable() = delete;
45 ~Cable();
46 Cable(const Cable&) = delete;
47 Cable(Id<Cable> c, QObject* parent);
48
49 template <typename T>
50 Cable(T&& vis, QObject* parent)
51 : IdentifiedObject{vis, parent}
52 {
53 vis.writeTo(*this);
54 }
55 Cable(Id<Cable> c, const CableData& data, QObject* parent);
56
57 void update(const CableData&);
58
59 CableData toCableData() const;
60
61 CableType type() const;
62 Path<Process::Outlet> source() const;
63 Path<Process::Inlet> sink() const;
64
65 void setType(CableType type);
66 void resetCache() const noexcept override;
67
68public:
69 void typeChanged(CableType type) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, typeChanged, type)
70
71private:
72 CableType m_type{};
73 Path<Process::Outlet> m_source;
75
76 W_PROPERTY(Path<Process::Inlet>, sink READ sink)
77
78 W_PROPERTY(Path<Process::Outlet>, source READ source)
79
80 W_PROPERTY(CableType, type READ type WRITE setType NOTIFY typeChanged)
81};
82}
83
84DEFAULT_MODEL_METADATA(Process::Cable, "Cable")
85
86W_REGISTER_ARGTYPE(Id<Process::Cable>)
87W_REGISTER_ARGTYPE(Process::CableType)
The IdentifiedObject class.
Definition IdentifiedObject.hpp:19
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition Cable.hpp:38
The Selectable class.
Definition Selectable.hpp:14
The id_base_t class.
Definition Identifier.hpp:57
TreeNode< DeviceExplorerNode > Node
Definition DeviceNode.hpp:74
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Definition CableData.hpp:18