60#ifndef guWhiteboard_HeadJointSensors_h
61#define guWhiteboard_HeadJointSensors_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_HeadJointSensors_DEFINED
73#define guWhiteboard_HeadJointSensors_DEFINED
75#undef HeadJointSensors_DEFINED
76#define HeadJointSensors_DEFINED
90 void init(int16_t t_headYaw = 0, int16_t t_headPitch = 0) {
101 this->init(t_headYaw, t_headPitch);
142 return !(*
this == t_other);
152 return !(*
this == t_other);
185#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
195#ifdef USE_WB_HEAD_JOINT_SENSORS_C_CONVERSION
198 std::string descr = buffer;
201 std::ostringstream ss;
202 ss <<
"headYaw=" <<
static_cast<signed>(this->
headYaw());
204 ss <<
"headPitch=" <<
static_cast<signed>(this->
headPitch());
210#ifdef USE_WB_HEAD_JOINT_SENSORS_C_CONVERSION
213 std::string toString = buffer;
216 std::ostringstream ss;
217 ss << static_cast<signed>(this->
headYaw());
219 ss << static_cast<signed>(this->
headPitch());
224#ifdef USE_WB_HEAD_JOINT_SENSORS_C_CONVERSION
229 char * str_cstr =
const_cast<char *
>(t_str.c_str());
230 size_t temp_length = strlen(str_cstr);
231 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
236 char* var_str = &var_str_buffer[0];
238 char* key = &key_buffer[0];
245 if (index == 0 && str_cstr[0] ==
'{') {
251 for (
int i = index; i < length; i++) {
253 if (bracecount == 0 && str_cstr[i] ==
'=') {
258 if (bracecount == 0 && isspace(str_cstr[i])) {
265 if (bracecount == 0 && str_cstr[i] ==
',') {
269 if (str_cstr[i] ==
'{') {
273 if (str_cstr[i] ==
'}') {
275 if (bracecount < 0) {
280 if (i == length - 1) {
284 if (endKey >= startKey && endKey - startKey < length) {
285 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
286 key[(endKey - startKey) + 1] = 0;
290 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
291 var_str[(index - startVar) + 1] = 0;
297 if (strlen(key) > 0) {
298 if (0 == strcmp(
"headYaw", key)) {
300 }
else if (0 == strcmp(
"headPitch", key)) {
310 this->
set_headYaw(
static_cast<int16_t
>(atoi(var_str)));
322 }
while(index < length);
Provides a C++ wrapper around wb_head_joint_sensors.
const int16_t & headPitch() const
HeadJointSensors(const struct wb_head_joint_sensors &t_other)
Copy Constructor.
HeadJointSensors & operator=(const HeadJointSensors &t_other)
Copy Assignment Operator.
bool operator==(const HeadJointSensors &t_other) const
std::string description()
void from_string(const std::string &t_str)
HeadJointSensors(const HeadJointSensors &t_other)
Copy Constructor.
void set_headPitch(const int16_t &t_newValue)
void set_headYaw(const int16_t &t_newValue)
bool operator!=(const HeadJointSensors &t_other) const
const int16_t & headYaw() const
HeadJointSensors(const std::string &t_str)
String Constructor.
HeadJointSensors(int16_t t_headYaw=0, int16_t t_headPitch=0)
Create a new HeadJointSensors.
WHITEBOARD_POSTER_STRING_CONVERSION.
int16_t headPitch
Head pos in degrees.
int16_t headYaw
Head pos in degrees.
const char * wb_head_joint_sensors_description(const struct wb_head_joint_sensors *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_head_joint_sensors_to_string(const struct wb_head_joint_sensors *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_head_joint_sensors * wb_head_joint_sensors_from_string(struct wb_head_joint_sensors *self, const char *str)
Convert from a string.
#define HEAD_JOINT_SENSORS_DESC_BUFFER_SIZE
#define HEAD_JOINT_SENSORS_TO_STRING_BUFFER_SIZE