etsi_its_messages v3.0.0
 
Loading...
Searching...
No Matches
spatem_ts_getters.h File Reference

Getter functions for the ETSI ITS SPATEM. More...

Go to the source code of this file.

Functions

template<typename T1, typename T2>
void etsi_its_spatem_ts_msgs::access::throwIfOutOfRange (const T1 &val, const T2 &min, const T2 &max, const std::string val_desc)
 Throws an exception if a given value is out of a defined range.
 
void etsi_its_spatem_ts_msgs::access::throwIfNotPresent (const bool is_present, const std::string val_desc)
 Throws an exception if the given value is not present.
 
uint16_t etsi_its_spatem_ts_msgs::access::getIntersectionID (const IntersectionID &intsct_id)
 Get the intersection-id.
 
uint16_t etsi_its_spatem_ts_msgs::access::getIntersectionID (const IntersectionReferenceID &intsct_ref_id)
 Get the intersection-id of an IntersectionReferenceID object.
 
uint16_t etsi_its_spatem_ts_msgs::access::getIntersectionID (const IntersectionState &intsct)
 Get the intersection-id of an IntersectionState object.
 
MinuteOfTheYear etsi_its_spatem_ts_msgs::access::getMinuteOfTheYear (const IntersectionState &intsct)
 Get the MinuteOfTheYear object from a given IntersectionState object.
 
DSecond etsi_its_spatem_ts_msgs::access::getDSecond (const IntersectionState &intsct)
 Get the DSecond object from a given IntersectionState object.
 
double etsi_its_spatem_ts_msgs::access::getDSecondValue (const DSecond &dsecond)
 Get the value of a DSecond object in seconds.
 
double etsi_its_spatem_ts_msgs::access::getDSecondValue (const IntersectionState &intsct)
 Get the value of an DSecond object from a given IntersectionState object.
 
uint8_t etsi_its_spatem_ts_msgs::access::getSignalGroupID (const SignalGroupID &signal_group_id)
 Get the Signal Group-ID of an SignalGroupID object.
 
uint8_t etsi_its_spatem_ts_msgs::access::getSignalGroupID (const MovementState &mvmt_state)
 Get the Signal Group-ID of an MovementState object.
 
MovementEvent etsi_its_spatem_ts_msgs::access::getCurrentMovementEvent (const MovementState &mvmt_state)
 Get the current MovementEvent of a given MovementState object.
 
MovementPhaseState etsi_its_spatem_ts_msgs::access::getCurrentMovementPhaseState (const MovementState &mvmt_state)
 Get the Current MovementPhaseState object of a given MovementState object.
 
uint8_t etsi_its_spatem_ts_msgs::access::getCurrentMovementPhaseStateValue (const MovementState &mvmt_state)
 Get the Current MovementPhaseState object of a given MovementState object.
 

Detailed Description

Getter functions for the ETSI ITS SPATEM.

Definition in file spatem_ts_getters.h.

Function Documentation

◆ getCurrentMovementEvent()

MovementEvent etsi_its_spatem_ts_msgs::access::getCurrentMovementEvent ( const MovementState & mvmt_state)
inline

Get the current MovementEvent of a given MovementState object.

Parameters
mvmt_eventMovementState object to get the MovementEvent from
Returns
MovementEvent object

Definition at line 162 of file spatem_ts_getters.h.

◆ getCurrentMovementPhaseState()

MovementPhaseState etsi_its_spatem_ts_msgs::access::getCurrentMovementPhaseState ( const MovementState & mvmt_state)
inline

Get the Current MovementPhaseState object of a given MovementState object.

Parameters
mvmt_stateMovementState object to get the MovementPhaseState from
Returns
MovementPhaseState object

Definition at line 175 of file spatem_ts_getters.h.

208 {
209
210namespace access {
211
213
220 inline uint16_t getIntersectionID(const IntersectionID& intsct_id) {
221 return intsct_id.value;
222 }
223
230 inline uint16_t getIntersectionID(const IntersectionReferenceID& intsct_ref_id) {
231 return getIntersectionID(intsct_ref_id.id);
232 }
233
240 inline uint16_t getIntersectionID(const IntersectionState& intsct) {
241 return getIntersectionID(intsct.id);
242 }
243
250 inline MinuteOfTheYear getMinuteOfTheYear(const IntersectionState& intsct) {
251 throwIfNotPresent(intsct.moy_is_present, "intsct.moy");
252 return intsct.moy;
253 }
254
261 inline DSecond getDSecond(const IntersectionState& intsct) {
262 throwIfNotPresent(intsct.time_stamp_is_present, "intsct.time_stamp");
263 return intsct.time_stamp;
264 }
265
272 inline double getDSecondValue(const DSecond& dsecond) {
273 return ((double)dsecond.value)*1e-3;
274 }
275
282 inline double getDSecondValue(const IntersectionState& intsct) {
283 return getDSecondValue(getDSecond(intsct));
284 }
285
292 inline uint8_t getSignalGroupID(const SignalGroupID& signal_group_id) {
293 return signal_group_id.value;
294 }
295
302 inline uint8_t getSignalGroupID(const MovementState& mvmt_state) {
303 return getSignalGroupID(mvmt_state.signal_group);
304 }
305
312 inline MovementEvent getCurrentMovementEvent(const MovementState& mvmt_state) {
313 if(mvmt_state.state_time_speed.array.size()<=0) {
314 throw std::runtime_error("MovementEventList is empty.");
315 }
316 return mvmt_state.state_time_speed.array[0];
317 }
318
325 inline MovementPhaseState getCurrentMovementPhaseState(const MovementState& mvmt_state) {
326 return getCurrentMovementEvent(mvmt_state).event_state;
327 }
328
335 inline uint8_t getCurrentMovementPhaseStateValue(const MovementState& mvmt_state) {
336 return getCurrentMovementPhaseState(mvmt_state).value;
337 }
338
339} // namespace access
340
341} // namespace etsi_its_spatem_ts_msgs
Sanity-check functions etc.
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
MinuteOfTheYear getMinuteOfTheYear(const MapData &map)
Get the value of MinuteOfTheYear object MapData object.
uint16_t getIntersectionID(const IntersectionID &intsct_id)
Get the intersection-id.
double getDSecondValue(const DSecond &dsecond)
Get the value of a DSecond object in seconds.
uint8_t getSignalGroupID(const SignalGroupID &signal_group_id)
Get the Signal Group-ID of an SignalGroupID object.
DSecond getDSecond(const IntersectionState &intsct)
Get the DSecond object from a given IntersectionState object.
MovementEvent getCurrentMovementEvent(const MovementState &mvmt_state)
Get the current MovementEvent of a given MovementState object.
MovementPhaseState getCurrentMovementPhaseState(const MovementState &mvmt_state)
Get the Current MovementPhaseState object of a given MovementState object.
uint8_t getCurrentMovementPhaseStateValue(const MovementState &mvmt_state)
Get the Current MovementPhaseState object of a given MovementState object.

◆ getCurrentMovementPhaseStateValue()

uint8_t etsi_its_spatem_ts_msgs::access::getCurrentMovementPhaseStateValue ( const MovementState & mvmt_state)
inline

Get the Current MovementPhaseState object of a given MovementState object.

Parameters
mvmt_stateMovementState object to get the MovementPhaseState from
Returns
MovementPhaseState object

Definition at line 185 of file spatem_ts_getters.h.

218 {
219
220namespace access {
221
223
230 inline uint16_t getIntersectionID(const IntersectionID& intsct_id) {
231 return intsct_id.value;
232 }
233
240 inline uint16_t getIntersectionID(const IntersectionReferenceID& intsct_ref_id) {
241 return getIntersectionID(intsct_ref_id.id);
242 }
243
250 inline uint16_t getIntersectionID(const IntersectionState& intsct) {
251 return getIntersectionID(intsct.id);
252 }
253
260 inline MinuteOfTheYear getMinuteOfTheYear(const IntersectionState& intsct) {
261 throwIfNotPresent(intsct.moy_is_present, "intsct.moy");
262 return intsct.moy;
263 }
264
271 inline DSecond getDSecond(const IntersectionState& intsct) {
272 throwIfNotPresent(intsct.time_stamp_is_present, "intsct.time_stamp");
273 return intsct.time_stamp;
274 }
275
282 inline double getDSecondValue(const DSecond& dsecond) {
283 return ((double)dsecond.value)*1e-3;
284 }
285
292 inline double getDSecondValue(const IntersectionState& intsct) {
293 return getDSecondValue(getDSecond(intsct));
294 }
295
302 inline uint8_t getSignalGroupID(const SignalGroupID& signal_group_id) {
303 return signal_group_id.value;
304 }
305
312 inline uint8_t getSignalGroupID(const MovementState& mvmt_state) {
313 return getSignalGroupID(mvmt_state.signal_group);
314 }
315
322 inline MovementEvent getCurrentMovementEvent(const MovementState& mvmt_state) {
323 if(mvmt_state.state_time_speed.array.size()<=0) {
324 throw std::runtime_error("MovementEventList is empty.");
325 }
326 return mvmt_state.state_time_speed.array[0];
327 }
328
335 inline MovementPhaseState getCurrentMovementPhaseState(const MovementState& mvmt_state) {
336 return getCurrentMovementEvent(mvmt_state).event_state;
337 }
338
345 inline uint8_t getCurrentMovementPhaseStateValue(const MovementState& mvmt_state) {
346 return getCurrentMovementPhaseState(mvmt_state).value;
347 }
348
349} // namespace access
350
351} // namespace etsi_its_spatem_ts_msgs

◆ getDSecond()

DSecond etsi_its_spatem_ts_msgs::access::getDSecond ( const IntersectionState & intsct)
inline

Get the DSecond object from a given IntersectionState object.

Parameters
intsctIntersectionState object to get the DSecond from
Returns
DSecond object

Definition at line 111 of file spatem_ts_getters.h.

◆ getDSecondValue() [1/2]

double etsi_its_spatem_ts_msgs::access::getDSecondValue ( const DSecond & dsecond)
inline

Get the value of a DSecond object in seconds.

Parameters
dsecondDSecond object to get the value from
Returns
double value of DSecond given in seconds

Definition at line 122 of file spatem_ts_getters.h.

◆ getDSecondValue() [2/2]

double etsi_its_spatem_ts_msgs::access::getDSecondValue ( const IntersectionState & intsct)
inline

Get the value of an DSecond object from a given IntersectionState object.

Parameters
intsct
Returns
double

Definition at line 132 of file spatem_ts_getters.h.

◆ getIntersectionID() [1/3]

uint16_t etsi_its_spatem_ts_msgs::access::getIntersectionID ( const IntersectionID & intsct_id)
inline

Get the intersection-id.

Parameters
intsct_idintersection-id object to get the value from
Returns
uint16_t id of the intersection

Definition at line 70 of file spatem_ts_getters.h.

◆ getIntersectionID() [2/3]

uint16_t etsi_its_spatem_ts_msgs::access::getIntersectionID ( const IntersectionReferenceID & intsct_ref_id)
inline

Get the intersection-id of an IntersectionReferenceID object.

Parameters
intsct_ref_idIntersectionReferenceID object
Returns
uint16_t id of the intersection

Definition at line 80 of file spatem_ts_getters.h.

◆ getIntersectionID() [3/3]

uint16_t etsi_its_spatem_ts_msgs::access::getIntersectionID ( const IntersectionState & intsct)
inline

Get the intersection-id of an IntersectionState object.

Parameters
intsctIntersectionState object
Returns
uint16_t id of the intersection

Definition at line 90 of file spatem_ts_getters.h.

◆ getMinuteOfTheYear()

MinuteOfTheYear etsi_its_spatem_ts_msgs::access::getMinuteOfTheYear ( const IntersectionState & intsct)
inline

Get the MinuteOfTheYear object from a given IntersectionState object.

Parameters
intsctIntersectionState object to get the MinuteOfTheYear from
Returns
MinuteOfTheYear object

Definition at line 100 of file spatem_ts_getters.h.

◆ getSignalGroupID() [1/2]

uint8_t etsi_its_spatem_ts_msgs::access::getSignalGroupID ( const MovementState & mvmt_state)
inline

Get the Signal Group-ID of an MovementState object.

Parameters
mvmt_stateMovementState object to get the id from
Returns
uint8_t the id of the signal group

Definition at line 152 of file spatem_ts_getters.h.

◆ getSignalGroupID() [2/2]

uint8_t etsi_its_spatem_ts_msgs::access::getSignalGroupID ( const SignalGroupID & signal_group_id)
inline

Get the Signal Group-ID of an SignalGroupID object.

Parameters
signal_group_idSignalGroupID object to get the id from
Returns
uint8_t the id of the signal group

Definition at line 142 of file spatem_ts_getters.h.

◆ throwIfNotPresent()

void etsi_its_spatem_ts_msgs::access::throwIfNotPresent ( const bool is_present,
const std::string val_desc )
inline

Throws an exception if the given value is not present.

Parameters
is_presentWhether the value is present.
val_descDescription of the value for the exception message.

Definition at line 58 of file spatem_ts_getters.h.

◆ throwIfOutOfRange()

template<typename T1, typename T2>
void etsi_its_spatem_ts_msgs::access::throwIfOutOfRange ( const T1 & val,
const T2 & min,
const T2 & max,
const std::string val_desc )

Throws an exception if a given value is out of a defined range.

Template Parameters
T1
T2
Parameters
valThe value to check if it is in the range.
minThe minimum value of the range.
maxThe maximum value of the range.
val_descDescription of the value for the exception message.

Definition at line 47 of file spatem_ts_getters.h.