spatem_ts_setters.h
Go to the documentation of this file.
1 /*
2 =============================================================================
3 MIT License
4 
5 Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 =============================================================================
25 */
26 
32 #pragma once
33 
34 
35 namespace etsi_its_spatem_ts_msgs {
36 
37 namespace 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 
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 
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 
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 
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 
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 
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 
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
etsi_its_spatem_ts_msgs::access::setMinuteOfTheYear
void setMinuteOfTheYear(MinuteOfTheYear &moy, const uint32_t moy_value)
Sets the MinuteOfTheYear value.
Definition: spatem_ts_setters.h:82
checks.h
Sanity-check functions etc.
etsi_its_spatem_ts_msgs::access::setIntersectionID
void setIntersectionID(IntersectionID &intsct_id, const uint16_t id)
Sets the IntersectionID value.
Definition: spatem_ts_setters.h:48
etsi_its_spatem_ts_msgs::access::setSignalGroupID
void setSignalGroupID(SignalGroupID &signal_group_id, const uint8_t id)
Sets the SignalGroupID value.
Definition: spatem_ts_setters.h:154
etsi_its_spatem_ts_msgs
Definition: spatem_ts_getters.h:34
etsi_its_spatem_ts_msgs::access::setDSecond
void setDSecond(DSecond &dsecond, const uint32_t dsecond_value)
Sets the DSecond value.
Definition: spatem_ts_setters.h:106
throwIfOutOfRange
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


etsi_its_msgs_utils
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:32:12