etsi_its_messages v3.0.0
 
Loading...
Searching...
No Matches
mapem_ts_getters.h
Go to the documentation of this file.
1/*
2=============================================================================
3MIT License
4
5Copyright (c) 2023-2024 Institute for Automotive Engineering (ika), RWTH Aachen University
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24=============================================================================
25*/
26
31
32#pragma once
33
34namespace etsi_its_mapem_ts_msgs {
35
36namespace access {
37
38#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_getters.h>
40
43 *
44 * @param map object to get the MinuteOfTheYear from
45 * @return MinuteOfTheYear the minute of the year object
46 */
47 inline MinuteOfTheYear getMinuteOfTheYear(const MapData& map) {
48 throwIfNotPresent(map.time_stamp_is_present, "map.time_stamp");
49 return map.time_stamp;
50 }
51
52
58 inline uint32_t getMinuteOfTheYearValue(const MapData& map) {
59 MinuteOfTheYear moy = getMinuteOfTheYear(map);
60 return moy.value;
61 }
62
67
69 inline MinuteOfTheYear getMinuteOfTheYear(const MAPEM& mapem) {
70 return getMinuteOfTheYear(mapem.map);
71 }
72
74
79 inline uint32_t getMinuteOfTheYearValue(const MAPEM& mapem) {
80 return getMinuteOfTheYearValue(mapem.map);
81 }
82
85
89 inline uint16_t getIntersectionID(const IntersectionID& intsct_id) {
90 return intsct_id.value;
91 }
95
99 inline uint16_t getIntersectionID(const IntersectionGeometry& intsct) {
100 return getIntersectionID(intsct.id.id);
101 }
105
109 inline double getLatitude(const Latitude& latitude) {
110 return ((double)latitude.value)*1e-7;
111 }
115
119 inline double getLongitude(const Longitude& longitude) {
120 return ((double)longitude.value)*1e-7;
121 }
125
129 inline double getElevation(const Elevation& elevation) {
130 return ((double)elevation.value)*1e-1;
131 }
135
139 inline double getLatitude(const Position3D& ref_point) {
140 return getLatitude(ref_point.lat);
141 }
145
149 inline double getLongitude(const Position3D& ref_point) {
150 return getLongitude(ref_point.lon);
151 }
155
159 inline double getElevation(const Position3D& ref_point) {
160 throwIfNotPresent(ref_point.elevation_is_present, "Position3D.elevation_is_present");
161 return getElevation(ref_point.elevation);
163
165
170 inline std::vector<bool> getLaneDirection(const LaneDirection& lane_direction) {
171 return getBitString(lane_direction.value, lane_direction.bits_unused);
173
175
180 inline std::vector<bool> getLaneDirection(const LaneAttributes& lane_attributes) {
181 return getLaneDirection(lane_attributes.directional_use);
183
186
190 inline std::vector<bool> getLaneDirection(const GenericLane& generic_lane) {
191 return getLaneDirection(generic_lane.lane_attributes);
192 }
196
201 template <typename T>
202 inline gm::Point getPointFromNodeXY(const T& node_xy) {
203 gm::Point p;
204 p.x = ((double)node_xy.x.value) * 1e-2;
205 p.y = ((double)node_xy.y.value) * 1e-2;
206 return p;
207 }
208
209} // namespace access
210
211} // namespace etsi_its_mapem_ts_msgs
Sanity-check functions etc.
gm::Point getPointFromNodeXY(const T &node_xy)
Get the Point From NodeXY object.
uint16_t getIntersectionID(const IntersectionID &intsct_id)
Get the IntersectionID value.
double getLongitude(const Longitude &longitude)
Get the Longitude value.
MinuteOfTheYear getMinuteOfTheYear(const MapData &map)
Get the value of MinuteOfTheYear object MapData object.
uint32_t getMinuteOfTheYearValue(const MapData &map)
Get the value of MinuteOfTheYear value from MapData object.
double getLatitude(const Latitude &latitude)
Get the Latitude value.
double getElevation(const Elevation &elevation)
Get the Elevation value.
void throwIfNotPresent(const bool is_present, const std::string val_desc)
Throws an exception if the given value is not present.