60#ifndef guWhiteboard_VisionFieldFeature_h
61#define guWhiteboard_VisionFieldFeature_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionFieldFeature_DEFINED
73#define guWhiteboard_VisionFieldFeature_DEFINED
75#undef VisionFieldFeature_DEFINED
76#define VisionFieldFeature_DEFINED
80#include <guunits/guunits.h>
81#include <gucoordinates/gucoordinates.h>
106 this->init(t_coordinate, t_camera);
147 return !(*
this == t_other);
157 return !(*
this == t_other);
190#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
200#ifdef USE_WB_VISION_FIELD_FEATURE_C_CONVERSION
203 std::string descr = buffer;
206 std::ostringstream ss;
209 ss <<
"camera=" <<
static_cast<unsigned>(this->
camera());
215#ifdef USE_WB_VISION_FIELD_FEATURE_C_CONVERSION
218 std::string toString = buffer;
221 std::ostringstream ss;
224 ss << static_cast<unsigned>(this->
camera());
229#ifdef USE_WB_VISION_FIELD_FEATURE_C_CONVERSION
234 char * str_cstr =
const_cast<char *
>(t_str.c_str());
235 size_t temp_length = strlen(str_cstr);
236 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
241 char* var_str = &var_str_buffer[0];
243 char* key = &key_buffer[0];
250 if (index == 0 && str_cstr[0] ==
'{') {
256 for (
int i = index; i < length; i++) {
258 if (bracecount == 0 && str_cstr[i] ==
'=') {
263 if (bracecount == 0 && isspace(str_cstr[i])) {
270 if (bracecount == 0 && str_cstr[i] ==
',') {
274 if (str_cstr[i] ==
'{') {
278 if (str_cstr[i] ==
'}') {
280 if (bracecount < 0) {
285 if (i == length - 1) {
289 if (endKey >= startKey && endKey - startKey < length) {
290 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
291 key[(endKey - startKey) + 1] = 0;
295 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
296 var_str[(index - startVar) + 1] = 0;
302 if (strlen(key) > 0) {
303 if (0 == strcmp(
"coordinate", key)) {
305 }
else if (0 == strcmp(
"camera", key)) {
322 this->
set_camera(
static_cast<uint8_t
>(atoi(var_str)));
329 }
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_field_feature.
const PixelCoordinate & coordinate() const
GU::PixelCoordinate coordinatePixelCoordinate(const uint16_t resWidth, const uint16_t resHeight)
WHITEBOARD_POSTER_STRING_CONVERSION.
void from_string(const std::string &t_str)
VisionFieldFeature(const struct wb_vision_field_feature &t_other)
Copy Constructor.
bool operator==(const VisionFieldFeature &t_other) const
VisionFieldFeature(const VisionFieldFeature &t_other)
Copy Constructor.
const uint8_t & camera() const
VisionFieldFeature(const std::string &t_str)
String Constructor.
std::string description()
PixelCoordinate & coordinate()
VisionFieldFeature(struct wb_pixel_coordinate t_coordinate=wb_pixel_coordinate(), uint8_t t_camera=1)
Create a new VisionFieldFeature.
bool operator!=(const VisionFieldFeature &t_other) const
VisionFieldFeature & operator=(const VisionFieldFeature &t_other)
Copy Assignment Operator.
void set_coordinate(const PixelCoordinate &t_newValue)
void set_camera(const uint8_t &t_newValue)
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
struct wb_pixel_coordinate coordinate
The pixel coordinate.
uint8_t camera
camera it was seen on
const char * wb_vision_field_feature_to_string(const struct wb_vision_field_feature *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_vision_field_feature_description(const struct wb_vision_field_feature *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_vision_field_feature * wb_vision_field_feature_from_string(struct wb_vision_field_feature *self, const char *str)
Convert from a string.
#define VISION_FIELD_FEATURE_TO_STRING_BUFFER_SIZE
#define VISION_FIELD_FEATURE_DESC_BUFFER_SIZE