Commit 1017acb0 authored by Ludovic Courtès's avatar Ludovic Courtès

params::get_name methods return a const string reference.

parent 1ae1adb7
......@@ -576,8 +576,8 @@ params::output params::parse_output(const std::string& txt)
return params::UNKNOWN_OUTPUT;
}
}
std::string params::get_name(const params::input param)
const std::string& params::get_name(const params::input param)
{
std::map<params::input, const param_info>::const_iterator it = input_map.find(param);
if(it != input_map.end())
......@@ -588,10 +588,12 @@ std::string params::get_name(const params::input param)
#ifdef DEBUG
std::cerr << "<<WARNING>> Unknown parametrization, n°" << param << ", "<< __FILE__ << ":" << __LINE__ << std::endl;
#endif
return std::string("UNKNOWN_INPUT");
static const std::string unknown = "UNKNOWN_INPUT";
return unknown;
}
std::string params::get_name(const params::output param)
const std::string& params::get_name(const params::output param)
{
std::map<params::output, std::string>::const_iterator it = output_map.find(param);
if (it != output_map.end())
......
......@@ -129,13 +129,13 @@ class params
//! \brief look for the string associated with a parametrization
//! type.
static std::string get_name(const params::input param);
static const std::string& get_name(const params::input param);
//! \brief look for the string associated with a parametrization
//! type.
//! \todo Finish this implementation. It requires another static
//! object.
static std::string get_name(const params::output);
static const std::string& get_name(const params::output);
//! \brief static function for input type convertion. This
//! function allocate the resulting vector.
......
Markdown is supported
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