summaryrefslogtreecommitdiff
path: root/i/marvin/src/config/config.hh
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/config/config.hh')
-rw-r--r--i/marvin/src/config/config.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/i/marvin/src/config/config.hh b/i/marvin/src/config/config.hh
index ab9cfb7..3034b1a 100644
--- a/i/marvin/src/config/config.hh
+++ b/i/marvin/src/config/config.hh
@@ -67,11 +67,24 @@ class Config
{
return configData_.get<T> (id);
}
+ /// Récupère une valeur de configuration, fonction générique avec valeur
+ /// par défaut pour éviter l'exception en cas d'abscence de valeur.
+ template<typename T>
+ const T &get (const std::string &id, const T &defaut) const
+ {
+ return configData_.get<T> (id, defaut);
+ }
/// Récupère une valeur de configuration.
const any &get (const std::string &id) const
{
return configData_.get (id);
}
+ /// Récupère une valeur de configuration avec valeur par défaut pour
+ /// éviter le renvoie d'exception.
+ const any &get (const std::string &id, const any &defaut) const
+ {
+ return configData_.get (id, defaut);
+ }
/// Get the unique instance of the class
static inline Config &
getInstance ()