60#ifndef guWhiteboard_MachineFilteredVision_h 
   61#define guWhiteboard_MachineFilteredVision_h 
   63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION 
   72#undef guWhiteboard_MachineFilteredVision_DEFINED 
   73#define guWhiteboard_MachineFilteredVision_DEFINED 
   75#undef MachineFilteredVision_DEFINED 
   76#define MachineFilteredVision_DEFINED 
   90        void init(int8_t t_ball_direction = 0, uint16_t t_ball_distance = 0, 
bool t_ball_visible = 0, int8_t t_goal_direction = 0, uint16_t t_goal_distance = 0, 
bool t_goal_visible = 0, 
enum GoalSightingType t_goal_sightingType = 
NoSightingType) {
 
  106            this->init(t_ball_direction, t_ball_distance, t_ball_visible, t_goal_direction, t_goal_distance, t_goal_visible, t_goal_sightingType);
 
  152            return !(*
this == t_other);
 
  162            return !(*
this == t_other);
 
  270#ifdef WHITEBOARD_POSTER_STRING_CONVERSION 
  280#ifdef USE_WB_MACHINE_FILTERED_VISION_C_CONVERSION 
  283            std::string descr = buffer;
 
  286            std::ostringstream ss;
 
  287            ss << 
"ball_direction=" << 
static_cast<signed>(this->
ball_direction());
 
  289            ss << 
"ball_distance=" << 
static_cast<unsigned>(this->
ball_distance());
 
  291            ss << 
"ball_visible=" << (this->
ball_visible() ? 
"true" : 
"false");
 
  293            ss << 
"goal_direction=" << 
static_cast<signed>(this->
goal_direction());
 
  295            ss << 
"goal_distance=" << 
static_cast<unsigned>(this->
goal_distance());
 
  297            ss << 
"goal_visible=" << (this->
goal_visible() ? 
"true" : 
"false");
 
  302                    ss << 
"goal_sightingType=" << 
"GoalSightingType";
 
  307                    ss << 
"goal_sightingType=" << 
"LeftPostSightingType";
 
  312                    ss << 
"goal_sightingType=" << 
"NoSightingType";
 
  317                    ss << 
"goal_sightingType=" << 
"RightPostSightingType";
 
  326#ifdef USE_WB_MACHINE_FILTERED_VISION_C_CONVERSION 
  329            std::string toString = buffer;
 
  332            std::ostringstream ss;
 
  348                    ss << 
"GoalSightingType";
 
  353                    ss << 
"LeftPostSightingType";
 
  358                    ss << 
"NoSightingType";
 
  363                    ss << 
"RightPostSightingType";
 
  371#ifdef USE_WB_MACHINE_FILTERED_VISION_C_CONVERSION 
  376            char * str_cstr = 
const_cast<char *
>(t_str.c_str());
 
  377            size_t temp_length = strlen(str_cstr);
 
  378            int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
 
  383            char* var_str = &var_str_buffer[0];
 
  385            char* key = &key_buffer[0];
 
  392            if (index == 0 && str_cstr[0] == 
'{') {
 
  398                for (
int i = index; i < length; i++) {
 
  400                    if (bracecount == 0 && str_cstr[i] == 
'=') {
 
  405                    if (bracecount == 0 && isspace(str_cstr[i])) {
 
  412                    if (bracecount == 0 && str_cstr[i] == 
',') {
 
  416                    if (str_cstr[i] == 
'{') {
 
  420                    if (str_cstr[i] == 
'}') {
 
  422                        if (bracecount < 0) {
 
  427                    if (i == length - 1) {
 
  431                if (endKey >= startKey && endKey - startKey < length) {
 
  432                    strncpy(key, str_cstr + startKey, 
static_cast<size_t>((endKey - startKey) + 1));
 
  433                    key[(endKey - startKey) + 1] = 0;
 
  437                strncpy(var_str, str_cstr + startVar, 
static_cast<size_t>((index - startVar) + 1));
 
  438                var_str[(index - startVar) + 1] = 0;
 
  444                if (strlen(key) > 0) {
 
  445                    if (0 == strcmp(
"ball_direction", key)) {
 
  447                    } 
else if (0 == strcmp(
"ball_distance", key)) {
 
  449                    } 
else if (0 == strcmp(
"ball_visible", key)) {
 
  451                    } 
else if (0 == strcmp(
"goal_direction", key)) {
 
  453                    } 
else if (0 == strcmp(
"goal_distance", key)) {
 
  455                    } 
else if (0 == strcmp(
"goal_visible", key)) {
 
  457                    } 
else if (0 == strcmp(
"goal_sightingType", key)) {
 
  477                        this->
set_ball_visible(strcmp(var_str, 
"true") == 0 || strcmp(var_str, 
"1") == 0);
 
  492                        this->
set_goal_visible(strcmp(var_str, 
"true") == 0 || strcmp(var_str, 
"1") == 0);
 
  497                        if (strcmp(
"GoalSightingType", var_str) == 0) {
 
  498#pragma clang diagnostic push 
  499#pragma clang diagnostic ignored "-Wbad-function-cast" 
  501#pragma clang diagnostic pop 
  502                        } 
else if (strcmp(
"LeftPostSightingType", var_str) == 0) {
 
  503#pragma clang diagnostic push 
  504#pragma clang diagnostic ignored "-Wbad-function-cast" 
  506#pragma clang diagnostic pop 
  507                        } 
else if (strcmp(
"NoSightingType", var_str) == 0) {
 
  508#pragma clang diagnostic push 
  509#pragma clang diagnostic ignored "-Wbad-function-cast" 
  511#pragma clang diagnostic pop 
  512                        } 
else if (strcmp(
"RightPostSightingType", var_str) == 0) {
 
  513#pragma clang diagnostic push 
  514#pragma clang diagnostic ignored "-Wbad-function-cast" 
  516#pragma clang diagnostic pop 
  518#pragma clang diagnostic push 
  519#pragma clang diagnostic ignored "-Wbad-function-cast" 
  521#pragma clang diagnostic pop 
  529            } 
while(index < length);
 
Provides a C++ wrapper around wb_machine_filtered_vision.
void set_goal_visible(const bool &t_newValue)
MachineFilteredVision(const MachineFilteredVision &t_other)
Copy Constructor.
void set_ball_distance(const uint16_t &t_newValue)
const uint16_t & ball_distance() const
void set_ball_visible(const bool &t_newValue)
void set_goal_sightingType(const enum GoalSightingType &t_newValue)
const bool & goal_visible() const
MachineFilteredVision(int8_t t_ball_direction=0, uint16_t t_ball_distance=0, bool t_ball_visible=0, int8_t t_goal_direction=0, uint16_t t_goal_distance=0, bool t_goal_visible=0, enum GoalSightingType t_goal_sightingType=NoSightingType)
Create a new MachineFilteredVision.
uint16_t & ball_distance()
const uint16_t & goal_distance() const
int8_t & goal_direction()
int8_t & ball_direction()
std::string description()
enum GoalSightingType & goal_sightingType() const
uint16_t & goal_distance()
void set_goal_direction(const int8_t &t_newValue)
const int8_t & goal_direction() const
const int8_t & ball_direction() const
MachineFilteredVision & operator=(const MachineFilteredVision &t_other)
Copy Assignment Operator.
bool operator!=(const MachineFilteredVision &t_other) const
void set_goal_distance(const uint16_t &t_newValue)
const bool & ball_visible() const
MachineFilteredVision(const std::string &t_str)
String Constructor.
MachineFilteredVision(const struct wb_machine_filtered_vision &t_other)
Copy Constructor.
void from_string(const std::string &t_str)
void set_ball_direction(const int8_t &t_newValue)
enum GoalSightingType & goal_sightingType()
bool operator==(const MachineFilteredVision &t_other) const
WHITEBOARD_POSTER_STRING_CONVERSION.
uint16_t goal_distance
CM distance to the ball.
enum GoalSightingType goal_sightingType
The type of the goal sighting.
bool ball_visible
has the ball been seen enough by vision to be considered actually 'visible'.
bool goal_visible
has the ball been seen enough by vision to be considered actually 'visible'.
uint16_t ball_distance
CM distance to the ball.
int8_t goal_direction
degrees, relative to the center of the nao torso.
int8_t ball_direction
degrees, relative to the center of the nao torso.
const char * wb_machine_filtered_vision_to_string(const struct wb_machine_filtered_vision *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_machine_filtered_vision * wb_machine_filtered_vision_from_string(struct wb_machine_filtered_vision *self, const char *str)
Convert from a string.
const char * wb_machine_filtered_vision_description(const struct wb_machine_filtered_vision *self, char *descString, size_t bufferSize)
Convert to a description string.
#define MACHINE_FILTERED_VISION_TO_STRING_BUFFER_SIZE
#define MACHINE_FILTERED_VISION_DESC_BUFFER_SIZE