27 #ifndef _ParameterFile_HXX
28 #define _ParameterFile_HXX
47 std::ostringstream str;
49 _set(parameter, str.str());
54 const std::vector<T>& value) {
56 std::ostringstream str;
58 for (
unsigned int i = 1; i < value.size(); i++) {
59 str <<
";" << value[i];
61 _set(parameter, str.str());
68 std::map<std::string, std::string>::const_iterator found;
69 found =
_params.find(parameter);
73 std::istringstream strm(found->second);
82 return get<T> (parameter);
85 sout <<
"(WW) setting unkown parameter '" << parameter <<
"' to '"
86 << defaultValue <<
"'" << std::endl;
87 set<T> (parameter, defaultValue);
95 std::vector<T> result;
96 std::map<std::string, std::string>::const_iterator found;
97 found =
_params.find(parameter);
101 std::string value = found->second;
102 if (value !=
"" && value !=
"none") {
103 std::vector<std::string> tmp;
106 result.resize(tmp.size());
107 for (
unsigned int i = 0; i < tmp.size(); ++i) {
108 std::istringstream strm(tmp[i]);
119 std::string defaultValue) {
120 if (
isSet(parameter))
121 return getList<T> (parameter);
124 sout <<
"(WW) setting unkown parameter '"
125 << parameter <<
"' to '"
126 << defaultValue <<
"'" << std::endl;
127 set(parameter, defaultValue);
128 return getList<T> (parameter);
133 std::string::size_type pos = name.find(
".");
134 if (pos != std::string::npos)
135 name = name.substr(pos + 1);
140 std::string::size_type pos = name.find(
".");
141 if (pos != std::string::npos)
142 name = name.substr(0, pos);
148 input.begin(), input.end(), input.begin(),
149 (int(*)(int)) tolower);
158 std::map<std::string, std::string>::const_iterator found;
159 found =
_params.find(parameter);
164 return found->second;
171 std::map<std::string, std::string>::const_iterator found;
172 found =
_params.find(parameter);
176 std::string val = found->second;
184 std::istringstream strm(val);
193 std::string parameter)
const {
195 std::vector<std::string> result;
196 std::map<std::string, std::string>::const_iterator found;
197 found =
_params.find(parameter);
200 std::string value = found->second;
201 if (value !=
"" && value !=
"none") {
205 for (
unsigned int i = 0; i < result.size(); ++i)
212 #endif // _ParameterFile_HXX
std::map< std::string, std::string > _params
maps parameters to their respective values
static charon_DEPRECATED std::string parName(std::string fullName)
get parameter component of a full name
SplitStream sout
Dummy instance for usage in other files (for interface too).
void _toLower(std::string &input) const
Get the lowercase version of a string.
static charon_DEPRECATED std::string objName(std::string fullName)
get object name component of a full name
Declaration of class ParameterFile.
Exception thrown when trying to access unset parameters.
std::vector< T > getList(std::string parameter) const
If multiple values are set, return a list containing these values.
bool _convertSlashes
convert linux to windows slashes and vice versa (depends on define CHARON_LINUX/CHARON_WINDOWS in Str...
char _delimiter
delimiter for lists of values (default is ';')
void set(std::string parameter, const T &value=T())
Set a parameter to the given single value.
T get(std::string parameter) const
Get the value of a specified parameter.
bool isSet(std::string parameter) const
Check if a givem parameter has already been set.
bool _noFoundWarnings
warn if parameter was not found
Declaration of class SplitStream.
void _set(std::string parameter, std::string value)
Store a string value to the parameter list.