60#ifndef guWhiteboard_MachineFilteredLocalisationVision_h
61#define guWhiteboard_MachineFilteredLocalisationVision_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_MachineFilteredLocalisationVision_DEFINED
73#define guWhiteboard_MachineFilteredLocalisationVision_DEFINED
75#undef MachineFilteredLocalisationVision_DEFINED
76#define MachineFilteredLocalisationVision_DEFINED
92 void init(uint8_t t_numberOfSightings = 0,
const struct wb_landmark_sighting t_sightings[12] = NULLPTR) {
94 if (t_sightings != NULLPTR) {
97 struct wb_landmark_sighting sightings_temp[
MACHINE_FILTERED_LOCALISATION_VISION_SIGHTINGS_ARRAY_SIZE] = {
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting(),
wb_landmark_sighting()};
108 this->init(t_numberOfSightings, t_sightings);
147 for (
int sightings_0_index = 0; sightings_0_index < 12; sightings_0_index++)
156 return !(*
this == t_other);
166 return !(*
this == t_other);
214#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
224#ifdef USE_WB_MACHINE_FILTERED_LOCALISATION_VISION_C_CONVERSION
227 std::string descr = buffer;
230 std::ostringstream ss;
233 bool sightings_first =
true;
237 sightings_first =
false;
245#ifdef USE_WB_MACHINE_FILTERED_LOCALISATION_VISION_C_CONVERSION
248 std::string toString = buffer;
251 std::ostringstream ss;
254 bool sightings_first =
true;
258 sightings_first =
false;
265#ifdef USE_WB_MACHINE_FILTERED_LOCALISATION_VISION_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(
"numberOfSightings", key)) {
345 }
else if (0 == strcmp(
"sightings", 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_landmark_sighting.
void from_string(const std::string &t_str)
enum LandmarkSightingType & sightingType()
Provides a C++ wrapper around wb_machine_filtered_localisation_vision.
const LandmarkSighting * sightings() const
LandmarkSighting & sightings(int t_i)
bool operator!=(const MachineFilteredLocalisationVision &t_other) const
void set_sightings(const LandmarkSighting *t_newValue)
const LandmarkSighting & sightings(int t_i) const
uint8_t & numberOfSightings()
MachineFilteredLocalisationVision(const std::string &t_str)
String Constructor.
void set_numberOfSightings(const uint8_t &t_newValue)
std::string description()
void from_string(const std::string &t_str)
MachineFilteredLocalisationVision(const struct wb_machine_filtered_localisation_vision &t_other)
Copy Constructor.
MachineFilteredLocalisationVision(const MachineFilteredLocalisationVision &t_other)
Copy Constructor.
size_t sightings_size() const
int firstSighting(LandmarkSightingType sightingType)
WHITEBOARD_POSTER_STRING_CONVERSION.
bool operator==(const MachineFilteredLocalisationVision &t_other) const
int firstGenericGoalPost()
const uint8_t & numberOfSightings() const
MachineFilteredLocalisationVision & operator=(const MachineFilteredLocalisationVision &t_other)
Copy Assignment Operator.
void set_sightings(const LandmarkSighting &t_newValue, int t_i)
MachineFilteredLocalisationVision(uint8_t t_numberOfSightings=0, const struct wb_landmark_sighting t_sightings[12]=NULLPTR)
Create a new MachineFilteredLocalisationVision.
WHITEBOARD_POSTER_STRING_CONVERSION.
enum LandmarkSightingType sightingType
The type of sighting.
Results of the FSM (and sub machines) "SMFilterVision".
uint8_t numberOfSightings
The number of sightings in sightings.
struct wb_landmark_sighting sightings[12]
All sightings.
@ GenericGoalPostSightingType
@ StraightLineSightingType
@ LeftGoalPostSightingType
@ GoalLandmarkSightingType
@ TIntersectionLineSightingType
@ LineHorizonSightingType
@ CornerHorizonSightingType
@ RightGoalPostSightingType
struct wb_machine_filtered_localisation_vision * wb_machine_filtered_localisation_vision_from_string(struct wb_machine_filtered_localisation_vision *self, const char *str)
Convert from a string.
const char * wb_machine_filtered_localisation_vision_to_string(const struct wb_machine_filtered_localisation_vision *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_machine_filtered_localisation_vision_description(const struct wb_machine_filtered_localisation_vision *self, char *descString, size_t bufferSize)
Convert to a description string.
#define MACHINE_FILTERED_LOCALISATION_VISION_DESC_BUFFER_SIZE
#define MACHINE_FILTERED_LOCALISATION_VISION_SIGHTINGS_ARRAY_SIZE
WHITEBOARD_POSTER_STRING_CONVERSION.
#define MACHINE_FILTERED_LOCALISATION_VISION_TO_STRING_BUFFER_SIZE