60#ifndef guWhiteboard_VisionDetectionGoalPost_h
61#define guWhiteboard_VisionDetectionGoalPost_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionGoalPost_DEFINED
73#define guWhiteboard_VisionDetectionGoalPost_DEFINED
75#undef VisionDetectionGoalPost_DEFINED
76#define VisionDetectionGoalPost_DEFINED
80#include <guunits/guunits.h>
81#include <gucoordinates/gucoordinates.h>
84#include <guunits/guunits.h>
85#include <gucoordinates/gucoordinates.h>
88#include <guunits/guunits.h>
89#include <gucoordinates/gucoordinates.h>
92#include <guunits/guunits.h>
93#include <gucoordinates/gucoordinates.h>
122 this->init(t_sightingType, t_orientation, t_topLeftCoordinate, t_topRightCoordinate, t_bottomLeftCoordinate, t_bottomRightCoordinate);
167 return !(*
this == t_other);
177 return !(*
this == t_other);
270#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
280#ifdef USE_WB_VISION_DETECTION_GOAL_POST_C_CONVERSION
283 std::string descr = buffer;
286 std::ostringstream ss;
290 ss <<
"sightingType=" <<
"FullPostSeen";
295 ss <<
"sightingType=" <<
"NoPostDetected";
300 ss <<
"sightingType=" <<
"PartialPostSeen";
308 ss <<
"orientation=" <<
"GenericPost";
313 ss <<
"orientation=" <<
"LeftPost";
318 ss <<
"orientation=" <<
"RightPost";
335#ifdef USE_WB_VISION_DETECTION_GOAL_POST_C_CONVERSION
338 std::string toString = buffer;
341 std::ostringstream ss;
345 ss <<
"FullPostSeen";
350 ss <<
"NoPostDetected";
355 ss <<
"PartialPostSeen";
389#ifdef USE_WB_VISION_DETECTION_GOAL_POST_C_CONVERSION
394 char * str_cstr =
const_cast<char *
>(t_str.c_str());
395 size_t temp_length = strlen(str_cstr);
396 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
401 char* var_str = &var_str_buffer[0];
403 char* key = &key_buffer[0];
410 if (index == 0 && str_cstr[0] ==
'{') {
416 for (
int i = index; i < length; i++) {
418 if (bracecount == 0 && str_cstr[i] ==
'=') {
423 if (bracecount == 0 && isspace(str_cstr[i])) {
430 if (bracecount == 0 && str_cstr[i] ==
',') {
434 if (str_cstr[i] ==
'{') {
438 if (str_cstr[i] ==
'}') {
440 if (bracecount < 0) {
445 if (i == length - 1) {
449 if (endKey >= startKey && endKey - startKey < length) {
450 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
451 key[(endKey - startKey) + 1] = 0;
455 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
456 var_str[(index - startVar) + 1] = 0;
462 if (strlen(key) > 0) {
463 if (0 == strcmp(
"sightingType", key)) {
465 }
else if (0 == strcmp(
"orientation", key)) {
467 }
else if (0 == strcmp(
"topLeftCoordinate", key)) {
469 }
else if (0 == strcmp(
"topRightCoordinate", key)) {
471 }
else if (0 == strcmp(
"bottomLeftCoordinate", key)) {
473 }
else if (0 == strcmp(
"bottomRightCoordinate", key)) {
483 if (strcmp(
"FullPostSeen", var_str) == 0) {
484#pragma clang diagnostic push
485#pragma clang diagnostic ignored "-Wbad-function-cast"
487#pragma clang diagnostic pop
488 }
else if (strcmp(
"NoPostDetected", var_str) == 0) {
489#pragma clang diagnostic push
490#pragma clang diagnostic ignored "-Wbad-function-cast"
492#pragma clang diagnostic pop
493 }
else if (strcmp(
"PartialPostSeen", var_str) == 0) {
494#pragma clang diagnostic push
495#pragma clang diagnostic ignored "-Wbad-function-cast"
497#pragma clang diagnostic pop
499#pragma clang diagnostic push
500#pragma clang diagnostic ignored "-Wbad-function-cast"
502#pragma clang diagnostic pop
508 if (strcmp(
"GenericPost", var_str) == 0) {
509#pragma clang diagnostic push
510#pragma clang diagnostic ignored "-Wbad-function-cast"
512#pragma clang diagnostic pop
513 }
else if (strcmp(
"LeftPost", var_str) == 0) {
514#pragma clang diagnostic push
515#pragma clang diagnostic ignored "-Wbad-function-cast"
517#pragma clang diagnostic pop
518 }
else if (strcmp(
"RightPost", var_str) == 0) {
519#pragma clang diagnostic push
520#pragma clang diagnostic ignored "-Wbad-function-cast"
522#pragma clang diagnostic pop
524#pragma clang diagnostic push
525#pragma clang diagnostic ignored "-Wbad-function-cast"
527#pragma clang diagnostic pop
563 }
while(index < length);
Provides a C++ wrapper around wb_pixel_coordinate.
std::string description()
void from_string(const std::string &t_str)
GU::PixelCoordinate pixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
Provides a C++ wrapper around wb_vision_detection_goal_post.
VisionDetectionGoalPost(const std::string &t_str)
String Constructor.
enum GoalPostOrientation & orientation()
PixelCoordinate & topRightCoordinate()
const PixelCoordinate & topRightCoordinate() const
VisionDetectionGoalPost(const VisionDetectionGoalPost &t_other)
Copy Constructor.
void set_orientation(const enum GoalPostOrientation &t_newValue)
GU::PixelCoordinate topRightCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
GU::PixelCoordinate bottomLeftCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
PixelCoordinate & bottomLeftCoordinate()
void set_bottomRightCoordinate(const PixelCoordinate &t_newValue)
PixelCoordinate & topLeftCoordinate()
const PixelCoordinate & topLeftCoordinate() const
const PixelCoordinate & bottomLeftCoordinate() const
void from_string(const std::string &t_str)
bool operator!=(const VisionDetectionGoalPost &t_other) const
void set_topLeftCoordinate(const PixelCoordinate &t_newValue)
enum GoalPostOptions & sightingType() const
VisionDetectionGoalPost(enum GoalPostOptions t_sightingType=NoPostDetected, enum GoalPostOrientation t_orientation=GenericPost, struct wb_pixel_coordinate t_topLeftCoordinate=wb_pixel_coordinate(), struct wb_pixel_coordinate t_topRightCoordinate=wb_pixel_coordinate(), struct wb_pixel_coordinate t_bottomLeftCoordinate=wb_pixel_coordinate(), struct wb_pixel_coordinate t_bottomRightCoordinate=wb_pixel_coordinate())
Create a new VisionDetectionGoalPost.
bool operator==(const VisionDetectionGoalPost &t_other) const
GU::PixelCoordinate bottomRightCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
void set_bottomLeftCoordinate(const PixelCoordinate &t_newValue)
GU::PixelCoordinate topLeftCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
WHITEBOARD_POSTER_STRING_CONVERSION.
enum GoalPostOptions & sightingType()
VisionDetectionGoalPost & operator=(const VisionDetectionGoalPost &t_other)
Copy Assignment Operator.
VisionDetectionGoalPost(const struct wb_vision_detection_goal_post &t_other)
Copy Constructor.
void set_sightingType(const enum GoalPostOptions &t_newValue)
PixelCoordinate & bottomRightCoordinate()
enum GoalPostOrientation & orientation() const
void set_topRightCoordinate(const PixelCoordinate &t_newValue)
const PixelCoordinate & bottomRightCoordinate() const
std::string description()
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
struct wb_pixel_coordinate topLeftCoordinate
The top left pixel coordinate.
enum GoalPostOptions sightingType
Goal post details.
enum GoalPostOrientation orientation
Goal post orientation.
struct wb_pixel_coordinate bottomRightCoordinate
The bottom right pixel coordinate.
struct wb_pixel_coordinate bottomLeftCoordinate
The bottom left pixel coordinate.
struct wb_pixel_coordinate topRightCoordinate
The top right pixel coordinate.
const char * wb_vision_detection_goal_post_to_string(const struct wb_vision_detection_goal_post *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_vision_detection_goal_post * wb_vision_detection_goal_post_from_string(struct wb_vision_detection_goal_post *self, const char *str)
Convert from a string.
const char * wb_vision_detection_goal_post_description(const struct wb_vision_detection_goal_post *self, char *descString, size_t bufferSize)
Convert to a description string.
@ FullPostSeen
Saw the entire post.
@ PartialPostSeen
Saw part of a post. Part in the image, part out.
@ NoPostDetected
Didn't see a post.
#define VISION_DETECTION_GOAL_POST_TO_STRING_BUFFER_SIZE
@ RightPost
This is the right post of a goal.
@ GenericPost
Could not determine post orientation.
@ LeftPost
This is the left post of a goal.
#define VISION_DETECTION_GOAL_POST_DESC_BUFFER_SIZE