scenario_simulator_v2 C++ API
condition_edge.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__CONDITION_EDGE_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__CONDITION_EDGE_HPP_
17 
18 #include <iostream>
19 
21 {
22 inline namespace syntax
23 {
24 /* ---- ConditionEdge ----------------------------------------------------------
25  *
26  * <xsd:simpleType name="ConditionEdge">
27  * <xsd:union>
28  * <xsd:simpleType>
29  * <xsd:restriction base="xsd:string">
30  * <xsd:enumeration value="rising"/>
31  * <xsd:enumeration value="falling"/>
32  * <xsd:enumeration value="risingOrFalling"/>
33  * <xsd:enumeration value="none"/>
34  * </xsd:restriction>
35  * </xsd:simpleType>
36  * <xsd:simpleType>
37  * <xsd:restriction base="parameter"/>
38  * </xsd:simpleType>
39  * </xsd:union>
40  * </xsd:simpleType>
41  *
42  * TIER IV Extension:
43  * - Add enumeration <xsd.enumeration value="sticky"/>
44  *
45  * -------------------------------------------------------------------------- */
47 {
48  enum value_type {
49  /* ---- NOTE ---------------------------------------------------------------
50  *
51  * A condition defined with a 'none' edge shall return true at discrete
52  * time t if its logical expression is true at discrete time t.
53  *
54  * Default constructor select this.
55  *
56  * ---------------------------------------------------------------------- */
58 
59  /* ---- NOTE ---------------------------------------------------------------
60  *
61  * A condition defined with a rising edge shall return true at discrete
62  * time t if its logical expression is true at discrete time t and its
63  * logical expression was false at discrete time t-ts, where ts is the
64  * simulation sampling time.
65  *
66  * ---------------------------------------------------------------------- */
68 
69  /* ---- NOTE ---------------------------------------------------------------
70  *
71  * A condition defined with a falling edge shall return true at discrete
72  * time t if its logical expression is false at discrete time t and its
73  * logical expression was true at discrete time t-ts, where ts is the
74  * simulation sampling time.
75  *
76  * ---------------------------------------------------------------------- */
78 
79  /* ---- NOTE ---------------------------------------------------------------
80  *
81  * A condition defined with a 'risingOrFalling' edge shall return true at
82  * discrete time t if its logical expression is true at discrete time t
83  * and its logical expression was false at discrete time t-ts OR if its
84  * logical expression is false at discrete time t and its logical
85  * expression was true at discrete time t-ts. ts is the simulation
86  * sampling time.
87  *
88  * ---------------------------------------------------------------------- */
90 
91  /* ---- NOTE ---------------------------------------------------------------
92  *
93  * A condition defined by a 'sticky' edge returns true at discrete time
94  * t + k (0 < k) if its logical expression evaluates to true at discrete
95  * time t. This edge is provided for simply defining assertions such as
96  * "Did the Ego car pass over checkpoint X?
97  *
98  * This is NOT an OpenSCENARIO 1.0.0 standard feature (TIER IV extension).
99  *
100  * ---------------------------------------------------------------------- */
102  } value;
103 
104  ConditionEdge() = default;
105 
106  operator value_type() const noexcept { return value; }
107 };
108 
109 auto operator>>(std::istream & is, ConditionEdge &) -> std::istream &;
110 
111 auto operator<<(std::ostream & os, const ConditionEdge &) -> std::ostream &;
112 } // namespace syntax
113 } // namespace openscenario_interpreter
114 
115 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__CONDITION_EDGE_HPP_
auto operator>>(std::istream &, Boolean &) -> std::istream &
Definition: boolean.cpp:52
auto operator<<(std::ostream &, const Boolean &) -> std::ostream &
Definition: boolean.cpp:46
Definition: escape_sequence.hpp:22
Definition: object.hpp:30
Definition: condition_edge.hpp:47
value_type
Definition: condition_edge.hpp:48
@ risingOrFalling
Definition: condition_edge.hpp:89
@ none
Definition: condition_edge.hpp:57
@ rising
Definition: condition_edge.hpp:67
@ falling
Definition: condition_edge.hpp:77
@ sticky
Definition: condition_edge.hpp:101
enum openscenario_interpreter::syntax::ConditionEdge::value_type value