60#ifndef guWhiteboard_LineSighting_h
61#define guWhiteboard_LineSighting_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_LineSighting_DEFINED
73#define guWhiteboard_LineSighting_DEFINED
75#undef LineSighting_DEFINED
76#define LineSighting_DEFINED
79#include <SimpleShapes.h>
105 this->init(t_leftPoint, t_rightPoint, t_sightingType);
147 return !(*
this == t_other);
157 return !(*
this == t_other);
205#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
215#ifdef USE_WB_LINE_SIGHTING_C_CONVERSION
218 std::string descr = buffer;
221 std::ostringstream ss;
229 ss <<
"sightingType=" <<
"FieldLineSightingType";
234 ss <<
"sightingType=" <<
"HorizonLineSightingType";
243#ifdef USE_WB_LINE_SIGHTING_C_CONVERSION
246 std::string toString = buffer;
249 std::ostringstream ss;
257 ss <<
"FieldLineSightingType";
262 ss <<
"HorizonLineSightingType";
270#ifdef USE_WB_LINE_SIGHTING_C_CONVERSION
275 char * str_cstr =
const_cast<char *
>(t_str.c_str());
276 size_t temp_length = strlen(str_cstr);
277 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
282 char* var_str = &var_str_buffer[0];
284 char* key = &key_buffer[0];
291 if (index == 0 && str_cstr[0] ==
'{') {
297 for (
int i = index; i < length; i++) {
299 if (bracecount == 0 && str_cstr[i] ==
'=') {
304 if (bracecount == 0 && isspace(str_cstr[i])) {
311 if (bracecount == 0 && str_cstr[i] ==
',') {
315 if (str_cstr[i] ==
'{') {
319 if (str_cstr[i] ==
'}') {
321 if (bracecount < 0) {
326 if (i == length - 1) {
330 if (endKey >= startKey && endKey - startKey < length) {
331 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
332 key[(endKey - startKey) + 1] = 0;
336 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
337 var_str[(index - startVar) + 1] = 0;
343 if (strlen(key) > 0) {
344 if (0 == strcmp(
"leftPoint", key)) {
346 }
else if (0 == strcmp(
"rightPoint", key)) {
348 }
else if (0 == strcmp(
"sightingType", key)) {
372 if (strcmp(
"FieldLineSightingType", var_str) == 0) {
373#pragma clang diagnostic push
374#pragma clang diagnostic ignored "-Wbad-function-cast"
376#pragma clang diagnostic pop
377 }
else if (strcmp(
"HorizonLineSightingType", var_str) == 0) {
378#pragma clang diagnostic push
379#pragma clang diagnostic ignored "-Wbad-function-cast"
381#pragma clang diagnostic pop
383#pragma clang diagnostic push
384#pragma clang diagnostic ignored "-Wbad-function-cast"
386#pragma clang diagnostic pop
394 }
while(index < length);
400 GUPoint<short> left = GUPoint<short>(
short(
leftPoint().distance()),
short(
leftPoint().direction()),
true);
401 GUPoint<short> right = GUPoint<short>(
short(
rightPoint().distance()),
short(
rightPoint().direction()),
true);
402 return SimpleLine(left, right);
Provides a C++ wrapper around wb_line_sighting.
PolarCoordinate & leftPoint()
LineSighting(struct wb_polar_coordinate t_leftPoint=wb_polar_coordinate(), struct wb_polar_coordinate t_rightPoint=wb_polar_coordinate(), enum LineSightingType t_sightingType=static_cast< enum LineSightingType >(0))
Create a new LineSighting.
void set_leftPoint(const PolarCoordinate &t_newValue)
LineSighting(const std::string &t_str)
String Constructor.
LineSighting(const LineSighting &t_other)
Copy Constructor.
bool operator!=(const LineSighting &t_other) const
SimpleLine simpleLine()
WHITEBOARD_POSTER_STRING_CONVERSION.
bool operator==(const LineSighting &t_other) const
enum LineSightingType & sightingType()
const PolarCoordinate & leftPoint() const
PolarCoordinate & rightPoint()
LineSighting(const struct wb_line_sighting &t_other)
Copy Constructor.
void set_sightingType(const enum LineSightingType &t_newValue)
enum LineSightingType & sightingType() const
const PolarCoordinate & rightPoint() const
void set_rightPoint(const PolarCoordinate &t_newValue)
std::string description()
LineSighting & operator=(const LineSighting &t_other)
Copy Assignment Operator.
void from_string(const std::string &t_str)
Provides a C++ wrapper around wb_polar_coordinate.
void from_string(const std::string &t_str)
std::string description()
WHITEBOARD_POSTER_STRING_CONVERSION.
enum LineSightingType sightingType
The type of sighting.
struct wb_polar_coordinate rightPoint
The right/top point of the line.
struct wb_polar_coordinate leftPoint
The left/bottom point of the line.
WHITEBOARD_POSTER_STRING_CONVERSION.
const char * wb_line_sighting_description(const struct wb_line_sighting *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_line_sighting_to_string(const struct wb_line_sighting *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_line_sighting * wb_line_sighting_from_string(struct wb_line_sighting *self, const char *str)
Convert from a string.
@ HorizonLineSightingType
#define LINE_SIGHTING_DESC_BUFFER_SIZE
#define LINE_SIGHTING_TO_STRING_BUFFER_SIZE