60#ifndef guWhiteboard_VisionDetectionLines_h
61#define guWhiteboard_VisionDetectionLines_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_VisionDetectionLines_DEFINED
73#define guWhiteboard_VisionDetectionLines_DEFINED
75#undef VisionDetectionLines_DEFINED
76#define VisionDetectionLines_DEFINED
92 void init(uint64_t t_frameNumber = 0,
const struct wb_vision_detection_line_array t_lines[2] = NULLPTR, uint16_t t_res_width = 0, uint16_t t_res_height = 0) {
94 if (t_lines != NULLPTR) {
110 this->init(t_frameNumber, t_lines, t_res_width, t_res_height);
151 for (
int lines_0_index = 0; lines_0_index < 2; lines_0_index++)
160 return !(*
this == t_other);
170 return !(*
this == t_other);
248#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
258#ifdef USE_WB_VISION_DETECTION_LINES_C_CONVERSION
261 std::string descr = buffer;
264 std::ostringstream ss;
267 bool lines_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_LINES_C_CONVERSION
286 std::string toString = buffer;
289 std::ostringstream ss;
292 bool lines_first =
true;
300 ss << static_cast<unsigned>(this->
res_width());
302 ss << static_cast<unsigned>(this->
res_height());
307#ifdef USE_WB_VISION_DETECTION_LINES_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(
"lines", 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_line_array.
void from_string(const std::string &t_str)
Provides a C++ wrapper around wb_vision_detection_lines.
const uint16_t & res_width() const
const uint64_t & frameNumber() const
VisionDetectionLineArray & lines(int t_i)
void set_lines(const VisionDetectionLineArray *t_newValue)
VisionDetectionLines(const std::string &t_str)
String Constructor.
size_t lines_size() const
void set_res_width(const uint16_t &t_newValue)
VisionDetectionLines(const struct wb_vision_detection_lines &t_other)
Copy Constructor.
void set_res_height(const uint16_t &t_newValue)
void from_string(const std::string &t_str)
VisionDetectionLines(uint64_t t_frameNumber=0, const struct wb_vision_detection_line_array t_lines[2]=NULLPTR, uint16_t t_res_width=0, uint16_t t_res_height=0)
Create a new VisionDetectionLines.
bool operator==(const VisionDetectionLines &t_other) const
VisionDetectionLines & operator=(const VisionDetectionLines &t_other)
Copy Assignment Operator.
VisionDetectionLines(const VisionDetectionLines &t_other)
Copy Constructor.
std::string description()
const VisionDetectionLineArray & lines(int t_i) const
bool operator!=(const VisionDetectionLines &t_other) const
void set_frameNumber(const uint64_t &t_newValue)
const uint16_t & res_height() const
const VisionDetectionLineArray * lines() const
void set_lines(const VisionDetectionLineArray &t_newValue, int t_i)
Results for the Line Ray Tracer (guvision).
Results for the Line Ray Tracer (guvision).
uint16_t res_width
The resolution width.
uint16_t res_height
The resolution height.
struct wb_vision_detection_line_array lines[2]
Lines reported for each camera.
uint64_t frameNumber
The frame number that these lines were seen in.
const char * wb_vision_detection_lines_to_string(const struct wb_vision_detection_lines *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_vision_detection_lines * wb_vision_detection_lines_from_string(struct wb_vision_detection_lines *self, const char *str)
Convert from a string.
const char * wb_vision_detection_lines_description(const struct wb_vision_detection_lines *self, char *descString, size_t bufferSize)
Convert to a description string.
#define VISION_DETECTION_LINES_DESC_BUFFER_SIZE
#define VISION_DETECTION_LINES_TO_STRING_BUFFER_SIZE
#define VISION_DETECTION_LINES_LINES_ARRAY_SIZE
WHITEBOARD_POSTER_STRING_CONVERSION.