60#ifndef guWhiteboard_VisionDetectionHorizon_h
61#define guWhiteboard_VisionDetectionHorizon_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionHorizon_DEFINED
73#define guWhiteboard_VisionDetectionHorizon_DEFINED
75#undef VisionDetectionHorizon_DEFINED
76#define VisionDetectionHorizon_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>
116 this->init(t_horizonType, t_leftCoordinate, t_centerCoordinate, t_rightCoordinate);
159 return !(*
this == t_other);
169 return !(*
this == t_other);
232#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
242#ifdef USE_WB_VISION_DETECTION_HORIZON_C_CONVERSION
245 std::string descr = buffer;
248 std::ostringstream ss;
252 ss <<
"horizonType=" <<
"CornerHorizon";
257 ss <<
"horizonType=" <<
"HorizonFailed";
262 ss <<
"horizonType=" <<
"OnlyField";
267 ss <<
"horizonType=" <<
"SingleHorizon";
282#ifdef USE_WB_VISION_DETECTION_HORIZON_C_CONVERSION
285 std::string toString = buffer;
288 std::ostringstream ss;
292 ss <<
"CornerHorizon";
297 ss <<
"HorizonFailed";
307 ss <<
"SingleHorizon";
321#ifdef USE_WB_VISION_DETECTION_HORIZON_C_CONVERSION
326 char * str_cstr =
const_cast<char *
>(t_str.c_str());
327 size_t temp_length = strlen(str_cstr);
328 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
333 char* var_str = &var_str_buffer[0];
335 char* key = &key_buffer[0];
342 if (index == 0 && str_cstr[0] ==
'{') {
348 for (
int i = index; i < length; i++) {
350 if (bracecount == 0 && str_cstr[i] ==
'=') {
355 if (bracecount == 0 && isspace(str_cstr[i])) {
362 if (bracecount == 0 && str_cstr[i] ==
',') {
366 if (str_cstr[i] ==
'{') {
370 if (str_cstr[i] ==
'}') {
372 if (bracecount < 0) {
377 if (i == length - 1) {
381 if (endKey >= startKey && endKey - startKey < length) {
382 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
383 key[(endKey - startKey) + 1] = 0;
387 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
388 var_str[(index - startVar) + 1] = 0;
394 if (strlen(key) > 0) {
395 if (0 == strcmp(
"horizonType", key)) {
397 }
else if (0 == strcmp(
"leftCoordinate", key)) {
399 }
else if (0 == strcmp(
"centerCoordinate", key)) {
401 }
else if (0 == strcmp(
"rightCoordinate", key)) {
411 if (strcmp(
"CornerHorizon", var_str) == 0) {
412#pragma clang diagnostic push
413#pragma clang diagnostic ignored "-Wbad-function-cast"
415#pragma clang diagnostic pop
416 }
else if (strcmp(
"HorizonFailed", var_str) == 0) {
417#pragma clang diagnostic push
418#pragma clang diagnostic ignored "-Wbad-function-cast"
420#pragma clang diagnostic pop
421 }
else if (strcmp(
"OnlyField", var_str) == 0) {
422#pragma clang diagnostic push
423#pragma clang diagnostic ignored "-Wbad-function-cast"
425#pragma clang diagnostic pop
426 }
else if (strcmp(
"SingleHorizon", var_str) == 0) {
427#pragma clang diagnostic push
428#pragma clang diagnostic ignored "-Wbad-function-cast"
430#pragma clang diagnostic pop
432#pragma clang diagnostic push
433#pragma clang diagnostic ignored "-Wbad-function-cast"
435#pragma clang diagnostic pop
464 }
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_horizon.
VisionDetectionHorizon & operator=(const VisionDetectionHorizon &t_other)
Copy Assignment Operator.
GU::PixelCoordinate rightCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
GU::PixelCoordinate leftCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
WHITEBOARD_POSTER_STRING_CONVERSION.
GU::PixelCoordinate centerCoordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
const PixelCoordinate & leftCoordinate() const
bool operator==(const VisionDetectionHorizon &t_other) const
void set_leftCoordinate(const PixelCoordinate &t_newValue)
VisionDetectionHorizon(const VisionDetectionHorizon &t_other)
Copy Constructor.
PixelCoordinate & rightCoordinate()
PixelCoordinate & centerCoordinate()
void set_centerCoordinate(const PixelCoordinate &t_newValue)
VisionDetectionHorizon(enum HorizonOptions t_horizonType=HorizonFailed, struct wb_pixel_coordinate t_leftCoordinate=wb_pixel_coordinate(), struct wb_pixel_coordinate t_centerCoordinate=wb_pixel_coordinate(), struct wb_pixel_coordinate t_rightCoordinate=wb_pixel_coordinate())
Create a new VisionDetectionHorizon.
void set_horizonType(const enum HorizonOptions &t_newValue)
enum HorizonOptions & horizonType()
VisionDetectionHorizon(const std::string &t_str)
String Constructor.
const PixelCoordinate & rightCoordinate() const
void from_string(const std::string &t_str)
const PixelCoordinate & centerCoordinate() const
PixelCoordinate & leftCoordinate()
std::string description()
bool operator!=(const VisionDetectionHorizon &t_other) const
enum HorizonOptions & horizonType() const
VisionDetectionHorizon(const struct wb_vision_detection_horizon &t_other)
Copy Constructor.
void set_rightCoordinate(const PixelCoordinate &t_newValue)
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
enum HorizonOptions horizonType
Type of Horizon.
struct wb_pixel_coordinate leftCoordinate
Left horizon point pixel coordinate.
struct wb_pixel_coordinate rightCoordinate
Right horizon point pixel coordinate.
struct wb_pixel_coordinate centerCoordinate
Center horizon point pixel coordinate.
const char * wb_vision_detection_horizon_to_string(const struct wb_vision_detection_horizon *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_vision_detection_horizon * wb_vision_detection_horizon_from_string(struct wb_vision_detection_horizon *self, const char *str)
Convert from a string.
const char * wb_vision_detection_horizon_description(const struct wb_vision_detection_horizon *self, char *descString, size_t bufferSize)
Convert to a description string.
#define VISION_DETECTION_HORIZON_TO_STRING_BUFFER_SIZE
#define VISION_DETECTION_HORIZON_DESC_BUFFER_SIZE