26 #include <type_traits>
30 #include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
53 using clock_t = std::chrono::high_resolution_clock;
55 using entry_t = RobotUnitDataStreaming::DataEntry;
70 void set(
const RobotUnitDataStreaming::DataEntry& k);
71 T get(
const RobotUnitDataStreaming::TimeStep& t)
const;
72 T operator()(
const RobotUnitDataStreaming::TimeStep& t)
const;
74 RobotUnitDataStreaming::DataEntry _key;
80 const RobotUnitDataStreaming::Config& cfg);
103 detail::RobotUnitDataStreamingReceiver::ReceiverPtr _receiver;
104 RobotUnitDataStreaming::ReceiverPrx _proxy;
105 RobotUnitDataStreaming::DataStreamingDescription _description;
106 std::map<std::uint64_t, RobotUnitDataStreaming::TimeStepSeq> _tmp_data_buffer;
107 std::uint64_t _tmp_data_buffer_seq_id = 0;
108 std::deque<RobotUnitDataStreaming::TimeStep> _data_buffer;
109 long _last_iteration_id = -1;
116 template<
class T>
inline
122 template<
class T>
inline
127 k.type) <<
"the key references a value of the wrong type!";
131 template<
class T>
inline
139 template<
class T>
inline
143 return RobotUnitDataStreamingReceiver::GetAs<T>(t, _key);
146 template<
class T>
inline
153 template<
class T>
inline
157 e = _description.entries.at(name);
159 template<
class T>
inline
171 using enum_t = RobotUnitDataStreaming::DataEntryType;
175 case enum_t::NodeTypeBool : f(st.bools .at(e.index));
break;
176 case enum_t::NodeTypeByte : f(st.bytes .at(e.index));
break;
177 case enum_t::NodeTypeShort : f(st.shorts .at(e.index));
break;
178 case enum_t::NodeTypeInt : f(st.ints .at(e.index));
break;
179 case enum_t::NodeTypeLong : f(st.longs .at(e.index));
break;
180 case enum_t::NodeTypeFloat : f(st.floats .at(e.index));
break;
181 case enum_t::NodeTypeDouble: f(st.doubles.at(e.index));
break;
186 template<
class T>
inline
190 using enum_t = RobotUnitDataStreaming::DataEntryType;
191 if constexpr(std::is_same_v<bool, T>)
194 return st.bools .at(e.index);
196 else if constexpr(std::is_same_v<Ice::Byte, T>)
199 return st.bytes .at(e.index);
201 else if constexpr(std::is_same_v<Ice::Short, T>)
204 return st.shorts .at(e.index);
206 else if constexpr(std::is_same_v<Ice::Int, T>)
209 return st.ints .at(e.index);
211 else if constexpr(std::is_same_v<Ice::Long, T>)
214 return st.longs .at(e.index);
216 else if constexpr(std::is_same_v<Ice::Float, T>)
219 return st.floats .at(e.index);
221 else if constexpr(std::is_same_v<Ice::Double, T>)
224 return st.doubles.at(e.index);
228 static_assert(!std::is_same_v<T, T>,
"Type not supported!");
232 template<
class T>
inline
233 RobotUnitDataStreaming::DataEntryType
236 using enum_t = RobotUnitDataStreaming::DataEntryType;
237 if constexpr(std::is_same_v<bool, T>)
239 return enum_t::NodeTypeBool;
241 else if constexpr(std::is_same_v<Ice::Byte, T>)
243 return enum_t::NodeTypeByte;
245 else if constexpr(std::is_same_v<Ice::Short, T>)
247 return enum_t::NodeTypeShort;
249 else if constexpr(std::is_same_v<Ice::Int, T>)
251 return enum_t::NodeTypeInt;
253 else if constexpr(std::is_same_v<Ice::Long, T>)
255 return enum_t::NodeTypeLong;
257 else if constexpr(std::is_same_v<Ice::Float, T>)
259 return enum_t::NodeTypeFloat;
261 else if constexpr(std::is_same_v<Ice::Double, T>)
263 return enum_t::NodeTypeDouble;
267 static_assert(!std::is_same_v<T, T>,
"Type not supported!");