Changes in src/Actions/ValueStorage.hpp [861874:03c902]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ValueStorage.hpp
r861874 r03c902 8 8 #ifndef VALUESTORAGE_HPP_ 9 9 #define VALUESTORAGE_HPP_ 10 11 10 12 11 #include "Actions/MapOfActions.hpp" … … 22 21 23 22 public: 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; 29 36 } 30 37 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 */ 31 50 std::string getDescription(std::string actionname); 32 51 … … 34 53 ValueStorage(); 35 54 ~ValueStorage(); 55 56 MapOfActions &MapOfActions_instance; 36 57 }; 37 58
Note:
See TracChangeset
for help on using the changeset viewer.