Commit 31a5625c authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In ElementaryUtils (trunk) :
- Add getters to Parameters members.
parent 21abf38d
......@@ -4,11 +4,8 @@
/**
* @file LoggerManager.h
* @author Bryan BERTHOU (SPhN / CEA Saclay)
* @date 05 September 2014
* @date September 05, 2014
* @version 2.0
*
* @class LoggerManager
* @brief \<singleton\> Use for handle logs.
*/
#include <SFML/System/Mutex.hpp>
......@@ -35,6 +32,10 @@ const std::string DEFAULT_LEVEL_NAME = "default.level";
const std::string PRINT_MODE_NAME = "print.mode";
const std::string OUTPUT_LOG_FILE_PATH = "log.file.path";
/**
* @class LoggerManager
* @brief \<singleton\> Use for handle logs.
*/
class LoggerManager: public Thread {
public:
static LoggerManager* getInstance();
......
......@@ -32,9 +32,6 @@ public:
bool isAvailable(const std::string &parameterName) const;
const GenericType& get(const std::string &key) const;
const GenericType& getLastAvailable() const; /// Care ! Use it after isAvailable() to ensure that the iterator is in the map range.
size_t size() const;
void clear();
......@@ -45,6 +42,12 @@ public:
bool update(const std::string &key, const GenericType &value);
const GenericType& get(const std::string &key) const;
const GenericType& getLastAvailable() const; /// Care ! Use it after isAvailable() to ensure that the iterator is in the map range.
std::string key(size_t index) const;
GenericType value(size_t index) const;
private:
// <key, value>
std::map<std::string, GenericType> m_parameters;
......
#include "../../../include/ElementaryUtils/parameters/Parameters.h"
#include <iterator>
#include <stdexcept>
#include <utility>
......@@ -101,4 +102,23 @@ bool ElemUtils::Parameters::update(const std::string& key,
return result;
}
std::string Parameters::key(size_t index) const {
std::map<std::string, GenericType>::const_iterator it =
m_parameters.begin();
std::advance(it, index);
return it->first;
}
GenericType Parameters::value(size_t index) const {
std::map<std::string, GenericType>::const_iterator it =
m_parameters.begin();
std::advance(it, index);
return it->second;
}
} // namespace ElemUtils
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment