sim/sim_object.cc:
Add a new constructor that can take the params struct and
tweak the old one to create a params struct if we use the
old constructor.
sim/sim_object.hh:
Hard code a Params struct for SimObject that all other params
structs can derive from. Move the name string into the struct
and update the code accordingly. New constructor that takes
the params struct.
--HG--
extra : convert_revision :
30761dab31d7257f9e8c864dcd6cae37309163f2
extern ObjectMatch event_ignore;
}
+//
+// SimObject constructor: used to maintain static simObjectList
+//
+SimObject::SimObject(Params *p)
+ : _params(p)
+{
+#ifdef DEBUG
+ doDebugBreak = false;
+#endif
+
+ doRecordEvent = !Stats::event_ignore.match(name());
+ simObjectList.push_back(this);
+}
+
//
// SimObject constructor: used to maintain static simObjectList
//
SimObject::SimObject(const string &_name)
- : objName(_name)
+ : _params(new Params)
{
+ _params->name = _name;
#ifdef DEBUG
doDebugBreak = false;
#endif
- doRecordEvent = !Stats::event_ignore.match(_name);
+ doRecordEvent = !Stats::event_ignore.match(name());
simObjectList.push_back(this);
}
*/
class SimObject : public Serializable, protected StartupCallback
{
+ public:
+ struct Params {
+ std::string name;
+ };
+
protected:
- std::string objName;
+ Params *_params;
+
+ public:
+ const Params *params() const { return _params; }
private:
friend class Serializer;
static SimObjectList simObjectList;
public:
-
-// for Params struct
-#include "simobj/param/SimObject.hh"
-
+ SimObject(Params *_params);
SimObject(const std::string &_name);
virtual ~SimObject() {}
- virtual const std::string name() const { return objName; }
+ virtual const std::string name() const { return params()->name; }
// initialization pass of all objects.
// Gets invoked after construction, before unserialize.