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));
41 return parameters_.find(key) != parameters_.end();
53 key = uint2str(index) + key;
55 map_iter it = parameters_.find(key);
56 if(it != parameters_.end()) {
58 it->second->bModified=
true;
74 key = uint2str(index) + key;
76 map_iter iter = parameters_.find(key);
78 if (iter != parameters_.end())
79 return iter->second->value;
93 map_iter iter = parameters_.find(key);
94 if (iter != parameters_.end())
95 return iter->second->T;
109 key = uint2str(index) + key;
111 map_iter iter = parameters_.find(key);
113 if (iter != parameters_.end())
114 return iter->second->bModified;
130 int num =
node.nChildNode(NODE_ENTRY), iter = 0;
132 for (
int i = 0; i < num; ++i) {
133 XMLNode child =
node.getChildNode(NODE_ENTRY, &iter);
134 if(!child.getAttribute(
"key")) {
135 std::cerr <<
"Error: no attribute 'key' in current entry! (node '" <<
node.getName() <<
"')" << std::endl;
139 std::string key = (prefix.length() > 0 ? prefix +
"." :
"") + child.getAttribute(
"key");
140 if (child.getText() == NULL) {
141 std::cerr <<
"Error: no text in Entry node! (key: " << key <<
")" << std::endl;
144 std::string value = child.getText();
147 key = uint2str(index) + key;
150 std::cerr <<
"Warning: key " << key <<
" not registered." << std::endl;
163 new_value = (voidP)x;
170 *x = str2uint(value);
171 new_value = (voidP)x;
177 std::string *s =
new std::string(value);
178 new_value = (voidP)s;
183 float *x =
new float;
185 new_value = (voidP)x;
192 double *x =
new double;
194 new_value = (voidP)x;
202 new_value = (voidP)x;
225 xRegistry = XMLNode::createXMLTopNode(NODE_REGISTRY);
227 for (map_iter it = parameters_.begin(); it != parameters_.end(); ++it) {
229 if(!it->second->bModified)
232 XMLNode xParam = XMLNode::createXMLTopNode(NODE_ENTRY);
233 std::string key = it->first;
234 voidP value = it->second->value;
236 std::stringstream ss;
240 ss << *((
int *)value.get());
243 ss << *((uint *)value.get());
246 ss << *((std::string *)value.get());
249 ss << *((
float *)value.get());
252 ss << *((
double *)value.get());
255 ss << *((
char *)value.get());
260 xParam.addAttribute(
"key", key.c_str());
261 xParam.addText(ss.str().c_str());
262 xRegistry.addChild(xParam);
273 xRegistry = XMLNode::createXMLTopNode(NODE_REGISTRY);
275 for (map_iter it = parameters_.begin(); it != parameters_.end(); ++it) {
277 XMLNode xParam = XMLNode::createXMLTopNode(NODE_ENTRY);
278 std::string key = it->first;
279 voidP value = it->second->value;
281 std::string desc = it->second->description;
283 std::stringstream ss;
287 ss << *((
int *)value.get());
290 ss << *((uint *)value.get());
293 ss << *((std::string *)value.get());
296 ss << *((
float *)value.get());
299 ss << *((
double *)value.get());
302 ss << *((
char *)value.get());
307 xParam.addAttribute(
"key", key.c_str());
308 xParam.addText(ss.str().c_str());
309 xParam.addAttribute(
"desc", desc.c_str());
310 xRegistry.addChild(xParam);
bool isRegistered(std::string)
voidP getEntry(std::string, uint index=0)
ECF::type getType(std::string)
bool modifyEntry(std::string, voidP, uint index=0)
void dumpEntries(XMLNode &)
bool readEntries(const XMLNode &node, std::string prefix="", uint index=0)
bool registerEntry(std::string, voidP, enum ECF::type, std::string description="", uint index=0)
bool isModified(std::string, uint index=0)
type
Data types used for configuration file parameters.
ECF parameter structure, as stored in the Registry.