and 'type') to be specified via instance name and not just
config class. Old code only did instance-name lookup for
SimObject parameters. This feature makes life easier for
transitioning to the Python script-based config.
sim/builder.cc:
Use ConfigNode::find to look for "type" parameter so it can
be found if set under instance name (not config class).
sim/param.cc:
Make Param<bool> accept "1" for true and "0" for false.
--HG--
extra : convert_revision :
f40d0878d0f03b2e216f0506c05d0e52db608cca
#include "base/misc.hh"
#include "sim/builder.hh"
#include "sim/configfile.hh"
+#include "sim/config_node.hh"
#include "sim/host.hh"
#include "sim/sim_object.hh"
#include "sim/universe.hh"
// (specified by 'type=' parameter)
string simObjClassName;
- if (!configDB.findDefault(configClassName, "type", simObjClassName)) {
+ if (!configNode->find("type", simObjClassName)) {
cerr << "Configuration class '" << configClassName << "' not found."
<< endl;
abort();
bool
parseParam(const string &s, bool &value)
{
- const string &lower = to_lower(s);
+ const string &ls = to_lower(s);
- if (lower == "true" || lower == "t" || lower == "yes" || lower == "y") {
+ if (ls == "true" || ls == "t" || ls == "yes" || ls == "y" || ls == "1") {
value = true;
return true;
}
- if (lower == "false" || lower == "f" || lower == "no" || lower == "n") {
+ if (ls == "false" || ls == "f" || ls == "no" || ls == "n" || ls == "0") {
value = false;
return true;
}