scenario_simulator_v2 C++ API
dynamics_dimension.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__DYNAMICS_DIMENSION_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__DYNAMICS_DIMENSION_HPP_
17 
18 #include <iostream>
21 
23 {
24 inline namespace syntax
25 {
26 /* ---- DynamicsDimension ------------------------------------------------------
27  *
28  * <xsd:simpleType name="DynamicsDimension">
29  * <xsd:union>
30  * <xsd:simpleType>
31  * <xsd:restriction base="xsd:string">
32  * <xsd:enumeration value="rate"/>
33  * <xsd:enumeration value="time"/>
34  * <xsd:enumeration value="distance"/>
35  * </xsd:restriction>
36  * </xsd:simpleType>
37  * <xsd:simpleType>
38  * <xsd:restriction base="parameter"/>
39  * </xsd:simpleType>
40  * </xsd:union>
41  * </xsd:simpleType>
42  *
43  * -------------------------------------------------------------------------- */
45 {
46  enum value_type {
47  // A predefined constant rate is used to acquire the target value.
49 
50  // A predefined time (duration) is used to acquire the target value.
52 
53  // A predefined distance used to acquire the target value.
55  } value;
56 
57  DynamicsDimension() = default;
58 
59  constexpr operator value_type() const noexcept { return value; }
60 
61  explicit constexpr operator traffic_simulator::speed_change::Constraint::Type() const
62  {
63  switch (value) {
64  case rate:
66  default:
67  return {};
68  }
69  }
70 
71  explicit constexpr operator traffic_simulator::lane_change::Constraint::Type() const
72  {
73  switch (value) {
74  case rate:
76  case time:
78  case distance:
80  default:
81  return {};
82  }
83  }
84 };
85 
86 auto operator>>(std::istream &, DynamicsDimension &) -> std::istream &;
87 
88 auto operator<<(std::ostream &, const DynamicsDimension &) -> std::ostream &;
89 } // namespace syntax
90 } // namespace openscenario_interpreter
91 
92 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__DYNAMICS_DIMENSION_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: dynamics_dimension.hpp:45
enum openscenario_interpreter::syntax::DynamicsDimension::value_type value
value_type
Definition: dynamics_dimension.hpp:46
@ distance
Definition: dynamics_dimension.hpp:54
@ time
Definition: dynamics_dimension.hpp:51
@ rate
Definition: dynamics_dimension.hpp:48
Type
Definition: lane_change.hpp:45
Type
Definition: speed_change.hpp:36