60#ifndef guWhiteboard_VisionDetectionGoal_h
61#define guWhiteboard_VisionDetectionGoal_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionGoal_DEFINED
73#define guWhiteboard_VisionDetectionGoal_DEFINED
75#undef VisionDetectionGoal_DEFINED
76#define VisionDetectionGoal_DEFINED
104 this->init(t_sightingType, t_post1, t_post2);
146 return !(*
this == t_other);
156 return !(*
this == t_other);
204#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
214#ifdef USE_WB_VISION_DETECTION_GOAL_C_CONVERSION
217 std::string descr = buffer;
220 std::ostringstream ss;
224 ss <<
"sightingType=" <<
"DoublePostGoal";
229 ss <<
"sightingType=" <<
"NoGoalDetected";
234 ss <<
"sightingType=" <<
"SinglePostGoal";
247#ifdef USE_WB_VISION_DETECTION_GOAL_C_CONVERSION
250 std::string toString = buffer;
253 std::ostringstream ss;
257 ss <<
"DoublePostGoal";
262 ss <<
"NoGoalDetected";
267 ss <<
"SinglePostGoal";
279#ifdef USE_WB_VISION_DETECTION_GOAL_C_CONVERSION
284 char * str_cstr =
const_cast<char *
>(t_str.c_str());
285 size_t temp_length = strlen(str_cstr);
286 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
291 char* var_str = &var_str_buffer[0];
293 char* key = &key_buffer[0];
300 if (index == 0 && str_cstr[0] ==
'{') {
306 for (
int i = index; i < length; i++) {
308 if (bracecount == 0 && str_cstr[i] ==
'=') {
313 if (bracecount == 0 && isspace(str_cstr[i])) {
320 if (bracecount == 0 && str_cstr[i] ==
',') {
324 if (str_cstr[i] ==
'{') {
328 if (str_cstr[i] ==
'}') {
330 if (bracecount < 0) {
335 if (i == length - 1) {
339 if (endKey >= startKey && endKey - startKey < length) {
340 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
341 key[(endKey - startKey) + 1] = 0;
345 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
346 var_str[(index - startVar) + 1] = 0;
352 if (strlen(key) > 0) {
353 if (0 == strcmp(
"sightingType", key)) {
355 }
else if (0 == strcmp(
"post1", key)) {
357 }
else if (0 == strcmp(
"post2", key)) {
367 if (strcmp(
"DoublePostGoal", var_str) == 0) {
368#pragma clang diagnostic push
369#pragma clang diagnostic ignored "-Wbad-function-cast"
371#pragma clang diagnostic pop
372 }
else if (strcmp(
"NoGoalDetected", var_str) == 0) {
373#pragma clang diagnostic push
374#pragma clang diagnostic ignored "-Wbad-function-cast"
376#pragma clang diagnostic pop
377 }
else if (strcmp(
"SinglePostGoal", var_str) == 0) {
378#pragma clang diagnostic push
379#pragma clang diagnostic ignored "-Wbad-function-cast"
381#pragma clang diagnostic pop
383#pragma clang diagnostic push
384#pragma clang diagnostic ignored "-Wbad-function-cast"
386#pragma clang diagnostic pop
408 }
while(index < length);
Provides a C++ wrapper around wb_vision_detection_goal.
void from_string(const std::string &t_str)
VisionDetectionGoal(enum GoalOptions t_sightingType=NoGoalDetected, struct wb_vision_detection_goal_post t_post1=wb_vision_detection_goal_post(), struct wb_vision_detection_goal_post t_post2=wb_vision_detection_goal_post())
Create a new VisionDetectionGoal.
VisionDetectionGoalPost & post2()
void set_sightingType(const enum GoalOptions &t_newValue)
VisionDetectionGoal(const struct wb_vision_detection_goal &t_other)
Copy Constructor.
VisionDetectionGoalPost & post1()
VisionDetectionGoal & operator=(const VisionDetectionGoal &t_other)
Copy Assignment Operator.
const VisionDetectionGoalPost & post2() const
enum GoalOptions & sightingType() const
enum GoalOptions & sightingType()
bool operator!=(const VisionDetectionGoal &t_other) const
VisionDetectionGoal(const std::string &t_str)
String Constructor.
void set_post1(const VisionDetectionGoalPost &t_newValue)
void set_post2(const VisionDetectionGoalPost &t_newValue)
const VisionDetectionGoalPost & post1() const
std::string description()
bool operator==(const VisionDetectionGoal &t_other) const
VisionDetectionGoal(const VisionDetectionGoal &t_other)
Copy Constructor.
Provides a C++ wrapper around wb_vision_detection_goal_post.
void from_string(const std::string &t_str)
std::string description()
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
struct wb_vision_detection_goal_post post2
Second post found.
enum GoalOptions sightingType
Goal detection details.
struct wb_vision_detection_goal_post post1
First post found.
const char * wb_vision_detection_goal_description(const struct wb_vision_detection_goal *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_vision_detection_goal_to_string(const struct wb_vision_detection_goal *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_vision_detection_goal * wb_vision_detection_goal_from_string(struct wb_vision_detection_goal *self, const char *str)
Convert from a string.
#define VISION_DETECTION_GOAL_TO_STRING_BUFFER_SIZE
#define VISION_DETECTION_GOAL_DESC_BUFFER_SIZE