60#ifndef guWhiteboard_VisionDetectionFeatureArray_h
61#define guWhiteboard_VisionDetectionFeatureArray_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionFeatureArray_DEFINED
73#define guWhiteboard_VisionDetectionFeatureArray_DEFINED
75#undef VisionDetectionFeatureArray_DEFINED
76#define VisionDetectionFeatureArray_DEFINED
94 if (t_features != NULLPTR) {
108 this->init(t_numFeatures, t_features);
147 for (
int features_0_index = 0; features_0_index < 7; features_0_index++)
156 return !(*
this == t_other);
166 return !(*
this == t_other);
214#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
224#ifdef USE_WB_VISION_DETECTION_FEATURE_ARRAY_C_CONVERSION
227 std::string descr = buffer;
230 std::ostringstream ss;
231 ss <<
"numFeatures=" <<
static_cast<unsigned>(this->
numFeatures());
233 bool features_first =
true;
237 features_first =
false;
245#ifdef USE_WB_VISION_DETECTION_FEATURE_ARRAY_C_CONVERSION
248 std::string toString = buffer;
251 std::ostringstream ss;
254 bool features_first =
true;
258 features_first =
false;
265#ifdef USE_WB_VISION_DETECTION_FEATURE_ARRAY_C_CONVERSION
270 char * str_cstr =
const_cast<char *
>(t_str.c_str());
271 size_t temp_length = strlen(str_cstr);
272 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
277 char* var_str = &var_str_buffer[0];
279 char* key = &key_buffer[0];
287 if (index == 0 && str_cstr[0] ==
'{') {
293 for (
int i = index; i < length; i++) {
295 if (bracecount == 0 && str_cstr[i] ==
'=') {
300 if (bracecount == 0 && isspace(str_cstr[i])) {
307 if (bracecount == 0 && str_cstr[i] ==
',') {
311 if (str_cstr[i] ==
'{') {
313 if (bracecount == 1) {
318 if (str_cstr[i] ==
'}') {
320 if (bracecount < 0) {
325 if (i == length - 1) {
329 if (endKey >= startKey && endKey - startKey < length) {
330 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
331 key[(endKey - startKey) + 1] = 0;
335 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
336 var_str[(index - startVar) + 1] = 0;
342 if (strlen(key) > 0) {
343 if (0 == strcmp(
"numFeatures", key)) {
345 }
else if (0 == strcmp(
"features", key)) {
360 int restartIndex = index;
361 index = lastBrace + 1;
367 for (
int i = index; i < length; i++) {
369 if (bracecount == 0 && str_cstr[i] ==
'=') {
374 if (bracecount == 0 && isspace(str_cstr[i])) {
381 if (bracecount == 0 && str_cstr[i] ==
',') {
385 if (str_cstr[i] ==
'{') {
389 if (str_cstr[i] ==
'}') {
391 if (bracecount < 0) {
396 if (i == length - 1) {
400 if (endKey >= startKey && endKey - startKey < length) {
401 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
402 key[(endKey - startKey) + 1] = 0;
406 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
407 var_str[(index - startVar) + 1] = 0;
418 index = restartIndex;
425 }
while(index < length);
Provides a C++ wrapper around wb_vision_detection_feature_array.
void set_features(const VisionDetectionFeature *t_newValue)
const VisionDetectionFeature & features(int t_i) const
VisionDetectionFeatureArray & operator=(const VisionDetectionFeatureArray &t_other)
Copy Assignment Operator.
VisionDetectionFeatureArray(const struct wb_vision_detection_feature_array &t_other)
Copy Constructor.
size_t features_size() const
VisionDetectionFeature & features(int t_i)
bool operator==(const VisionDetectionFeatureArray &t_other) const
void set_features(const VisionDetectionFeature &t_newValue, int t_i)
void set_numFeatures(const uint8_t &t_newValue)
const VisionDetectionFeature * features() const
bool operator!=(const VisionDetectionFeatureArray &t_other) const
std::string description()
VisionDetectionFeatureArray(const std::string &t_str)
String Constructor.
const uint8_t & numFeatures() const
void from_string(const std::string &t_str)
VisionDetectionFeatureArray(const VisionDetectionFeatureArray &t_other)
Copy Constructor.
VisionDetectionFeatureArray(uint8_t t_numFeatures=0, const struct wb_vision_detection_feature t_features[7]=NULLPTR)
Create a new VisionDetectionFeatureArray.
Provides a C++ wrapper around wb_vision_detection_feature.
void from_string(const std::string &t_str)
Results for the Feature Detector (guvision).
uint8_t numFeatures
The number of features reported on the camera.
struct wb_vision_detection_feature features[7]
Features reported from the camera.
WHITEBOARD_POSTER_STRING_CONVERSION.
const char * wb_vision_detection_feature_array_description(const struct wb_vision_detection_feature_array *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_vision_detection_feature_array_to_string(const struct wb_vision_detection_feature_array *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_vision_detection_feature_array * wb_vision_detection_feature_array_from_string(struct wb_vision_detection_feature_array *self, const char *str)
Convert from a string.
#define VISION_DETECTION_FEATURE_ARRAY_TO_STRING_BUFFER_SIZE
#define VISION_DETECTION_FEATURE_ARRAY_FEATURES_ARRAY_SIZE
WHITEBOARD_POSTER_STRING_CONVERSION.
#define VISION_DETECTION_FEATURE_ARRAY_DESC_BUFFER_SIZE