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

Setter 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.
 
void etsi_its_spatem_ts_msgs::access::setIntersectionID (IntersectionID &intsct_id, const uint16_t id)
 Sets the IntersectionID value.
 
void etsi_its_spatem_ts_msgs::access::setIntersectionID (IntersectionReferenceID &intsct_ref_id, const uint16_t id)
 Sets the IntersectionID value in an IntersectionReferenceID object.
 
void etsi_its_spatem_ts_msgs::access::setIntersectionID (IntersectionState &intsct, const uint16_t id)
 Sets the IntersectionID value in an IntersectionState object.
 
void etsi_its_spatem_ts_msgs::access::setMinuteOfTheYear (MinuteOfTheYear &moy, const uint32_t moy_value)
 Sets the MinuteOfTheYear value.
 
void etsi_its_spatem_ts_msgs::access::setMinuteOfTheYear (IntersectionState &intsct, const uint32_t moy_value)
 Sets the MinuteOfTheYear value in an IntersectionState object.
 
void etsi_its_spatem_ts_msgs::access::setDSecond (DSecond &dsecond, const uint32_t dsecond_value)
 Sets the DSecond value.
 
void etsi_its_spatem_ts_msgs::access::setDSecond (DSecond &dsecond, const double dsecond_value)
 Sets the DSecond value using a double.
 
void etsi_its_spatem_ts_msgs::access::setDSecond (IntersectionState &intsct, const uint32_t dsecond_value)
 Sets the DSecond value in an IntersectionState object.
 
void etsi_its_spatem_ts_msgs::access::setDSecond (IntersectionState &intsct, const double dsecond_value)
 Sets the DSecond value in an IntersectionState object using a double.
 
void etsi_its_spatem_ts_msgs::access::setSignalGroupID (SignalGroupID &signal_group_id, const uint8_t id)
 Sets the SignalGroupID value.
 
void etsi_its_spatem_ts_msgs::access::setSignalGroupID (MovementState &movement_state, const uint8_t id)
 Sets the SignalGroupID value in a MovementState object.
 

Detailed Description

Setter functions for the ETSI ITS SPATEM.

Definition in file spatem_ts_setters.h.

Function Documentation

◆ setDSecond() [1/4]

void etsi_its_spatem_ts_msgs::access::setDSecond ( DSecond & dsecond,
const double dsecond_value )
inline

Sets the DSecond value using a double.

Parameters
dsecondThe DSecond object to set.
dsecond_valueThe value to set in seconds.
Exceptions
std::out_of_rangeif the dsecond_value is out of the valid range.

Definition at line 141 of file spatem_ts_setters.h.

142 {
143 setDSecond(intsct.time_stamp, dsecond_value);
144 intsct.time_stamp_is_present = true;
void setDSecond(DSecond &dsecond, const uint32_t dsecond_value)
Sets the DSecond value.

◆ setDSecond() [2/4]

void etsi_its_spatem_ts_msgs::access::setDSecond ( DSecond & dsecond,
const uint32_t dsecond_value )
inline

Sets the DSecond value.

Parameters
dsecondThe DSecond object to set.
dsecond_valueThe value to set.
Exceptions
std::out_of_rangeif the dsecond_value is out of the valid range.

Definition at line 129 of file spatem_ts_setters.h.

130 {
131 setDSecond(intsct.time_stamp, dsecond_value);
132 intsct.time_stamp_is_present = true;

◆ setDSecond() [3/4]

void etsi_its_spatem_ts_msgs::access::setDSecond ( IntersectionState & intsct,
const double dsecond_value )
inline

Sets the DSecond value in an IntersectionState object using a double.

Parameters
intsctThe IntersectionState object to set.
dsecond_valueThe value to set in seconds.
Exceptions
std::out_of_rangeif the dsecond_value is out of the valid range.

Definition at line 165 of file spatem_ts_setters.h.

166 {
167 setSignalGroupID(movement_state.signal_group, id);
168 }
void setSignalGroupID(SignalGroupID &signal_group_id, const uint8_t id)
Sets the SignalGroupID value.

◆ setDSecond() [4/4]

void etsi_its_spatem_ts_msgs::access::setDSecond ( IntersectionState & intsct,
const uint32_t dsecond_value )
inline

Sets the DSecond value in an IntersectionState object.

Parameters
intsctThe IntersectionState object to set.
dsecond_valueThe value to set.
Exceptions
std::out_of_rangeif the dsecond_value is out of the valid range.

Definition at line 153 of file spatem_ts_setters.h.

154 {
155 throwIfOutOfRange(id, SignalGroupID::MIN, SignalGroupID::MAX, "SignalGroupID");
156 signal_group_id.value = id;
void 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.

◆ setIntersectionID() [1/3]

void etsi_its_spatem_ts_msgs::access::setIntersectionID ( IntersectionID & intsct_id,
const uint16_t id )
inline

Sets the IntersectionID value.

Parameters
intsct_idThe IntersectionID object to set.
idThe value to set.
Exceptions
std::out_of_rangeif the id is out of the valid range.

Definition at line 71 of file spatem_ts_setters.h.

71 {
72 setIntersectionID(intsct.id, id);
73 }
74
void setIntersectionID(IntersectionID &intsct_id, const uint16_t id)
Sets the IntersectionID value.

◆ setIntersectionID() [2/3]

void etsi_its_spatem_ts_msgs::access::setIntersectionID ( IntersectionReferenceID & intsct_ref_id,
const uint16_t id )
inline

Sets the IntersectionID value in an IntersectionReferenceID object.

Parameters
intsct_ref_idThe IntersectionReferenceID object to set.
idThe value to set.
Exceptions
std::out_of_rangeif the id is out of the valid range.

Definition at line 83 of file spatem_ts_setters.h.

◆ setIntersectionID() [3/3]

void etsi_its_spatem_ts_msgs::access::setIntersectionID ( IntersectionState & intsct,
const uint16_t id )
inline

Sets the IntersectionID value in an IntersectionState object.

Parameters
intsctThe IntersectionState object to set.
idThe value to set.
Exceptions
std::out_of_rangeif the id is out of the valid range.

Definition at line 94 of file spatem_ts_setters.h.

94 {
95 setMinuteOfTheYear(intsct.moy, moy_value);
96 intsct.moy_is_present = true;
void setMinuteOfTheYear(MinuteOfTheYear &moy, const uint32_t moy_value)
Sets the MinuteOfTheYear value.

◆ setMinuteOfTheYear() [1/2]

void etsi_its_spatem_ts_msgs::access::setMinuteOfTheYear ( IntersectionState & intsct,
const uint32_t moy_value )
inline

Sets the MinuteOfTheYear value in an IntersectionState object.

Parameters
intsctThe IntersectionState object to set.
moy_valueThe value to set.
Exceptions
std::out_of_rangeif the moy_value is out of the valid range.

Definition at line 117 of file spatem_ts_setters.h.

118 {
119 uint32_t dsecond_value_ms = (uint32_t)(dsecond_value*1e3);
120 setDSecond(dsecond, dsecond_value_ms);

◆ setMinuteOfTheYear() [2/2]

void etsi_its_spatem_ts_msgs::access::setMinuteOfTheYear ( MinuteOfTheYear & moy,
const uint32_t moy_value )
inline

Sets the MinuteOfTheYear value.

Parameters
moyThe MinuteOfTheYear object to set.
moy_valueThe value to set.
Exceptions
std::out_of_rangeif the moy_value is out of the valid range.

Definition at line 105 of file spatem_ts_setters.h.

106 {
107 throwIfOutOfRange(dsecond_value, DSecond::MIN, DSecond::MAX, "DSecond");
108 dsecond.value = dsecond_value;

◆ setSignalGroupID() [1/2]

void etsi_its_spatem_ts_msgs::access::setSignalGroupID ( MovementState & movement_state,
const uint8_t id )
inline

Sets the SignalGroupID value in a MovementState object.

Parameters
movement_stateThe MovementState object to set.
idThe value to set.
Exceptions
std::out_of_rangeif the id is out of the valid range.

Definition at line 189 of file spatem_ts_setters.h.

223 {
224
225namespace access {
226
228
236 inline void setIntersectionID(IntersectionID& intsct_id, const uint16_t id) {
237 throwIfOutOfRange(id, IntersectionID::MIN, IntersectionID::MAX, "IntersectionID");
238 intsct_id.value = id;
239 }
240
248 inline void setIntersectionID(IntersectionReferenceID& intsct_ref_id, const uint16_t id) {
249 setIntersectionID(intsct_ref_id.id, id);
250 }
251
259 inline void setIntersectionID(IntersectionState& intsct, const uint16_t id) {
260 setIntersectionID(intsct.id, id);
261 }
262
270 inline void setMinuteOfTheYear(MinuteOfTheYear& moy, const uint32_t moy_value) {
271 throwIfOutOfRange(moy_value, MinuteOfTheYear::MIN, MinuteOfTheYear::MAX, "MinuteOfTheYear");
272 moy.value = moy_value;
273 }
274
282 inline void setMinuteOfTheYear(IntersectionState& intsct, const uint32_t moy_value) {
283 setMinuteOfTheYear(intsct.moy, moy_value);
284 intsct.moy_is_present = true;
285 }
286
294 inline void setDSecond(DSecond& dsecond, const uint32_t dsecond_value) {
295 throwIfOutOfRange(dsecond_value, DSecond::MIN, DSecond::MAX, "DSecond");
296 dsecond.value = dsecond_value;
297 }
298
306 inline void setDSecond(DSecond& dsecond, const double dsecond_value) {
307 uint32_t dsecond_value_ms = (uint32_t)(dsecond_value*1e3);
308 setDSecond(dsecond, dsecond_value_ms);
309 }
310
318 inline void setDSecond(IntersectionState& intsct, const uint32_t dsecond_value) {
319 setDSecond(intsct.time_stamp, dsecond_value);
320 intsct.time_stamp_is_present = true;
321 }
322
330 inline void setDSecond(IntersectionState& intsct, const double dsecond_value) {
331 setDSecond(intsct.time_stamp, dsecond_value);
332 intsct.time_stamp_is_present = true;
333 }
334
342 inline void setSignalGroupID(SignalGroupID& signal_group_id, const uint8_t id) {
343 throwIfOutOfRange(id, SignalGroupID::MIN, SignalGroupID::MAX, "SignalGroupID");
344 signal_group_id.value = id;
345 }
346
354 inline void setSignalGroupID(MovementState& movement_state, const uint8_t id) {
355 setSignalGroupID(movement_state.signal_group, id);
356 }
357
358} // namespace access
359
360} // namespace etsi_its_spatem_ts_msgs
Sanity-check functions etc.
void 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.
Definition checks.h:46
void setMinuteOfTheYear(MinuteOfTheYear &moy, const uint32_t moy_value)
Set the MinuteOfTheYear object.

◆ setSignalGroupID() [2/2]

void etsi_its_spatem_ts_msgs::access::setSignalGroupID ( SignalGroupID & signal_group_id,
const uint8_t id )
inline

Sets the SignalGroupID value.

Parameters
signal_group_idThe SignalGroupID object to set.
idThe value to set.
Exceptions
std::out_of_rangeif the id is out of the valid range.

Definition at line 177 of file spatem_ts_setters.h.

211 {
212
213namespace access {
214
216
224 inline void setIntersectionID(IntersectionID& intsct_id, const uint16_t id) {
225 throwIfOutOfRange(id, IntersectionID::MIN, IntersectionID::MAX, "IntersectionID");
226 intsct_id.value = id;
227 }
228
236 inline void setIntersectionID(IntersectionReferenceID& intsct_ref_id, const uint16_t id) {
237 setIntersectionID(intsct_ref_id.id, id);
238 }
239
247 inline void setIntersectionID(IntersectionState& intsct, const uint16_t id) {
248 setIntersectionID(intsct.id, id);
249 }
250
258 inline void setMinuteOfTheYear(MinuteOfTheYear& moy, const uint32_t moy_value) {
259 throwIfOutOfRange(moy_value, MinuteOfTheYear::MIN, MinuteOfTheYear::MAX, "MinuteOfTheYear");
260 moy.value = moy_value;
261 }
262
270 inline void setMinuteOfTheYear(IntersectionState& intsct, const uint32_t moy_value) {
271 setMinuteOfTheYear(intsct.moy, moy_value);
272 intsct.moy_is_present = true;
273 }
274
282 inline void setDSecond(DSecond& dsecond, const uint32_t dsecond_value) {
283 throwIfOutOfRange(dsecond_value, DSecond::MIN, DSecond::MAX, "DSecond");
284 dsecond.value = dsecond_value;
285 }
286
294 inline void setDSecond(DSecond& dsecond, const double dsecond_value) {
295 uint32_t dsecond_value_ms = (uint32_t)(dsecond_value*1e3);
296 setDSecond(dsecond, dsecond_value_ms);
297 }
298
306 inline void setDSecond(IntersectionState& intsct, const uint32_t dsecond_value) {
307 setDSecond(intsct.time_stamp, dsecond_value);
308 intsct.time_stamp_is_present = true;
309 }
310
318 inline void setDSecond(IntersectionState& intsct, const double dsecond_value) {
319 setDSecond(intsct.time_stamp, dsecond_value);
320 intsct.time_stamp_is_present = true;
321 }
322
330 inline void setSignalGroupID(SignalGroupID& signal_group_id, const uint8_t id) {
331 throwIfOutOfRange(id, SignalGroupID::MIN, SignalGroupID::MAX, "SignalGroupID");
332 signal_group_id.value = id;
333 }
334
342 inline void setSignalGroupID(MovementState& movement_state, const uint8_t id) {
343 setSignalGroupID(movement_state.signal_group, id);
344 }
345
346} // namespace access
347
348} // namespace etsi_its_spatem_ts_msgs

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