Loading...
Searching...
No Matches
Slot.hpp
1#pragma once
2#include <Process/Process.hpp>
3
4#include <score_plugin_scenario_export.h>
5namespace Scenario
6{
7struct SCORE_PLUGIN_SCENARIO_EXPORT Slot
8{
9 enum RackView : bool
10 {
11 SmallView,
12 FullView
13 };
14
15 Slot() = default;
16 Slot(const Slot&) = default;
17 Slot(Slot&&) = default;
18 Slot& operator=(const Slot&) = default;
19 Slot& operator=(Slot&&) = default;
20
21 Slot(std::vector<Id<Process::ProcessModel>> p)
22 : processes{std::move(p)}
23 {
24 }
26 : processes{std::move(p)}
27 , frontProcess{std::move(fp)}
28 {
29 }
31 : processes{std::move(p)}
32 , frontProcess{std::move(fp)}
33 , height{h}
34 {
35 }
36
37 std::vector<Id<Process::ProcessModel>> processes;
38 OptionalId<Process::ProcessModel> frontProcess;
39 qreal height{200};
40 bool focus{};
41 bool nodal{};
42};
43
44using Rack = std::vector<Slot>;
46{
48 bool nodal{};
49};
50using FullRack = std::vector<FullSlot>;
51class IntervalModel;
52
53struct SCORE_PLUGIN_SCENARIO_EXPORT SlotPath
54{
55 SlotPath() = default;
56 SlotPath(const SlotPath&) = default;
57 SlotPath(SlotPath&&) = default;
58 SlotPath& operator=(const SlotPath&) = default;
59 SlotPath& operator=(SlotPath&&) = default;
60
62 : interval{std::move(p)}
63 {
64 }
66 : interval{std::move(p)}
67 , index{idx}
68 {
69 }
70 SlotPath(Path<IntervalModel> p, int idx, Slot::RackView v)
71 : interval{std::move(p)}
72 , index{idx}
73 , full_view{v}
74 {
75 }
76
77 Path<IntervalModel> interval;
78 int index{};
79 Slot::RackView full_view{};
80
81 const Slot& find(const score::DocumentContext&) const;
82 const Slot* try_find(const score::DocumentContext&) const;
83};
84
85struct SCORE_PLUGIN_SCENARIO_EXPORT SlotId
86{
87 SlotId() noexcept = default;
88 SlotId(const SlotId&) noexcept = default;
89 SlotId& operator=(const SlotId&) noexcept = default;
90 SlotId(SlotId&&) noexcept = default;
91 SlotId& operator=(SlotId&&) noexcept = default;
92
93 SlotId(std::size_t p, Slot::RackView f) noexcept
94 : index{(int)p}
95 , view{f}
96 {
97 }
98 SlotId(int p, Slot::RackView f) noexcept
99 : index{p}
100 , view{f}
101 {
102 }
103
104 SlotId(const SlotPath& p) noexcept
105 : index{p.index}
106 , view{p.full_view}
107 {
108 }
109
110 int index{};
111 Slot::RackView view{};
112
113 bool fullView() const noexcept { return view == Slot::FullView; }
114 bool smallView() const noexcept { return view == Slot::SmallView; }
115};
116}
117
118inline QDataStream& operator<<(QDataStream& i, const Scenario::SlotId& sel) noexcept
119{
120 return i;
121}
122inline QDataStream& operator>>(QDataStream& i, Scenario::SlotId& sel) noexcept
123{
124 return i;
125}
126W_REGISTER_ARGTYPE(Scenario::Slot)
127W_REGISTER_ARGTYPE(Scenario::Rack)
128W_REGISTER_ARGTYPE(Scenario::Slot::RackView)
129W_REGISTER_ARGTYPE(Scenario::FullSlot)
130W_REGISTER_ARGTYPE(Scenario::SlotPath)
131W_REGISTER_ARGTYPE(Scenario::SlotId)
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition IntervalModel.hpp:50
The id_base_t class.
Definition Identifier.hpp:57
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition Slot.hpp:46
Definition Slot.hpp:8
Definition Slot.hpp:86
Definition Slot.hpp:54
Definition DocumentContext.hpp:18