scenario_simulator_v2 C++ API
pedestrian_category.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__PEDESTRIAN_CATEGORY_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__PEDESTRIAN_CATEGORY_HPP_
17 
18 #include <iostream>
19 #include <traffic_simulator_msgs/msg/entity_subtype.hpp>
20 
22 {
23 inline namespace syntax
24 {
25 /* ---- PedestrianCategory -----------------------------------------------------
26  *
27  * <xsd:simpleType name="PedestrianCategory">
28  * <xsd:union>
29  * <xsd:simpleType>
30  * <xsd:restriction base="xsd:string">
31  * <xsd:enumeration value="animal"/>
32  * <xsd:enumeration value="pedestrian"/>
33  * <xsd:enumeration value="wheelchair"/>
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  pedestrian, // NOTE: This is the default value and should not be included in the sort.
47 
48  // NOTE: Sorted by lexicographic order.
51  } value;
52 
54 
55  constexpr operator value_type() const noexcept { return value; }
56 
57  explicit operator traffic_simulator_msgs::msg::EntitySubtype() const
58  {
59  traffic_simulator_msgs::msg::EntitySubtype result;
60  {
61  switch (value) {
62  case pedestrian:
63  result.value = traffic_simulator_msgs::msg::EntitySubtype::PEDESTRIAN;
64  break;
65  default: // animal, wheelchair
66  result.value = traffic_simulator_msgs::msg::EntitySubtype::UNKNOWN;
67  break;
68  }
69  }
70 
71  return result;
72  }
73 };
74 
75 auto operator>>(std::istream &, PedestrianCategory &) -> std::istream &;
76 
77 auto operator<<(std::ostream &, const PedestrianCategory &) -> std::ostream &;
78 } // namespace syntax
79 } // namespace openscenario_interpreter
80 
81 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__PEDESTRIAN_CATEGORY_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: pedestrian_category.hpp:44
enum openscenario_interpreter::syntax::PedestrianCategory::value_type value
constexpr PedestrianCategory(value_type value=pedestrian)
Definition: pedestrian_category.hpp:53
value_type
Definition: pedestrian_category.hpp:45
@ pedestrian
Definition: pedestrian_category.hpp:46
@ wheelchair
Definition: pedestrian_category.hpp:50
@ animal
Definition: pedestrian_category.hpp:49