47 #if defined (PLAYER_STATIC) 48 #define PLAYERCORE_EXPORT 49 #elif defined (playercore_EXPORTS) 50 #define PLAYERCORE_EXPORT __declspec (dllexport) 52 #define PLAYERCORE_EXPORT __declspec (dllimport) 55 #define PLAYERCORE_EXPORT 60 #include <libplayerinterface/player.h> 199 public:
ConfigFile(uint32_t _default_host, uint32_t _default_robot);
202 public:
ConfigFile(
const char* _default_host, uint32_t _default_robot);
211 private:
void InitFields();
216 public:
bool Load(
const char *filename);
226 public:
void InsertFieldValue(
int index,
232 private:
bool Save(
const char *filename);
236 public:
bool WarnUnused();
243 public:
bool ReadBool(
int section,
const char *name,
bool value);
246 private:
void WriteBool(
int section,
const char* name,
bool value);
249 private:
void WriteBool_Compat(
int section,
const char* name,
bool value);
257 public:
const char *ReadString(
int section,
262 private:
void WriteString(
int section,
271 public:
int ReadInt(
int section,
276 private:
void WriteInt(
int section,
285 public:
double ReadFloat(
int section,
290 private:
void WriteFloat(
int section,
299 public:
double ReadLength(
int section,
304 private:
void WriteLength(
int section,
317 public:
double ReadAngle(
int section,
const char *name,
double value);
329 public: uint32_t ReadColor(
int section,
342 public:
const char *ReadFilename(
int section,
349 public:
int GetTupleCount(
int section,
const char *name);
357 public:
const char *ReadTupleString(
int section,
363 private:
void WriteTupleString(
int section,
374 public:
int ReadTupleInt(
int section,
380 private:
void WriteTupleInt(
int section,
392 public:
double ReadTupleFloat(
int section,
398 private:
void WriteTupleFloat(
int section,
409 public:
double ReadTupleLength(
int section,
415 private:
void WriteTupleLength(
int section,
430 public:
double ReadTupleAngle(
int section,
436 private:
void WriteTupleAngle(
int section,
452 public: uint32_t ReadTupleColor(
int section,
470 const char *name,
int code,
int index,
474 public:
bool ParseDriver(
int section);
477 public:
bool ParseInterface(
int section);
480 public:
bool ParseAllDrivers();
483 public:
bool ParseAllInterfaces();
486 public:
int GetSectionCount();
489 public:
const char *GetSectionType(
int section);
493 public:
int LookupSection(
const char *type);
497 public:
int GetSectionParent(
int section);
504 private:
bool LoadTokens(FILE *file,
int include);
507 private:
bool LoadTokenComment(FILE *file,
int *line,
int include);
510 private:
bool LoadTokenWord(FILE *file,
int *line,
int include);
513 private:
bool LoadTokenInclude(FILE *file,
int *line,
int include);
516 private:
bool LoadTokenNum(FILE *file,
int *line,
int include);
519 private:
bool LoadTokenString(FILE *file,
int *line,
int include);
522 private:
bool LoadTokenSpace(FILE *file,
int *line,
int include);
525 private:
bool SaveTokens(FILE *file);
528 private:
void ClearTokens();
531 private:
bool AddToken(
int type,
const char *value,
int include);
534 private:
bool SetTokenValue(
int index,
const char *value);
537 private:
const char *GetTokenValue(
int index);
540 public:
void DumpTokens();
543 private:
bool ParseTokens();
546 private:
bool ParseTokenInclude(
int *index,
int *line);
549 private:
bool ParseTokenDefine(
int *index,
int *line);
552 private:
bool ParseTokenPlugin(
int *index,
int *line);
555 private:
bool ParseTokenWord(
int section,
int *index,
int *line);
558 private:
bool ParseTokenSection(
int section,
int *index,
int *line);
561 private:
bool ParseTokenField(
int section,
int *index,
int *line);
564 private:
bool ParseTokenTuple(
int section,
int field,
565 int *index,
int *line);
568 private:
void ClearMacros();
571 private:
int AddMacro(
const char *macroname,
const char *sectionname,
572 int line,
int starttoken,
int endtoken);
576 private:
int LookupMacro(
const char *macroname);
579 private:
void DumpMacros();
582 private:
void ClearSections();
585 private:
int AddSection(
int parent,
const char *type);
588 public:
void DumpSections();
591 private:
void ClearFields();
594 private:
int AddField(
int section,
const char *name,
int line);
597 private:
void AddFieldValue(
int field,
int index,
int value_token);
600 private:
int GetField(
int section,
const char *name);
603 private:
int GetFieldValueCount(
int field);
607 private:
const char *GetFieldValue(
int field,
int index,
bool flag_used =
true);
610 private:
void SetFieldValue(
int field,
int index,
const char *value);
613 public:
void DumpFields();
616 private: uint32_t LookupColor(
const char *name);
625 TokenWord, TokenNum, TokenString, TokenBool,
626 TokenOpenSection, TokenCloseSection,
627 TokenOpenTuple, TokenCloseTuple,
646 private:
int token_size, token_count;
647 private:
Token *tokens;
653 const char *macroname;
656 const char *sectionname;
662 int starttoken, endtoken;
666 private:
int macro_size;
667 private:
int macro_count;
681 private:
int section_size;
682 private:
int section_count;
706 private:
int field_size;
707 private:
int field_count;
708 private:
Field *fields;
709 private: uint32_t default_host;
710 private: uint32_t default_robot;
713 private:
double unit_length;
714 private:
double unit_angle;
Class for loading configuration file information.
Definition: configfile.h:196
Definition: configfile.h:650
A device address.
Definition: player.h:145
Definition: configfile.h:671
Definition: configfile.h:686
Definition: configfile.h:632
char * filename
Name of the file we loaded.
Definition: configfile.h:619