datapairs.h
Go to the documentation of this file.
1 
19 #ifndef __DATAPAIRS
20 
21 #define __DATAPAIRS
22 
23 #include <string>
24 #include <cstdlib>
25 #include <vector>
26 #include <utility>
27 
28 #include "configuration.h"
29 
30 
33 class DataPairs
34 {
35  protected:
37  std::vector< std::vector< std::string > > values;
38 
39  public:
41  unsigned int getLength();
42 
44  void setMaxSize(unsigned int size);
45 
46  bool getItem(unsigned int index, std::vector< std::string > &item);
47 
49  unsigned int getMaxSize();
51  void add(std::string attribute, std::string value, bool replace = false);
52 
54  void clear();
55 
63  int getIndex(std::string attr, std::vector<unsigned int> &ids);
64  int getFirstIndex(std::string str);
65 
73  void getStrings(std::string str, std::vector<std::string> &result);
74 
75 
77  int getInt(std::string str, int defaultValue = 0);
79  float getFloat(std::string str, float defaultValue = 0.0);
81  std::string getString(std::string str, std::string defaultValue = "");
83  bool getBool(std::string str, bool defaultValue = false);
84 
85 
87  bool getIntValue(std::string str, int &result);
89  bool getFloatValue(std::string str, float &result);
91  bool getStringValue(std::string str, std::string &result);
93  bool getBoolValue(std::string str, bool &result);
94 
96  void copyFrom(DataPairs &other);
97 
99  void print();
100 
101  void resolveString(std::string input, std::string &output);
102  std::string resolveString(std::string input);
103  void resolve();
104 
105  void loadFromXml(CConfiguration &config, TiXmlElement* node, DataPairs* replace = NULL);
106 };
107 
108 
109 #endif
bool getFloatValue(std::string str, float &result)
Definition: datapairs.cpp:197
void copyFrom(DataPairs &other)
Copies all Attribute-Value pairs.
Definition: datapairs.cpp:38
bool getItem(unsigned int index, std::vector< std::string > &item)
Definition: datapairs.cpp:27
int getInt(std::string str, int defaultValue=0)
Definition: datapairs.cpp:95
int getIndex(std::string attr, std::vector< unsigned int > &ids)
Retrieves all indexes of Attribute-Value pairs with Attribute name equal to attr. ...
Definition: datapairs.cpp:80
bool getBoolValue(std::string str, bool &result)
Definition: datapairs.cpp:273
std::string getString(std::string str, std::string defaultValue="")
Definition: datapairs.cpp:116
void resolve()
Definition: datapairs.cpp:350
void resolveString(std::string input, std::string &output)
Definition: datapairs.cpp:284
Data Storage Class (Attribute-Value Pairs)
Definition: datapairs.h:33
unsigned int getMaxSize()
Returns Max. number of stored pairs.
int getFirstIndex(std::string str)
Definition: datapairs.cpp:70
void clear()
Clears storage buffer.
Definition: datapairs.cpp:126
bool getBool(std::string str, bool defaultValue=false)
Definition: datapairs.cpp:150
void getStrings(std::string str, std::vector< std::string > &result)
Retrieves all Attribute-Value pairs with Attribute name equal to attr.
Definition: datapairs.cpp:137
bool getStringValue(std::string str, std::string &result)
Definition: datapairs.cpp:214
void print()
Prints all Attribute-Value pairs.
Definition: datapairs.cpp:49
float getFloat(std::string str, float defaultValue=0.0)
Definition: datapairs.cpp:105
bool getIntValue(std::string str, int &result)
Definition: datapairs.cpp:180
void setMaxSize(unsigned int size)
Sets number of storable items to size.
Definition: datapairs.cpp:61
std::vector< std::vector< std::string > > values
Attribute Names and Values.
Definition: datapairs.h:37
Configuration file wrapper.
Definition: configuration.h:34
void loadFromXml(CConfiguration &config, TiXmlElement *node, DataPairs *replace=NULL)
Definition: datapairs.cpp:359
unsigned int getLength()
Returns Number of pairs stored.
Definition: datapairs.cpp:131
void add(std::string attribute, std::string value, bool replace=false)
Adds the attribute-value pair attribute, value.
Definition: datapairs.cpp:160


asr_kinematic_chain_optimizer
Author(s): Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij
autogenerated on Mon Jun 10 2019 12:35:36