20 a->description = description;
24 key = uint2str(index) + key;
26 map_iter it = parameters_.find(key);
27 if(it != parameters_.end())
30 parameters_.insert (std::pair < std::string, ParamP >(key, a));
252 int num = node.nChildNode(NODE_ENTRY), iter = 0;
254 for (
int i = 0; i < num; ++i) {
255 XMLNode child = node.getChildNode(NODE_ENTRY, &iter);
256 if(!child.getAttribute(
"key")) {
257 std::cerr <<
"Error: no attribute 'key' in current entry! (node '" << node.getName() <<
"')" << std::endl;
261 std::string key = (prefix.length() > 0 ? prefix +
"." :
"") + child.getAttribute(
"key");
262 if (child.getText() == NULL) {
263 std::cerr <<
"Error: no text in Entry node! (key: " << key <<
")" << std::endl;
266 std::string value = child.getText();
269 key = uint2str(index) + key;
272 std::cerr <<
"Warning: key " << key <<
" not registered." << std::endl;
285 new_value = (voidP)x;
292 *x = str2uint(value);
293 new_value = (voidP)x;
299 std::string *s =
new std::string(value);
300 new_value = (voidP)s;
305 float *x =
new float;
307 new_value = (voidP)x;
314 double *x =
new double;
316 new_value = (voidP)x;
324 new_value = (voidP)x;
347 xRegistry = XMLNode::createXMLTopNode(NODE_REGISTRY);
349 for (map_iter it = parameters_.begin(); it != parameters_.end(); ++it) {
351 if(!it->second->bModified)
354 XMLNode xParam = XMLNode::createXMLTopNode(NODE_ENTRY);
355 std::string key = it->first;
356 voidP value = it->second->value;
358 std::stringstream ss;
362 ss << *((
int *)value.get());
365 ss << *((uint *)value.get());
368 ss << *((std::string *)value.get());
371 ss << *((
float *)value.get());
374 ss << *((
double *)value.get());
377 ss << *((
char *)value.get());
382 xParam.addAttribute(
"key", key.c_str());
383 xParam.addText(ss.str().c_str());
384 xRegistry.addChild(xParam);
395 xRegistry = XMLNode::createXMLTopNode(NODE_REGISTRY);
397 for (map_iter it = parameters_.begin(); it != parameters_.end(); ++it) {
399 XMLNode xParam = XMLNode::createXMLTopNode(NODE_ENTRY);
400 std::string key = it->first;
401 voidP value = it->second->value;
403 std::string desc = it->second->description;
405 std::stringstream ss;
409 ss << *((
int *)value.get());
412 ss << *((uint *)value.get());
415 ss << *((std::string *)value.get());
418 ss << *((
float *)value.get());
421 ss << *((
double *)value.get());
424 ss << *((
char *)value.get());
429 xParam.addAttribute(
"key", key.c_str());
430 xParam.addText(ss.str().c_str());
431 xParam.addAttribute(
"desc", desc.c_str());
432 xRegistry.addChild(xParam);
type
Data types used for configuration file parameters.