60#ifndef guWhiteboard_VisionFieldFeatures_h
61#define guWhiteboard_VisionFieldFeatures_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionFieldFeatures_DEFINED
73#define guWhiteboard_VisionFieldFeatures_DEFINED
75#undef VisionFieldFeatures_DEFINED
76#define VisionFieldFeatures_DEFINED
92 void init(
const struct wb_vision_field_feature t_fieldCorner[8] = NULLPTR,
const struct wb_vision_field_feature t_fieldIntersection[8] = NULLPTR,
const struct wb_vision_field_feature t_fieldCrosses[3] = NULLPTR, uint8_t t_numCorners = 0, uint8_t t_numIntersections = 0, uint8_t t_numCrosses = 0, uint16_t t_res_width = 0, uint16_t t_res_height = 0) {
93 if (t_fieldCorner != NULLPTR) {
99 if (t_fieldIntersection != NULLPTR) {
105 if (t_fieldCrosses != NULLPTR) {
124 this->init(t_fieldCorner, t_fieldIntersection, t_fieldCrosses, t_numCorners, t_numIntersections, t_numCrosses, t_res_width, t_res_height);
167 for (
int fieldCorner_0_index = 0; fieldCorner_0_index < 8; fieldCorner_0_index++)
171 for (
int fieldIntersection_0_index = 0; fieldIntersection_0_index < 8; fieldIntersection_0_index++)
175 for (
int fieldCrosses_0_index = 0; fieldCrosses_0_index < 3; fieldCrosses_0_index++)
184 return !(*
this == t_other);
194 return !(*
this == t_other);
362#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
372#ifdef USE_WB_VISION_FIELD_FEATURES_C_CONVERSION
375 std::string descr = buffer;
378 std::ostringstream ss;
379 bool fieldCorner_first =
true;
380 ss <<
"fieldCorner={";
383 fieldCorner_first =
false;
387 bool fieldIntersection_first =
true;
388 ss <<
"fieldIntersection={";
391 fieldIntersection_first =
false;
395 bool fieldCrosses_first =
true;
396 ss <<
"fieldCrosses={";
399 fieldCrosses_first =
false;
403 ss <<
"numCorners=" <<
static_cast<unsigned>(this->
numCorners());
405 ss <<
"numIntersections=" <<
static_cast<unsigned>(this->
numIntersections());
407 ss <<
"numCrosses=" <<
static_cast<unsigned>(this->
numCrosses());
409 ss <<
"res_width=" <<
static_cast<unsigned>(this->
res_width());
411 ss <<
"res_height=" <<
static_cast<unsigned>(this->
res_height());
417#ifdef USE_WB_VISION_FIELD_FEATURES_C_CONVERSION
420 std::string toString = buffer;
423 std::ostringstream ss;
424 bool fieldCorner_first =
true;
428 fieldCorner_first =
false;
432 bool fieldIntersection_first =
true;
436 fieldIntersection_first =
false;
440 bool fieldCrosses_first =
true;
444 fieldCrosses_first =
false;
448 ss << static_cast<unsigned>(this->
numCorners());
452 ss << static_cast<unsigned>(this->
numCrosses());
454 ss << static_cast<unsigned>(this->
res_width());
456 ss << static_cast<unsigned>(this->
res_height());
461#ifdef USE_WB_VISION_FIELD_FEATURES_C_CONVERSION
466 char * str_cstr =
const_cast<char *
>(t_str.c_str());
467 size_t temp_length = strlen(str_cstr);
468 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
473 char* var_str = &var_str_buffer[0];
475 char* key = &key_buffer[0];
483 if (index == 0 && str_cstr[0] ==
'{') {
489 for (
int i = index; i < length; i++) {
491 if (bracecount == 0 && str_cstr[i] ==
'=') {
496 if (bracecount == 0 && isspace(str_cstr[i])) {
503 if (bracecount == 0 && str_cstr[i] ==
',') {
507 if (str_cstr[i] ==
'{') {
509 if (bracecount == 1) {
514 if (str_cstr[i] ==
'}') {
516 if (bracecount < 0) {
521 if (i == length - 1) {
525 if (endKey >= startKey && endKey - startKey < length) {
526 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
527 key[(endKey - startKey) + 1] = 0;
531 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
532 var_str[(index - startVar) + 1] = 0;
538 if (strlen(key) > 0) {
539 if (0 == strcmp(
"fieldCorner", key)) {
541 }
else if (0 == strcmp(
"fieldIntersection", key)) {
543 }
else if (0 == strcmp(
"fieldCrosses", key)) {
545 }
else if (0 == strcmp(
"numCorners", key)) {
547 }
else if (0 == strcmp(
"numIntersections", key)) {
549 }
else if (0 == strcmp(
"numCrosses", key)) {
551 }
else if (0 == strcmp(
"res_width", key)) {
553 }
else if (0 == strcmp(
"res_height", key)) {
563 int restartIndex = index;
564 index = lastBrace + 1;
570 for (
int i = index; i < length; i++) {
572 if (bracecount == 0 && str_cstr[i] ==
'=') {
577 if (bracecount == 0 && isspace(str_cstr[i])) {
584 if (bracecount == 0 && str_cstr[i] ==
',') {
588 if (str_cstr[i] ==
'{') {
592 if (str_cstr[i] ==
'}') {
594 if (bracecount < 0) {
599 if (i == length - 1) {
603 if (endKey >= startKey && endKey - startKey < length) {
604 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
605 key[(endKey - startKey) + 1] = 0;
609 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
610 var_str[(index - startVar) + 1] = 0;
621 index = restartIndex;
626 int restartIndex = index;
627 index = lastBrace + 1;
633 for (
int i = index; i < length; i++) {
635 if (bracecount == 0 && str_cstr[i] ==
'=') {
640 if (bracecount == 0 && isspace(str_cstr[i])) {
647 if (bracecount == 0 && str_cstr[i] ==
',') {
651 if (str_cstr[i] ==
'{') {
655 if (str_cstr[i] ==
'}') {
657 if (bracecount < 0) {
662 if (i == length - 1) {
666 if (endKey >= startKey && endKey - startKey < length) {
667 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
668 key[(endKey - startKey) + 1] = 0;
672 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
673 var_str[(index - startVar) + 1] = 0;
684 index = restartIndex;
689 int restartIndex = index;
690 index = lastBrace + 1;
696 for (
int i = index; i < length; i++) {
698 if (bracecount == 0 && str_cstr[i] ==
'=') {
703 if (bracecount == 0 && isspace(str_cstr[i])) {
710 if (bracecount == 0 && str_cstr[i] ==
',') {
714 if (str_cstr[i] ==
'{') {
718 if (str_cstr[i] ==
'}') {
720 if (bracecount < 0) {
725 if (i == length - 1) {
729 if (endKey >= startKey && endKey - startKey < length) {
730 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
731 key[(endKey - startKey) + 1] = 0;
735 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
736 var_str[(index - startVar) + 1] = 0;
747 index = restartIndex;
779 }
while(index < length);
Provides a C++ wrapper around wb_vision_field_feature.
void from_string(const std::string &t_str)
Provides a C++ wrapper around wb_vision_field_features.
void set_fieldCorner(const VisionFieldFeature *t_newValue)
size_t fieldIntersection_size() const
const uint16_t & res_height() const
size_t fieldCorner_size() const
VisionFieldFeatures(const VisionFieldFeatures &t_other)
Copy Constructor.
void set_fieldIntersection(const VisionFieldFeature *t_newValue)
VisionFieldFeature & fieldIntersection(int t_i)
VisionFieldFeature & fieldCrosses(int t_i)
VisionFieldFeatures(const struct wb_vision_field_features &t_other)
Copy Constructor.
void set_res_width(const uint16_t &t_newValue)
bool operator==(const VisionFieldFeatures &t_other) const
VisionFieldFeatures(const struct wb_vision_field_feature t_fieldCorner[8]=NULLPTR, const struct wb_vision_field_feature t_fieldIntersection[8]=NULLPTR, const struct wb_vision_field_feature t_fieldCrosses[3]=NULLPTR, uint8_t t_numCorners=0, uint8_t t_numIntersections=0, uint8_t t_numCrosses=0, uint16_t t_res_width=0, uint16_t t_res_height=0)
Create a new VisionFieldFeatures.
void set_fieldIntersection(const VisionFieldFeature &t_newValue, int t_i)
VisionFieldFeatures(const std::string &t_str)
String Constructor.
uint8_t & numIntersections()
const VisionFieldFeature * fieldCrosses() const
void set_numCorners(const uint8_t &t_newValue)
const uint8_t & numCrosses() const
void set_fieldCrosses(const VisionFieldFeature &t_newValue, int t_i)
const VisionFieldFeature * fieldCorner() const
const VisionFieldFeature & fieldCrosses(int t_i) const
void from_string(const std::string &t_str)
const VisionFieldFeature & fieldCorner(int t_i) const
void set_numCrosses(const uint8_t &t_newValue)
VisionFieldFeatures & operator=(const VisionFieldFeatures &t_other)
Copy Assignment Operator.
std::string description()
void set_res_height(const uint16_t &t_newValue)
const uint8_t & numCorners() const
const VisionFieldFeature & fieldIntersection(int t_i) const
const uint8_t & numIntersections() const
bool operator!=(const VisionFieldFeatures &t_other) const
void set_fieldCorner(const VisionFieldFeature &t_newValue, int t_i)
VisionFieldFeature & fieldCorner(int t_i)
void set_fieldCrosses(const VisionFieldFeature *t_newValue)
const uint16_t & res_width() const
void set_numIntersections(const uint8_t &t_newValue)
const VisionFieldFeature * fieldIntersection() const
size_t fieldCrosses_size() const
WHITEBOARD_POSTER_STRING_CONVERSION.
Posting by Vision of the field corners, T-Intersections and crosses that have been seen.
uint8_t numCrosses
Numer of Crosses in this message.
uint8_t numCorners
Number of corners in this message.
uint16_t res_width
The resolution width.
struct wb_vision_field_feature fieldIntersection[8]
Location of T-Intersections on the field.
uint8_t numIntersections
Number of T-Intersections in this message.
struct wb_vision_field_feature fieldCorner[8]
Location of corners on the field.
uint16_t res_height
The resolution height.
struct wb_vision_field_feature fieldCrosses[3]
Location of T-Intersections on the field.
struct wb_vision_field_features * wb_vision_field_features_from_string(struct wb_vision_field_features *self, const char *str)
Convert from a string.
const char * wb_vision_field_features_to_string(const struct wb_vision_field_features *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_vision_field_features_description(const struct wb_vision_field_features *self, char *descString, size_t bufferSize)
Convert to a description string.
#define VISION_FIELD_FEATURES_FIELDCORNER_ARRAY_SIZE
WHITEBOARD_POSTER_STRING_CONVERSION.
#define VISION_FIELD_FEATURES_DESC_BUFFER_SIZE
#define VISION_FIELD_FEATURES_FIELDCROSSES_ARRAY_SIZE
#define VISION_FIELD_FEATURES_TO_STRING_BUFFER_SIZE
#define VISION_FIELD_FEATURES_FIELDINTERSECTION_ARRAY_SIZE