StateSelection.hpp
1 #pragma once
2 #include <Scenario/Document/BaseScenario/BaseScenario.hpp>
3 #include <Scenario/Document/State/StateModel.hpp>
4 #include <Scenario/Process/Algorithms/Accessors.hpp>
5 #include <score/selection/Selection.hpp>
6 
7 namespace Scenario
8 {
9 inline void doStateSelection(Selection& sel, const StateModel& m, const BaseScenario& model)
10 {
11  sel.append(m);
12 }
13 
14 inline void doStateSelection(Selection& sel, const StateModel& m, const ProcessModel& model)
15 {
16  sel.append(m);
17 
18  // If there's a zero-duration interval we also select it to enable
19  // it to be removed ; same for the "previous" state which is at the exact same position
20  if(auto& id = m.previousInterval())
21  {
22  auto& itv = Scenario::previousInterval(m, model);
23  if(itv.duration.defaultDuration() == TimeVal::zero() && !itv.graphal())
24  {
25  sel.append(&itv);
26  sel.append(Scenario::startState(itv, model));
27  }
28  }
29 }
30 }
Definition: Selection.hpp:12
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14