60#ifndef guWhiteboard_ParticleOutputMap_h
61#define guWhiteboard_ParticleOutputMap_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_ParticleOutputMap_DEFINED
73#define guWhiteboard_ParticleOutputMap_DEFINED
75#undef ParticleOutputMap_DEFINED
76#define ParticleOutputMap_DEFINED
90 void init(uint8_t t_fileId = 0, std::string t_filePath =
"") {
92 gu_strlcpy(
const_cast<char *
>(this->
filePath()), t_filePath.c_str(), 64);
101 this->init(t_fileId, t_filePath);
142 return !(*
this == t_other);
152 return !(*
this == t_other);
195#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
205#ifdef USE_WB_PARTICLE_OUTPUT_MAP_C_CONVERSION
208 std::string descr = buffer;
211 std::ostringstream ss;
212 ss <<
"fileId=" <<
static_cast<unsigned>(this->
fileId());
214 if (0 == strncmp(
"", this->
filePath(), 1)) {
215 ss <<
"filePath=" <<
"";
217 ss <<
"filePath=" << this->
filePath();
224#ifdef USE_WB_PARTICLE_OUTPUT_MAP_C_CONVERSION
227 std::string toString = buffer;
230 std::ostringstream ss;
231 ss << static_cast<unsigned>(this->
fileId());
233 if (0 == strncmp(
"", this->
filePath(), 1)) {
242#ifdef USE_WB_PARTICLE_OUTPUT_MAP_C_CONVERSION
247 char * str_cstr =
const_cast<char *
>(t_str.c_str());
248 size_t temp_length = strlen(str_cstr);
249 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
254 char* var_str = &var_str_buffer[0];
256 char* key = &key_buffer[0];
263 if (index == 0 && str_cstr[0] ==
'{') {
269 for (
int i = index; i < length; i++) {
271 if (bracecount == 0 && str_cstr[i] ==
'=') {
276 if (bracecount == 0 && isspace(str_cstr[i])) {
283 if (bracecount == 0 && str_cstr[i] ==
',') {
287 if (str_cstr[i] ==
'{') {
291 if (str_cstr[i] ==
'}') {
293 if (bracecount < 0) {
298 if (i == length - 1) {
302 if (endKey >= startKey && endKey - startKey < length) {
303 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
304 key[(endKey - startKey) + 1] = 0;
308 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
309 var_str[(index - startVar) + 1] = 0;
315 if (strlen(key) > 0) {
316 if (0 == strcmp(
"fileId", key)) {
318 }
else if (0 == strcmp(
"filePath", key)) {
328 this->
set_fileId(
static_cast<uint8_t
>(atoi(var_str)));
340 }
while(index < length);
Provides a C++ wrapper around wb_particle_output_map.
void from_string(const std::string &t_str)
ParticleOutputMap(const std::string &t_str)
String Constructor.
ParticleOutputMap(const struct wb_particle_output_map &t_other)
Copy Constructor.
size_t filePath_size() const
const uint8_t & fileId() const
ParticleOutputMap & operator=(const ParticleOutputMap &t_other)
Copy Assignment Operator.
const char * filePath() const
bool operator==(const ParticleOutputMap &t_other) const
void set_filePath(const char *t_newValue)
bool operator!=(const ParticleOutputMap &t_other) const
std::string description()
void set_fileId(const uint8_t &t_newValue)
const char & filePath(int t_i) const
ParticleOutputMap(const ParticleOutputMap &t_other)
Copy Constructor.
ParticleOutputMap(uint8_t t_fileId=0, std::string t_filePath="")
Create a new ParticleOutputMap.
WHITEBOARD_POSTER_STRING_CONVERSION.
uint8_t fileId
The id of the file.
char filePath[64]
The path to the file containing the list of particles.
const char * wb_particle_output_map_description(const struct wb_particle_output_map *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_particle_output_map * wb_particle_output_map_from_string(struct wb_particle_output_map *self, const char *str)
Convert from a string.
const char * wb_particle_output_map_to_string(const struct wb_particle_output_map *self, char *toString, size_t bufferSize)
Convert to a string.
#define PARTICLE_OUTPUT_MAP_TO_STRING_BUFFER_SIZE
#define PARTICLE_OUTPUT_MAP_DESC_BUFFER_SIZE