From 0f8067fbf6106a197212859543ba865b396e75d4 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 15 Mar 2005 17:11:54 -0500 Subject: Hard code the SimObject::Params struct 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 --- sim/sim_object.hh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sim/sim_object.hh') diff --git a/sim/sim_object.hh b/sim/sim_object.hh index b8a3090ad..db8d4f4d3 100644 --- a/sim/sim_object.hh +++ b/sim/sim_object.hh @@ -48,8 +48,16 @@ */ 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; @@ -60,15 +68,12 @@ class SimObject : public Serializable, protected StartupCallback 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. -- cgit v1.2.3