60#ifndef guWhiteboard_VisionDetectionGoals_h
61#define guWhiteboard_VisionDetectionGoals_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionGoals_DEFINED
73#define guWhiteboard_VisionDetectionGoals_DEFINED
75#undef VisionDetectionGoals_DEFINED
76#define VisionDetectionGoals_DEFINED
92 void init(uint64_t t_frameNumber = 0,
const struct wb_vision_detection_goal t_goals[2] = NULLPTR, uint16_t t_res_width = 0, uint16_t t_res_height = 0) {
94 if (t_goals != NULLPTR) {
110 this->init(t_frameNumber, t_goals, t_res_width, t_res_height);
151 for (
int goals_0_index = 0; goals_0_index < 2; goals_0_index++)
160 return !(*
this == t_other);
170 return !(*
this == t_other);
248#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
258#ifdef USE_WB_VISION_DETECTION_GOALS_C_CONVERSION
261 std::string descr = buffer;
264 std::ostringstream ss;
267 bool goals_first =
true;
275 ss <<
"res_width=" <<
static_cast<unsigned>(this->
res_width());
277 ss <<
"res_height=" <<
static_cast<unsigned>(this->
res_height());
283#ifdef USE_WB_VISION_DETECTION_GOALS_C_CONVERSION
286 std::string toString = buffer;
289 std::ostringstream ss;
292 bool goals_first =
true;
300 ss << static_cast<unsigned>(this->
res_width());
302 ss << static_cast<unsigned>(this->
res_height());
307#ifdef USE_WB_VISION_DETECTION_GOALS_C_CONVERSION
312 char * str_cstr =
const_cast<char *
>(t_str.c_str());
313 size_t temp_length = strlen(str_cstr);
314 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
319 char* var_str = &var_str_buffer[0];
321 char* key = &key_buffer[0];
329 if (index == 0 && str_cstr[0] ==
'{') {
335 for (
int i = index; i < length; i++) {
337 if (bracecount == 0 && str_cstr[i] ==
'=') {
342 if (bracecount == 0 && isspace(str_cstr[i])) {
349 if (bracecount == 0 && str_cstr[i] ==
',') {
353 if (str_cstr[i] ==
'{') {
355 if (bracecount == 1) {
360 if (str_cstr[i] ==
'}') {
362 if (bracecount < 0) {
367 if (i == length - 1) {
371 if (endKey >= startKey && endKey - startKey < length) {
372 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
373 key[(endKey - startKey) + 1] = 0;
377 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
378 var_str[(index - startVar) + 1] = 0;
384 if (strlen(key) > 0) {
385 if (0 == strcmp(
"frameNumber", key)) {
387 }
else if (0 == strcmp(
"goals", key)) {
389 }
else if (0 == strcmp(
"res_width", key)) {
391 }
else if (0 == strcmp(
"res_height", key)) {
410 int restartIndex = index;
411 index = lastBrace + 1;
417 for (
int i = index; i < length; i++) {
419 if (bracecount == 0 && str_cstr[i] ==
'=') {
424 if (bracecount == 0 && isspace(str_cstr[i])) {
431 if (bracecount == 0 && str_cstr[i] ==
',') {
435 if (str_cstr[i] ==
'{') {
439 if (str_cstr[i] ==
'}') {
441 if (bracecount < 0) {
446 if (i == length - 1) {
450 if (endKey >= startKey && endKey - startKey < length) {
451 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
452 key[(endKey - startKey) + 1] = 0;
456 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
457 var_str[(index - startVar) + 1] = 0;
468 index = restartIndex;
485 }
while(index < length);
Provides a C++ wrapper around wb_vision_detection_goal.
void from_string(const std::string &t_str)
Provides a C++ wrapper around wb_vision_detection_goals.
bool operator==(const VisionDetectionGoals &t_other) const
VisionDetectionGoals(const struct wb_vision_detection_goals &t_other)
Copy Constructor.
void from_string(const std::string &t_str)
void set_res_height(const uint16_t &t_newValue)
size_t goals_size() const
const VisionDetectionGoal * goals() const
const VisionDetectionGoal & goals(int t_i) const
void set_goals(const VisionDetectionGoal &t_newValue, int t_i)
const uint16_t & res_width() const
VisionDetectionGoals(uint64_t t_frameNumber=0, const struct wb_vision_detection_goal t_goals[2]=NULLPTR, uint16_t t_res_width=0, uint16_t t_res_height=0)
Create a new VisionDetectionGoals.
VisionDetectionGoals(const VisionDetectionGoals &t_other)
Copy Constructor.
void set_res_width(const uint16_t &t_newValue)
const uint64_t & frameNumber() const
bool operator!=(const VisionDetectionGoals &t_other) const
void set_goals(const VisionDetectionGoal *t_newValue)
void set_frameNumber(const uint64_t &t_newValue)
VisionDetectionGoals(const std::string &t_str)
String Constructor.
VisionDetectionGoals & operator=(const VisionDetectionGoals &t_other)
Copy Assignment Operator.
std::string description()
VisionDetectionGoal & goals(int t_i)
const uint16_t & res_height() const
WHITEBOARD_POSTER_STRING_CONVERSION.
Array of fieldGoals, one instance reported by each camera.
uint16_t res_height
The resolution height.
uint16_t res_width
The resolution width.
uint64_t frameNumber
visionFrameNumber
struct wb_vision_detection_goal goals[2]
goal objects
const char * wb_vision_detection_goals_to_string(const struct wb_vision_detection_goals *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_vision_detection_goals_description(const struct wb_vision_detection_goals *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_vision_detection_goals * wb_vision_detection_goals_from_string(struct wb_vision_detection_goals *self, const char *str)
Convert from a string.
#define VISION_DETECTION_GOALS_DESC_BUFFER_SIZE
#define VISION_DETECTION_GOALS_TO_STRING_BUFFER_SIZE
#define VISION_DETECTION_GOALS_GOALS_ARRAY_SIZE
WHITEBOARD_POSTER_STRING_CONVERSION.