spatem_ts_getters.h
Go to the documentation of this file.
1 /*
2 =============================================================================
3 MIT License
4 
5 Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 =============================================================================
25 */
26 
32 #pragma once
33 
35 
36 namespace access {
37 
39 
46  inline uint16_t getIntersectionID(const IntersectionID& intsct_id) {
47  return intsct_id.value;
48  }
49 
56  inline uint16_t getIntersectionID(const IntersectionReferenceID& intsct_ref_id) {
57  return getIntersectionID(intsct_ref_id.id);
58  }
59 
66  inline uint16_t getIntersectionID(const IntersectionState& intsct) {
67  return getIntersectionID(intsct.id);
68  }
69 
76  inline MinuteOfTheYear getMinuteOfTheYear(const IntersectionState& intsct) {
77  throwIfNotPresent(intsct.moy_is_present, "intsct.moy");
78  return intsct.moy;
79  }
80 
87  inline DSecond getDSecond(const IntersectionState& intsct) {
88  throwIfNotPresent(intsct.time_stamp_is_present, "intsct.time_stamp");
89  return intsct.time_stamp;
90  }
91 
98  inline double getDSecondValue(const DSecond& dsecond) {
99  return ((double)dsecond.value)*1e-3;
100  }
101 
108  inline double getDSecondValue(const IntersectionState& intsct) {
109  return getDSecondValue(getDSecond(intsct));
110  }
111 
118  inline uint8_t getSignalGroupID(const SignalGroupID& signal_group_id) {
119  return signal_group_id.value;
120  }
121 
128  inline uint8_t getSignalGroupID(const MovementState& mvmt_state) {
129  return getSignalGroupID(mvmt_state.signal_group);
130  }
131 
138  inline MovementEvent getCurrentMovementEvent(const MovementState& mvmt_state) {
139  if(mvmt_state.state_time_speed.array.size()<=0) {
140  throw std::runtime_error("MovementEventList is empty.");
141  }
142  return mvmt_state.state_time_speed.array[0];
143  }
144 
151  inline MovementPhaseState getCurrentMovementPhaseState(const MovementState& mvmt_state) {
152  return getCurrentMovementEvent(mvmt_state).event_state;
153  }
154 
161  inline uint8_t getCurrentMovementPhaseStateValue(const MovementState& mvmt_state) {
162  return getCurrentMovementPhaseState(mvmt_state).value;
163  }
164 
165 } // namespace access
166 
167 } // namespace etsi_its_spatem_ts_msgs
checks.h
Sanity-check functions etc.
etsi_its_spatem_ts_msgs::access::getCurrentMovementEvent
MovementEvent getCurrentMovementEvent(const MovementState &mvmt_state)
Get the current MovementEvent of a given MovementState object.
Definition: spatem_ts_getters.h:138
throwIfNotPresent
void throwIfNotPresent(const bool is_present, const std::string val_desc)
Throws an exception if the given value is not present.
Definition: checks.h:57
etsi_its_spatem_ts_msgs::access::getMinuteOfTheYear
MinuteOfTheYear getMinuteOfTheYear(const IntersectionState &intsct)
Get the MinuteOfTheYear object from a given IntersectionState object.
Definition: spatem_ts_getters.h:76
etsi_its_spatem_ts_msgs::access::getDSecond
DSecond getDSecond(const IntersectionState &intsct)
Get the DSecond object from a given IntersectionState object.
Definition: spatem_ts_getters.h:87
etsi_its_spatem_ts_msgs::access::getCurrentMovementPhaseStateValue
uint8_t getCurrentMovementPhaseStateValue(const MovementState &mvmt_state)
Get the Current MovementPhaseState object of a given MovementState object.
Definition: spatem_ts_getters.h:161
etsi_its_spatem_ts_msgs::access::getCurrentMovementPhaseState
MovementPhaseState getCurrentMovementPhaseState(const MovementState &mvmt_state)
Get the Current MovementPhaseState object of a given MovementState object.
Definition: spatem_ts_getters.h:151
etsi_its_spatem_ts_msgs::access::getIntersectionID
uint16_t getIntersectionID(const IntersectionID &intsct_id)
Get the intersection-id.
Definition: spatem_ts_getters.h:46
etsi_its_spatem_ts_msgs::access::getDSecondValue
double getDSecondValue(const DSecond &dsecond)
Get the value of a DSecond object in seconds.
Definition: spatem_ts_getters.h:98
etsi_its_spatem_ts_msgs
Definition: spatem_ts_getters.h:34
etsi_its_spatem_ts_msgs::access::getSignalGroupID
uint8_t getSignalGroupID(const SignalGroupID &signal_group_id)
Get the Signal Group-ID of an SignalGroupID object.
Definition: spatem_ts_getters.h:118


etsi_its_msgs_utils
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:32:12