etsi_its_messages v3.4.0
Loading...
Searching...
No Matches
mapem_ts_getters.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright Institute for Automotive Engineering (ika), RWTH Aachen University
3
8
9#pragma once
10
11namespace etsi_its_mapem_ts_msgs {
12
13namespace access {
14
15#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_getters.h>
17
20 *
21 * @param map object to get the MinuteOfTheYear from
22 * @return MinuteOfTheYear the minute of the year object
23 */
24 inline MinuteOfTheYear getMinuteOfTheYear(const MapData& map) {
25 throwIfNotPresent(map.time_stamp_is_present, "map.time_stamp");
26 return map.time_stamp;
27 }
28
35 inline uint32_t getMinuteOfTheYearValue(const MapData& map) {
36 MinuteOfTheYear moy = getMinuteOfTheYear(map);
37 return moy.value;
38 }
39
46 inline MinuteOfTheYear getMinuteOfTheYear(const MAPEM& mapem) {
47 return getMinuteOfTheYear(mapem.map);
48 }
49
56 inline uint32_t getMinuteOfTheYearValue(const MAPEM& mapem) {
57 return getMinuteOfTheYearValue(mapem.map);
58 }
59
66 inline uint16_t getIntersectionID(const IntersectionID& intsct_id) {
67 return intsct_id.value;
68 }
69
76 inline uint16_t getIntersectionID(const IntersectionGeometry& intsct) {
77 return getIntersectionID(intsct.id.id);
78 }
79
86 inline double getLatitude(const Latitude& latitude) {
87 return ((double)latitude.value)*1e-7;
88 }
89
96 inline double getLongitude(const Longitude& longitude) {
97 return ((double)longitude.value)*1e-7;
98 }
99
106 inline double getElevation(const Elevation& elevation) {
107 return ((double)elevation.value)*1e-1;
108 }
109
116 inline double getLatitude(const Position3D& ref_point) {
117 return getLatitude(ref_point.lat);
118 }
119
126 inline double getLongitude(const Position3D& ref_point) {
127 return getLongitude(ref_point.lon);
128 }
129
136 inline double getElevation(const Position3D& ref_point) {
137 throwIfNotPresent(ref_point.elevation_is_present, "Position3D.elevation_is_present");
138 return getElevation(ref_point.elevation);
139 }
140
147 inline std::vector<bool> getLaneDirection(const LaneDirection& lane_direction) {
148 return getBitString(lane_direction.value, lane_direction.bits_unused);
149 }
150
157 inline std::vector<bool> getLaneDirection(const LaneAttributes& lane_attributes) {
158 return getLaneDirection(lane_attributes.directional_use);
159 }
160
167 inline std::vector<bool> getLaneDirection(const GenericLane& generic_lane) {
168 return getLaneDirection(generic_lane.lane_attributes);
169 }
170
178 template <typename T>
179 inline gm::Point getPointFromNodeXY(const T& node_xy) {
180 gm::Point p;
181 p.x = ((double)node_xy.x.value) * 1e-2;
182 p.y = ((double)node_xy.y.value) * 1e-2;
183 return p;
184 }
185
186} // namespace access
187
188} // namespace etsi_its_mapem_ts_msgs
Sanity-check functions etc.
std::vector< bool > getLaneDirection(const LaneDirection &lane_direction)
Get the LaneDirection in form of bool vector.
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.
std::vector< bool > getBitString(const std::vector< uint8_t > &buffer, const int bits_unused)
Get a Bit String in form of bool vector.
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.