From 7e7a47c9bad5448ffab4409fb90dd43f0b1875a3 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 15 Mar 2012 18:14:04 +0100 Subject: [PATCH] added a getParam method to the eoParser, that raise an exception if the parameter has not been declared --- eo/src/utils/eoParser.cpp | 9 +++++++++ eo/src/utils/eoParser.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/eo/src/utils/eoParser.cpp b/eo/src/utils/eoParser.cpp index fc1068b3..6ddcdb63 100644 --- a/eo/src/utils/eoParser.cpp +++ b/eo/src/utils/eoParser.cpp @@ -129,6 +129,15 @@ eoParam * eoParser::getParamWithLongName(const std::string& _name) const return 0; } +eoParam * getParam(const std::string& _name) const +{ + eoParam * p = getParamWithLongName( _name ); + if( p == NULL ) { + throw eoMissingParamException(_name ); + } else { + return p; + } +} void eoParser::processParam(eoParam& param, std::string section) { diff --git a/eo/src/utils/eoParser.h b/eo/src/utils/eoParser.h index e65f7566..1ba46317 100644 --- a/eo/src/utils/eoParser.h +++ b/eo/src/utils/eoParser.h @@ -176,6 +176,12 @@ public: eoParam * getParamWithLongName(const std::string& _name) const; + /** + * Get a handle on a param from its long name + * If not found, raise an eoMissingParamException + */ + eoParam * getParam(const std::string& _name) const; + /** Get or create parameter