ScenarioInterface.hpp
1 #pragma once
2 #include <Process/ExpandMode.hpp>
3 #include <Process/TimeValue.hpp>
4 
5 #include <score/model/Identifier.hpp>
6 #include <score/tools/std/IndirectContainer.hpp>
7 
8 #include <score_plugin_scenario_export.h>
9 
10 #include <verdigris>
12 namespace Scenario
13 {
14 class IntervalModel;
15 class EventModel;
16 class StateModel;
17 class TimeSyncModel;
18 
19 class SCORE_PLUGIN_SCENARIO_EXPORT ScenarioInterface
20 {
21 public:
22  virtual ~ScenarioInterface();
23  virtual IntervalModel* findInterval(const Id<IntervalModel>& intervalId) const = 0;
24  virtual EventModel* findEvent(const Id<EventModel>& eventId) const = 0;
25  virtual TimeSyncModel* findTimeSync(const Id<TimeSyncModel>& timeSyncId) const = 0;
26  virtual StateModel* findState(const Id<StateModel>& stId) const = 0;
27 
28  virtual IntervalModel& interval(const Id<IntervalModel>& intervalId) const = 0;
29  virtual EventModel& event(const Id<EventModel>& eventId) const = 0;
30  virtual TimeSyncModel& timeSync(const Id<TimeSyncModel>& timeSyncId) const = 0;
31  virtual StateModel& state(const Id<StateModel>& stId) const = 0;
32 
33  virtual score::IndirectContainer<IntervalModel> getIntervals() const = 0;
34  virtual score::IndirectContainer<StateModel> getStates() const = 0;
35  virtual score::IndirectContainer<EventModel> getEvents() const = 0;
36  virtual score::IndirectContainer<TimeSyncModel> getTimeSyncs() const = 0;
37 };
38 
39 static const constexpr auto startId_val = 0;
40 static const constexpr auto endId_val = 1;
41 
42 template <typename T>
43 auto startId()
44 {
45  return Id<T>{startId_val};
46 }
47 
48 template <typename T>
49 auto endId()
50 {
51  return Id<T>{endId_val};
52 }
53 
54 template <typename Scenario_T, typename Element_T>
56 // { auto container_accessor = &intervals; etc... }
57 
58 template <>
60 {
61  static const constexpr auto accessor = &ScenarioInterface::getIntervals;
62 };
63 template <>
65 {
66  static const constexpr auto accessor = &ScenarioInterface::getEvents;
67 };
68 template <>
70 {
71  static const constexpr auto accessor = &ScenarioInterface::getTimeSyncs;
72 };
73 template <>
75 {
76  static const constexpr auto accessor = &ScenarioInterface::getStates;
77 };
78 }
79 
80 W_REGISTER_ARGTYPE(const Scenario::ScenarioInterface&)
81 W_REGISTER_ARGTYPE(Scenario::ScenarioInterface)
82 
83 Q_DECLARE_METATYPE(const Scenario::ScenarioInterface*)
84 Q_DECLARE_METATYPE(Scenario::ScenarioInterface*)
85 W_REGISTER_ARGTYPE(const Scenario::ScenarioInterface*)
86 W_REGISTER_ARGTYPE(Scenario::ScenarioInterface*)
The OngoingCommandDispatcher class.
Definition: OngoingCommandDispatcher.hpp:27
Definition: EventModel.hpp:36
Definition: IntervalModel.hpp:50
Definition: ScenarioInterface.hpp:20
Definition: StateModel.hpp:63
Definition: TimeSyncModel.hpp:34
The id_base_t class.
Definition: Identifier.hpp:57
Definition: IndirectContainer.hpp:129
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ScenarioInterface.hpp:55