scenario_simulator_v2 C++ API
speed_target_value_type.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__SPEED_TARGET_VALUE_TYPE_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_TARGET_VALUE_TYPE_HPP_
17 
18 #include <iostream>
20 #include <type_traits>
21 
23 {
24 inline namespace syntax
25 {
26 /* ---- SpeedTargetValueType ---------------------------------------------------
27  *
28  * <xsd:simpleType name="SpeedTargetValueType">
29  * <xsd:union>
30  * <xsd:simpleType>
31  * <xsd:restriction base="xsd:string">
32  * <xsd:enumeration value="delta"/>
33  * <xsd:enumeration value="factor"/>
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  * -------------------------------------------------------------------------- */
44 {
45  enum value_type {
46  /*
47  The relative value is interpreted as a difference to a referenced value.
48  Unit: m/s. As an example, a speed value of 10 equals a speed that's 10m/s
49  faster than the reference speed.
50  */
52 
53  /*
54  The relative value is interpreted as a factor to a referenced value. No
55  unit. As an example, a speed value of 1.1 equals a speed that's 10%
56  faster than the reference speed.
57  */
59  } value;
60 
61  SpeedTargetValueType() = default;
62 
63  constexpr operator value_type() const noexcept { return value; }
64 
66  {
67  switch (value) {
68  case delta:
70  case factor:
72  default:
74  }
75  }
76 };
77 
78 auto operator>>(std::istream &, SpeedTargetValueType &) -> std::istream &;
79 
80 auto operator<<(std::ostream &, const SpeedTargetValueType &) -> std::ostream &;
81 } // namespace syntax
82 } // namespace openscenario_interpreter
83 
84 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_TARGET_VALUE_TYPE_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: speed_target_value_type.hpp:44
enum openscenario_interpreter::syntax::SpeedTargetValueType::value_type value
value_type
Definition: speed_target_value_type.hpp:45
@ factor
Definition: speed_target_value_type.hpp:58
@ delta
Definition: speed_target_value_type.hpp:51