etsi_its_messages v3.0.0
 
Loading...
Searching...
No Matches
spatem_ts_setters.h
Go to the documentation of this file.
1/*
2=============================================================================
3MIT License
4
5Copyright (c) 2023-2024 Institute for Automotive Engineering (ika), RWTH Aachen University
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24=============================================================================
25*/
26
31
32#pragma once
33
34
35namespace etsi_its_spatem_ts_msgs {
36
37namespace access {
38
40
48 inline void setIntersectionID(IntersectionID& intsct_id, const uint16_t id) {
49 throwIfOutOfRange(id, IntersectionID::MIN, IntersectionID::MAX, "IntersectionID");
50 intsct_id.value = id;
51 }
52
60 inline void setIntersectionID(IntersectionReferenceID& intsct_ref_id, const uint16_t id) {
61 setIntersectionID(intsct_ref_id.id, id);
62 }
63
71 inline void setIntersectionID(IntersectionState& intsct, const uint16_t id) {
72 setIntersectionID(intsct.id, id);
73 }
74
75
82 inline void setMinuteOfTheYear(MinuteOfTheYear& moy, const uint32_t moy_value) {
83 throwIfOutOfRange(moy_value, MinuteOfTheYear::MIN, MinuteOfTheYear::MAX, "MinuteOfTheYear");
84 moy.value = moy_value;
85 }
86
94 inline void setMinuteOfTheYear(IntersectionState& intsct, const uint32_t moy_value) {
95 setMinuteOfTheYear(intsct.moy, moy_value);
96 intsct.moy_is_present = true;
97 }
98
105 */
106 inline void setDSecond(DSecond& dsecond, const uint32_t dsecond_value) {
107 throwIfOutOfRange(dsecond_value, DSecond::MIN, DSecond::MAX, "DSecond");
108 dsecond.value = dsecond_value;
109 }
110
117 */
118 inline void setDSecond(DSecond& dsecond, const double dsecond_value) {
119 uint32_t dsecond_value_ms = (uint32_t)(dsecond_value*1e3);
120 setDSecond(dsecond, dsecond_value_ms);
121 }
122
129 */
130 inline void setDSecond(IntersectionState& intsct, const uint32_t dsecond_value) {
131 setDSecond(intsct.time_stamp, dsecond_value);
132 intsct.time_stamp_is_present = true;
133 }
134
141 */
142 inline void setDSecond(IntersectionState& intsct, const double dsecond_value) {
143 setDSecond(intsct.time_stamp, dsecond_value);
144 intsct.time_stamp_is_present = true;
145 }
146
153 */
154 inline void setSignalGroupID(SignalGroupID& signal_group_id, const uint8_t id) {
155 throwIfOutOfRange(id, SignalGroupID::MIN, SignalGroupID::MAX, "SignalGroupID");
156 signal_group_id.value = id;
157 }
158
165 */
166 inline void setSignalGroupID(MovementState& movement_state, const uint8_t id) {
167 setSignalGroupID(movement_state.signal_group, id);
168 }
169
170} // namespace access
171
172} // 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.