Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
1804f788
Commit
1804f788
authored
Feb 13, 2014
by
Backofen, Rainer
Browse files
added possibility for defining parameter-map in initfile (used for Zoltan-parameters)
parent
f31c94de
Changes
1
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/Initfile.h
View file @
1804f788
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment