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 bool operator==(const Slot&) const noexcept = default;
44};
45
46using Rack = std::vector<Slot>;
48{
50 bool nodal{};
51};
52using FullRack = std::vector<FullSlot>;
53class IntervalModel;
54
55struct SCORE_PLUGIN_SCENARIO_EXPORT SlotPath
56{
57 SlotPath() = default;
58 SlotPath(const SlotPath&) = default;
59 SlotPath(SlotPath&&) = default;
60 SlotPath& operator=(const SlotPath&) = default;
61 SlotPath& operator=(SlotPath&&) = default;
62
64 : interval{std::move(p)}
65 {
66 }
68 : interval{std::move(p)}
69 , index{idx}
70 {
71 }
72 SlotPath(Path<IntervalModel> p, int idx, Slot::RackView v)
73 : interval{std::move(p)}
74 , index{idx}
75 , full_view{v}
76 {
77 }
78
79 Path<IntervalModel> interval;
80 int index{};
81 Slot::RackView full_view{};
82
83 const Slot& find(const score::DocumentContext&) const;
84 const Slot* try_find(const score::DocumentContext&) const;
85};
86
87struct SCORE_PLUGIN_SCENARIO_EXPORT SlotId
88{
89 SlotId() noexcept = default;
90 SlotId(const SlotId&) noexcept = default;
91 SlotId& operator=(const SlotId&) noexcept = default;
92 SlotId(SlotId&&) noexcept = default;
93 SlotId& operator=(SlotId&&) noexcept = default;
94
95 SlotId(std::size_t p, Slot::RackView f) noexcept
96 : index{(int)p}
97 , view{f}
98 {
99 }
100 SlotId(int p, Slot::RackView f) noexcept
101 : index{p}
102 , view{f}
103 {
104 }
105
106 SlotId(const SlotPath& p) noexcept
107 : index{p.index}
108 , view{p.full_view}
109 {
110 }
111
112 int index{};
113 Slot::RackView view{};
114
115 bool fullView() const noexcept { return view == Slot::FullView; }
116 bool smallView() const noexcept { return view == Slot::SmallView; }
117};
118}
119
120inline QDataStream& operator<<(QDataStream& i, const Scenario::SlotId& sel) noexcept
121{
122 return i;
123}
124inline QDataStream& operator>>(QDataStream& i, Scenario::SlotId& sel) noexcept
125{
126 return i;
127}
128W_REGISTER_ARGTYPE(Scenario::Slot)
129W_REGISTER_ARGTYPE(Scenario::Rack)
130W_REGISTER_ARGTYPE(Scenario::Slot::RackView)
131W_REGISTER_ARGTYPE(Scenario::FullSlot)
132W_REGISTER_ARGTYPE(Scenario::SlotPath)
133W_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:59
Main plug-in of score.
Definition ConnectionsList.hpp:22
Definition Slot.hpp:48
Definition Slot.hpp:8
Definition Slot.hpp:88
Definition Slot.hpp:56
Definition DocumentContext.hpp:18