etsi_its_messages v3.4.0
Loading...
Searching...
No Matches
spatem_ts_setters.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
11
12namespace etsi_its_spatem_ts_msgs {
13
14namespace access {
15
17
25 inline void setIntersectionID(IntersectionID& intsct_id, const uint16_t id) {
26 throwIfOutOfRange(id, IntersectionID::MIN, IntersectionID::MAX, "IntersectionID");
27 intsct_id.value = id;
28 }
29
37 inline void setIntersectionID(IntersectionReferenceID& intsct_ref_id, const uint16_t id) {
38 setIntersectionID(intsct_ref_id.id, id);
39 }
40
48 inline void setIntersectionID(IntersectionState& intsct, const uint16_t id) {
49 setIntersectionID(intsct.id, id);
50 }
51
59 inline void setMinuteOfTheYear(MinuteOfTheYear& moy, const uint32_t moy_value) {
60 throwIfOutOfRange(moy_value, MinuteOfTheYear::MIN, MinuteOfTheYear::MAX, "MinuteOfTheYear");
61 moy.value = moy_value;
62 }
63
71 inline void setMinuteOfTheYear(IntersectionState& intsct, const uint32_t moy_value) {
72 setMinuteOfTheYear(intsct.moy, moy_value);
73 intsct.moy_is_present = true;
74 }
75
83 inline void setDSecond(DSecond& dsecond, const uint32_t dsecond_value) {
84 throwIfOutOfRange(dsecond_value, DSecond::MIN, DSecond::MAX, "DSecond");
85 dsecond.value = dsecond_value;
86 }
87
95 inline void setDSecond(DSecond& dsecond, const double dsecond_value) {
96 uint32_t dsecond_value_ms = (uint32_t)(dsecond_value*1e3);
97 setDSecond(dsecond, dsecond_value_ms);
98 }
99
107 inline void setDSecond(IntersectionState& intsct, const uint32_t dsecond_value) {
108 setDSecond(intsct.time_stamp, dsecond_value);
109 intsct.time_stamp_is_present = true;
110 }
111
119 inline void setDSecond(IntersectionState& intsct, const double dsecond_value) {
120 setDSecond(intsct.time_stamp, dsecond_value);
121 intsct.time_stamp_is_present = true;
122 }
123
131 inline void setSignalGroupID(SignalGroupID& signal_group_id, const uint8_t id) {
132 throwIfOutOfRange(id, SignalGroupID::MIN, SignalGroupID::MAX, "SignalGroupID");
133 signal_group_id.value = id;
134 }
135
143 inline void setSignalGroupID(MovementState& movement_state, const uint8_t id) {
144 setSignalGroupID(movement_state.signal_group, id);
145 }
146
147} // namespace access
148
149} // 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.
void setSignalGroupID(SignalGroupID &signal_group_id, const uint8_t id)
Sets the SignalGroupID value.
void setMinuteOfTheYear(MinuteOfTheYear &moy, const uint32_t moy_value)
Sets the MinuteOfTheYear value.
void setIntersectionID(IntersectionID &intsct_id, const uint16_t id)
Sets the IntersectionID value.
void setDSecond(DSecond &dsecond, const uint32_t dsecond_value)
Sets the DSecond value.