60#ifndef guWhiteboard_VisionDetectionFeature_h
61#define guWhiteboard_VisionDetectionFeature_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionFeature_DEFINED
73#define guWhiteboard_VisionDetectionFeature_DEFINED
75#undef VisionDetectionFeature_DEFINED
76#define VisionDetectionFeature_DEFINED
103 this->init(t_featureType, t_coordinate);
144 return !(*
this == t_other);
154 return !(*
this == t_other);
187#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
197#ifdef USE_WB_VISION_DETECTION_FEATURE_C_CONVERSION
200 std::string descr = buffer;
203 std::ostringstream ss;
207 ss <<
"featureType=" <<
"FeatureTypeCircle";
212 ss <<
"featureType=" <<
"FeatureTypeL";
217 ss <<
"featureType=" <<
"FeatureTypeT";
222 ss <<
"featureType=" <<
"FeatureTypeX";
227 ss <<
"featureType=" <<
"NUMBER_OF_FEATURE_TYPES";
238#ifdef USE_WB_VISION_DETECTION_FEATURE_C_CONVERSION
241 std::string toString = buffer;
244 std::ostringstream ss;
248 ss <<
"FeatureTypeCircle";
253 ss <<
"FeatureTypeL";
258 ss <<
"FeatureTypeT";
263 ss <<
"FeatureTypeX";
268 ss <<
"NUMBER_OF_FEATURE_TYPES";
278#ifdef USE_WB_VISION_DETECTION_FEATURE_C_CONVERSION
283 char * str_cstr =
const_cast<char *
>(t_str.c_str());
284 size_t temp_length = strlen(str_cstr);
285 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
290 char* var_str = &var_str_buffer[0];
292 char* key = &key_buffer[0];
299 if (index == 0 && str_cstr[0] ==
'{') {
305 for (
int i = index; i < length; i++) {
307 if (bracecount == 0 && str_cstr[i] ==
'=') {
312 if (bracecount == 0 && isspace(str_cstr[i])) {
319 if (bracecount == 0 && str_cstr[i] ==
',') {
323 if (str_cstr[i] ==
'{') {
327 if (str_cstr[i] ==
'}') {
329 if (bracecount < 0) {
334 if (i == length - 1) {
338 if (endKey >= startKey && endKey - startKey < length) {
339 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
340 key[(endKey - startKey) + 1] = 0;
344 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
345 var_str[(index - startVar) + 1] = 0;
351 if (strlen(key) > 0) {
352 if (0 == strcmp(
"featureType", key)) {
354 }
else if (0 == strcmp(
"coordinate", key)) {
364 if (strcmp(
"FeatureTypeCircle", var_str) == 0) {
365#pragma clang diagnostic push
366#pragma clang diagnostic ignored "-Wbad-function-cast"
368#pragma clang diagnostic pop
369 }
else if (strcmp(
"FeatureTypeL", var_str) == 0) {
370#pragma clang diagnostic push
371#pragma clang diagnostic ignored "-Wbad-function-cast"
373#pragma clang diagnostic pop
374 }
else if (strcmp(
"FeatureTypeT", var_str) == 0) {
375#pragma clang diagnostic push
376#pragma clang diagnostic ignored "-Wbad-function-cast"
378#pragma clang diagnostic pop
379 }
else if (strcmp(
"FeatureTypeX", var_str) == 0) {
380#pragma clang diagnostic push
381#pragma clang diagnostic ignored "-Wbad-function-cast"
383#pragma clang diagnostic pop
384 }
else if (strcmp(
"NUMBER_OF_FEATURE_TYPES", var_str) == 0) {
385#pragma clang diagnostic push
386#pragma clang diagnostic ignored "-Wbad-function-cast"
388#pragma clang diagnostic pop
390#pragma clang diagnostic push
391#pragma clang diagnostic ignored "-Wbad-function-cast"
393#pragma clang diagnostic pop
408 }
while(index < length);
Provides a C++ wrapper around wb_polar_coordinate.
void from_string(const std::string &t_str)
std::string description()
Provides a C++ wrapper around wb_vision_detection_feature.
VisionDetectionFeature(const std::string &t_str)
String Constructor.
VisionDetectionFeature(const VisionDetectionFeature &t_other)
Copy Constructor.
const PolarCoordinate & coordinate() const
VisionDetectionFeature & operator=(const VisionDetectionFeature &t_other)
Copy Assignment Operator.
bool operator!=(const VisionDetectionFeature &t_other) const
enum FeatureTypes & featureType()
void set_featureType(const enum FeatureTypes &t_newValue)
PolarCoordinate & coordinate()
bool operator==(const VisionDetectionFeature &t_other) const
std::string description()
void from_string(const std::string &t_str)
VisionDetectionFeature(const struct wb_vision_detection_feature &t_other)
Copy Constructor.
enum FeatureTypes & featureType() const
void set_coordinate(const PolarCoordinate &t_newValue)
VisionDetectionFeature(enum FeatureTypes t_featureType=NUMBER_OF_FEATURE_TYPES, struct wb_polar_coordinate t_coordinate=wb_polar_coordinate())
Create a new VisionDetectionFeature.
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
struct wb_polar_coordinate coordinate
Where the feature is.
enum FeatureTypes featureType
Type of the Feature.
const char * wb_vision_detection_feature_to_string(const struct wb_vision_detection_feature *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_vision_detection_feature * wb_vision_detection_feature_from_string(struct wb_vision_detection_feature *self, const char *str)
Convert from a string.
const char * wb_vision_detection_feature_description(const struct wb_vision_detection_feature *self, char *descString, size_t bufferSize)
Convert to a description string.
#define VISION_DETECTION_FEATURE_TO_STRING_BUFFER_SIZE
#define VISION_DETECTION_FEATURE_DESC_BUFFER_SIZE
@ NUMBER_OF_FEATURE_TYPES