Commit 1804f788 authored by Backofen, Rainer's avatar Backofen, Rainer
Browse files

added possibility for defining parameter-map in initfile (used for Zoltan-parameters)

parent f31c94de
......@@ -458,6 +458,38 @@ else if(error_code == TAG_NOT_FOUND_BREAK)
singlett->msgInfo = debugInfo;
}
/** Static get routine for getting a parameter-map from init-file
* initialized in init()-method.
* Idea:
* line in Initfile: <tag><key>: <value>
* is extracted in am map [key]->[value].
* @param tag: The tag withch labels the parameter map
* @param debugInfo: msgInfo for current parameter. (0..no printing,
* 2..print parameter value) [optional]
*/
static void getParameterMap(const std::string tag,
std::map<std::string,std::string> &pm,
int debugInfo = -1)
{
initIntern();
for (Initfile::iterator it = singlett->begin(); it != singlett->end(); it++){
std::string longTag= (*it).first ;
std::string value=(*it).second;
if(longTag.compare(tag)>0){
if (debugInfo == 2){
std::cout <<"Extract Parameter map from "<<(*it).first
<< " => " <<(*it).second << std::endl;
}
std::string key=trim(longTag.substr(tag.length()));
if (debugInfo == 2){
std::cout <<"Parameter map "<< key << " => "
<< value << std::endl;
}
pm[key]=value;
}
}
}
/// return InitEntry object for tag tag
static InitEntry get(const std::string tag)
......@@ -473,12 +505,12 @@ else if(error_code == TAG_NOT_FOUND_BREAK)
#if 0
else if(error_code == TAG_NOT_FOUND_BREAK)
throw TagNotFoundBreak("get(): required tag '" + tag + "' not found");
throw TagNotFoundBreak("get(): required tag '" + tag + "' not found");
else if (error_code == TAG_NOT_FOUND)
throw TagNotFound("get(): there is no tag '" + tag + "'");
throw TagNotFound("get(): there is no tag '" + tag + "'");
// exception must be thrown, because an empty object would be return otherwise
else
throw std::runtime_error("get(): unknown error_code returned for tag '" + tag + "'");
throw std::runtime_error("get(): unknown error_code returned for tag '" + tag + "'");
#endif
return result;
......
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