17 #ifndef GZ_MSGS_CONVERT_STDTYPES_HH_
18 #define GZ_MSGS_CONVERT_STDTYPES_HH_
20 #include <gz/math/Helpers.hh>
23 #include "gz/msgs/boolean.pb.h"
24 #include "gz/msgs/double.pb.h"
25 #include "gz/msgs/float.pb.h"
26 #include "gz/msgs/int32.pb.h"
27 #include "gz/msgs/int64.pb.h"
28 #include "gz/msgs/stringmsg.pb.h"
29 #include "gz/msgs/time.pb.h"
30 #include "gz/msgs/uint32.pb.h"
31 #include "gz/msgs/uint64.pb.h"
40 inline namespace GZ_MSGS_VERSION_NAMESPACE {
43 inline void Set(gz::msgs::Time *_msg,
44 const std::chrono::steady_clock::duration &_data)
49 _msg->set_sec(timeSecAndNsecs.first);
50 _msg->set_nsec(
static_cast<int32_t
>(timeSecAndNsecs.second));
53 inline void Set(std::chrono::steady_clock::duration *_data,
54 const gz::msgs::Time &_msg)
61 inline gz::msgs::Time
Convert(
const std::chrono::steady_clock::duration &_data)
68 inline std::chrono::steady_clock::duration
71 std::chrono::steady_clock::duration ret;
79 _msg->set_data(_data);
82 inline void Set(gz::msgs::StringMsg *_msg,
const char *_data)
84 _msg->set_data(_data);
94 gz::msgs::StringMsg ret;
107 inline void Set(gz::msgs::Boolean *_msg,
const bool &_data)
109 _msg->set_data(_data);
112 inline void Set(
bool *_data,
const gz::msgs::Boolean &_msg)
114 *_data = _msg.data();
117 inline gz::msgs::Boolean
Convert(
const bool &_data)
119 gz::msgs::Boolean ret;
124 inline bool Convert(
const gz::msgs::Boolean &_msg)
132 inline void Set(gz::msgs::Int32 *_msg,
const int32_t &_data)
134 _msg->set_data(_data);
137 inline void Set(int32_t *_data,
const gz::msgs::Int32 &_msg)
139 *_data = _msg.data();
142 inline gz::msgs::Int32
Convert(
const int32_t &_data)
149 inline int32_t
Convert(
const gz::msgs::Int32 &_msg)
157 inline void Set(gz::msgs::UInt32 *_msg,
const uint32_t &_data)
159 _msg->set_data(_data);
162 inline void Set(uint32_t *_data,
const gz::msgs::UInt32 &_msg)
164 *_data = _msg.data();
167 inline gz::msgs::UInt32
Convert(
const uint32_t &_data)
169 gz::msgs::UInt32 ret;
174 inline uint32_t
Convert(
const gz::msgs::UInt32 &_msg)
182 inline void Set(gz::msgs::Int64 *_msg,
const int64_t &_data)
184 _msg->set_data(_data);
187 inline void Set(int64_t *_data,
const gz::msgs::Int64 &_msg)
189 *_data = _msg.data();
192 inline gz::msgs::Int64
Convert(
const int64_t &_data)
199 inline int64_t
Convert(
const gz::msgs::Int64 &_msg)
207 inline void Set(gz::msgs::UInt64 *_msg,
const uint64_t &_data)
209 _msg->set_data(_data);
212 inline void Set(uint64_t *_data,
const gz::msgs::UInt64 &_msg)
214 *_data = _msg.data();
217 inline gz::msgs::UInt64
Convert(
const uint64_t &_data)
219 gz::msgs::UInt64 ret;
224 inline uint64_t
Convert(
const gz::msgs::UInt64 &_msg)
232 inline void Set(gz::msgs::Float *_msg,
const float &_data)
234 _msg->set_data(_data);
237 inline void Set(
float *_data,
const gz::msgs::Float &_msg)
239 *_data = _msg.data();
242 inline gz::msgs::Float
Convert(
const float &_data)
249 inline float Convert(
const gz::msgs::Float &_msg)
257 inline void Set(gz::msgs::Double *_msg,
const double &_data)
259 _msg->set_data(_data);
262 inline void Set(
double *_data,
const gz::msgs::Double &_msg)
264 *_data = _msg.data();
267 inline gz::msgs::Double
Convert(
const double &_data)
269 gz::msgs::Double ret;
274 inline double Convert(
const gz::msgs::Double &_msg)