30 #ifndef INCLUDE_OLA_EXPORTMAP_H_
31 #define INCLUDE_OLA_EXPORTMAP_H_
67 const std::string
Name()
const {
return m_name; }
73 virtual const std::string
Value()
const = 0;
80 BaseVariable*, bool> {
106 void Set(
bool value) { m_value = value; }
112 bool Get()
const {
return m_value; }
120 const std::string
Value()
const {
return m_value ?
"1" :
"0"; }
137 void Set(
const std::string &value) { m_value = value; }
138 const std::string Get()
const {
return m_value; }
139 const std::string
Value()
const {
return m_value; }
156 void Set(
int value) { m_value = value; }
157 void operator++(
int) { m_value++; }
158 void operator--(
int) { m_value--; }
159 void Reset() { m_value = 0; }
160 int Get()
const {
return m_value; }
162 std::stringstream out;
182 void operator++(
int) { m_value++; }
183 void operator+=(
unsigned int value) { m_value += value; }
184 void Reset() { m_value = 0; }
185 unsigned int Get()
const {
return m_value; }
187 std::stringstream out;
193 unsigned int m_value;
200 template<
typename Type>
203 MapVariable(
const std::string &name,
const std::string &label)
208 void Remove(
const std::string &key);
209 void Set(
const std::string &key, Type value);
210 Type &operator[](
const std::string &key);
211 const std::string
Value()
const;
212 const std::string Label()
const {
return m_label; }
215 std::map<std::string, Type> m_variables;
229 IntMap(
const std::string &name,
const std::string &label)
232 void Increment(
const std::string &key) {
243 UIntMap(
const std::string &name,
const std::string &label)
246 void Increment(
const std::string &key) {
256 template<
typename Type>
258 return m_variables[key];
265 template<
typename Type>
266 void MapVariable<Type>::Set(
const std::string &key, Type value) {
267 m_variables[key] = value;
275 template<
typename Type>
277 typename std::map<std::string, Type>::iterator iter = m_variables.find(key);
279 if (iter != m_variables.end())
280 m_variables.erase(iter);
333 StringMap *GetStringMapVar(
const std::string &name,
334 const std::string &label=
"");
335 IntMap *GetIntMapVar(
const std::string &name,
const std::string &label=
"");
336 UIntMap *GetUIntMapVar(
const std::string &name,
337 const std::string &label=
"");
346 template<
typename Type>
347 Type *GetVar(std::map<std::string, Type*> *var_map,
348 const std::string &name);
350 template<
typename Type>
351 Type *GetMapVar(std::map<std::string, Type*> *var_map,
352 const std::string &name,
353 const std::string &label);
355 std::map<std::string, BoolVariable*> m_bool_variables;
356 std::map<std::string, CounterVariable*> m_counter_variables;
357 std::map<std::string, IntegerVariable*> m_int_variables;
358 std::map<std::string, StringVariable*> m_string_variables;
360 std::map<std::string, StringMap*> m_str_map_variables;
361 std::map<std::string, IntMap*> m_int_map_variables;
362 std::map<std::string, UIntMap*> m_uint_map_variables;
367 #endif // INCLUDE_OLA_EXPORTMAP_H_