scenario_simulator_v2 C++ API
event.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__EVENT_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__EVENT_HPP_
17 
18 #include <boost/json.hpp>
25 #include <pugixml.hpp>
26 
28 {
29 inline namespace syntax
30 {
31 /* ---- Event ------------------------------------------------------------------
32  *
33  * <xsd:complexType name="Event">
34  * <xsd:sequence>
35  * <xsd:element name="Action" maxOccurs="unbounded" type="Action"/>
36  * <xsd:element name="StartTrigger" type="Trigger"/>
37  * </xsd:sequence>
38  * <xsd:attribute name="priority" type="Priority" use="required"/>
39  * <xsd:attribute name="maximumExecutionCount" type="UnsignedInt"/>
40  * <xsd:attribute name="name" type="String" use="required"/>
41  * </xsd:complexType>
42  *
43  * -------------------------------------------------------------------------- */
44 struct Event : private Scope, public StoryboardElement
45 {
46  using Scope::name;
47 
48  const Priority priority; // Priority of each event.
49 
50  explicit Event(const pugi::xml_node &, Scope &, Maneuver &);
51 
52  auto start() -> void override;
53 
54  auto evaluate() -> Object override;
55 
56  friend auto operator<<(boost::json::object &, const Event &) -> boost::json::object &;
57 
58 private:
59  Maneuver & parent_maneuver;
60 };
61 
62 } // namespace syntax
63 } // namespace openscenario_interpreter
64 
65 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__EVENT_HPP_
Definition: scope.hpp:154
const std::string name
Definition: scope.hpp:191
Definition: storyboard_element.hpp:37
Definition: hypot.hpp:22
Definition: event.hpp:45
const Priority priority
Definition: event.hpp:48
friend auto operator<<(boost::json::object &, const Event &) -> boost::json::object &
Definition: event.cpp:70
auto evaluate() -> Object override
Event(const pugi::xml_node &, Scope &, Maneuver &)