Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/ValueStorage.hpp

    r861874 r03c902  
    88#ifndef VALUESTORAGE_HPP_
    99#define VALUESTORAGE_HPP_
    10 
    1110
    1211#include "Actions/MapOfActions.hpp"
     
    2221
    2322public:
    24   template <typename T> void queryCurrentValue(const char *name, T &_T) {
    25     MapOfActions::getInstance().queryCurrentValue(name, _T);
    26   }
    27   template <typename T> void setCurrentValue(const char *name, T &_T) {
    28     MapOfActions::getInstance().setCurrentValue(name, _T);
     23  /** Gets a value from the storage
     24   * If the value is not present, an ASSERT is thrown unless optional is set to true.
     25   * \param _T key of value
     26   * \param optional whether this value is optional, i.e. may actually not be in the storage (i.e. may return false in this case).
     27   * \return true - value present, false - value not present (only given when optional set to true)
     28   */
     29  template <typename T> bool queryCurrentValue(const char *name, T &_T, const bool optional = false) {
     30    if (optional) {
     31      if (!MapOfActions_instance.isCurrentValuePresent(name))
     32        return false;
     33    }
     34    MapOfActions_instance.queryCurrentValue(name, _T);
     35    return true;
    2936  }
    3037
     38  /** Sets a value in the storage.
     39   * \param name key of value
     40   * \param _T value
     41   */
     42  template <typename T> void setCurrentValue(const char *name, T &_T) {
     43    MapOfActions_instance.setCurrentValue(name, _T);
     44  }
     45
     46  /** Obtain a descriptive text for a given key.
     47   * \param actionname key
     48   * \return text describing the key's contents
     49   */
    3150  std::string getDescription(std::string actionname);
    3251
     
    3453  ValueStorage();
    3554  ~ValueStorage();
     55
     56  MapOfActions &MapOfActions_instance;
    3657};
    3758
Note: See TracChangeset for help on using the changeset viewer.