etsi_its_messages v3.4.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 138 of file spatem_ts_getters.h.

138 {
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 }

◆ 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 151 of file spatem_ts_getters.h.

151 {
152 return getCurrentMovementEvent(mvmt_state).event_state;
153 }
MovementEvent getCurrentMovementEvent(const MovementState &mvmt_state)
Get the current MovementEvent 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 161 of file spatem_ts_getters.h.

161 {
162 return getCurrentMovementPhaseState(mvmt_state).value;
163 }
MovementPhaseState getCurrentMovementPhaseState(const MovementState &mvmt_state)
Get the Current MovementPhaseState object of a given MovementState object.

◆ 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 87 of file spatem_ts_getters.h.

87 {
88 throwIfNotPresent(intsct.time_stamp_is_present, "intsct.time_stamp");
89 return intsct.time_stamp;
90 }
void throwIfNotPresent(const bool is_present, const std::string val_desc)
Throws an exception if the given value is not present.

◆ 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 98 of file spatem_ts_getters.h.

98 {
99 return ((double)dsecond.value)*1e-3;
100 }

◆ 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 108 of file spatem_ts_getters.h.

108 {
109 return getDSecondValue(getDSecond(intsct));
110 }
double getDSecondValue(const DSecond &dsecond)
Get the value of a DSecond object in seconds.
DSecond getDSecond(const IntersectionState &intsct)
Get the DSecond object from a given IntersectionState object.

◆ 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 46 of file spatem_ts_getters.h.

46 {
47 return intsct_id.value;
48 }

◆ 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 56 of file spatem_ts_getters.h.

56 {
57 return getIntersectionID(intsct_ref_id.id);
58 }
uint16_t getIntersectionID(const IntersectionID &intsct_id)
Get the intersection-id.

◆ 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 66 of file spatem_ts_getters.h.

66 {
67 return getIntersectionID(intsct.id);
68 }

◆ 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 76 of file spatem_ts_getters.h.

76 {
77 throwIfNotPresent(intsct.moy_is_present, "intsct.moy");
78 return intsct.moy;
79 }

◆ 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 128 of file spatem_ts_getters.h.

128 {
129 return getSignalGroupID(mvmt_state.signal_group);
130 }
uint8_t getSignalGroupID(const SignalGroupID &signal_group_id)
Get the Signal Group-ID of an SignalGroupID object.

◆ 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 118 of file spatem_ts_getters.h.

118 {
119 return signal_group_id.value;
120 }

◆ 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.