diff options
author | Kevin Lim <ktlim@umich.edu> | 2005-01-18 15:48:38 -0500 |
---|---|---|
committer | Kevin Lim <ktlim@umich.edu> | 2005-01-18 15:48:38 -0500 |
commit | c389c2e327cc3ee1c988855b05505660c6670172 (patch) | |
tree | 7861dcb3ed07f03850ee922db9c0c33b038265e4 /sim/param.cc | |
parent | 42f3b4ffb3fedcb70e9ff068ed7160dc6020b8c4 (diff) | |
parent | 25f54857c9356b7f8608be8d45fec17d6c26bce5 (diff) | |
download | gem5-c389c2e327cc3ee1c988855b05505660c6670172.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/m5/
into zamp.eecs.umich.edu:/z/ktlim2/m5
--HG--
extra : convert_revision : c8b7f46e9d0dbff2a12a7375d361098fba352647
Diffstat (limited to 'sim/param.cc')
-rw-r--r-- | sim/param.cc | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/sim/param.cc b/sim/param.cc index d20be8d33..d666463c9 100644 --- a/sim/param.cc +++ b/sim/param.cc @@ -27,21 +27,21 @@ */ #include <algorithm> +#include <cassert> +#include <cstdio> #include <list> #include <string> #include <vector> -#include <stdio.h> // for sscanf() -#include <assert.h> - -#include "sim/param.hh" -#include "sim/sim_object.hh" #include "base/inifile.hh" -#include "sim/configfile.hh" -#include "sim/config_node.hh" #include "base/misc.hh" +#include "base/range.hh" #include "base/str.hh" #include "base/trace.hh" +#include "sim/config_node.hh" +#include "sim/configfile.hh" +#include "sim/param.hh" +#include "sim/sim_object.hh" using namespace std; @@ -180,6 +180,22 @@ parseParam(const string &s, string &value) return true; } +template <> +bool +parseParam(const string &s, Range<uint32_t> &value) +{ + value = s; + return value.valid(); +} + +template <> +bool +parseParam(const string &s, Range<uint64_t> &value) +{ + value = s; + return value.valid(); +} + // // End of parseParam/showParam definitions. Now we move on to // incorporate them into the Param/VectorParam parse() and showValue() @@ -310,6 +326,9 @@ INSTANTIATE_PARAM_TEMPLATES(double, "double") INSTANTIATE_PARAM_TEMPLATES(bool, "bool") INSTANTIATE_PARAM_TEMPLATES(string, "string") +INSTANTIATE_PARAM_TEMPLATES(Range<uint64_t>, "uint64 range") +INSTANTIATE_PARAM_TEMPLATES(Range<uint32_t>, "uint32 range") + #undef INSTANTIATE_PARAM_TEMPLATES // @@ -602,9 +621,8 @@ ParamContext::parseParams(IniFile &iniFile) for (i = getParamList()->begin(); i != getParamList()->end(); ++i) { string string_value; - if (iniFile.findDefault(iniSection, (*i)->name, string_value)) { + if (iniFile.find(iniSection, (*i)->name, string_value)) (*i)->parse(string_value); - } } } @@ -680,18 +698,8 @@ ParamContext::printErrorProlog(ostream &os) // SimObjectBuilder objects, which return non-NULL for configNode()). // SimObject * -ParamContext::resolveSimObject(const string &_name) -{ - // look for a colon - string::size_type i = _name.find(':'); - string name = _name; - if (i != string::npos) { - // colon found: local object - // add as child to current node and create it - name = _name.substr(0, i); - string objConfigClassName = _name.substr(i + 1); - getConfigNode()->addChild(name, objConfigClassName); - } +ParamContext::resolveSimObject(const string &name) +{ ConfigNode *n = getConfigNode(); return n ? n->resolveSimObject(name) : NULL; } |