scenario_simulator_v2 C++ API
storyboard.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef OPENSCENARIO_INTERPRETER__SYNTAX__STORYBOARD_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__STORYBOARD_HPP_
17 
18 #include <nlohmann/json.hpp>
24 #include <pugixml.hpp>
25 
27 {
28 inline namespace syntax
29 {
30 /* ---- Storyboard -------------------------------------------------------------
31  *
32  * <xsd:complexType name="Storyboard">
33  * <xsd:sequence>
34  * <xsd:element name="Init" type="Init"/>
35  * <xsd:element name="Story" maxOccurs="unbounded" type="Story"/>
36  * <xsd:element name="StopTrigger" type="Trigger"/>
37  * </xsd:sequence>
38  * </xsd:complexType>
39  *
40  * -------------------------------------------------------------------------- */
41 struct Storyboard : public Scope,
42  public StoryboardElement,
44 {
46 
47  using Thunk = std::function<void()>;
48 
49  static inline std::queue<Thunk> thunks{};
50 
51  explicit Storyboard(const pugi::xml_node &, Scope &);
52 
53  auto run() -> void override;
54 
55  friend auto operator<<(nlohmann::json &, const Storyboard &) -> nlohmann::json &;
56 };
57 } // namespace syntax
58 } // namespace openscenario_interpreter
59 
60 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__STORYBOARD_HPP_
Definition: scope.hpp:154
Definition: storyboard_element.hpp:37
Definition: escape_sequence.hpp:22
Definition: storyboard.hpp:44
static std::queue< Thunk > thunks
Definition: storyboard.hpp:49
std::function< void()> Thunk
Definition: storyboard.hpp:47
Init init
Definition: storyboard.hpp:45
auto run() -> void override
Definition: storyboard.cpp:46
friend auto operator<<(nlohmann::json &, const Storyboard &) -> nlohmann::json &
Definition: storyboard.cpp:61
Storyboard(const pugi::xml_node &, Scope &)
Definition: storyboard.cpp:30