sim: Make SimObject inherit from Named

Standardize name creation of sim objects.

Change-Id: I5e0cb828da0810b47217e96e302857e32083c50b
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43246
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
Daniel R. Carvalho
2021-03-18 10:13:22 -03:00
committed by Daniel Carvalho
parent bac49a04b5
commit a906e04cb7
5 changed files with 4 additions and 19 deletions

View File

@@ -917,12 +917,6 @@ ElasticTrace::TraceInfo::typeToStr() const
return Record::RecordType_Name(type);
}
const std::string
ElasticTrace::name() const
{
return ProbeListenerObject::name();
}
void
ElasticTrace::flushTraces()
{

View File

@@ -109,9 +109,6 @@ class ElasticTrace : public ProbeListenerObject
/** Register all listeners. */
void regEtraceListeners();
/** Returns the name of the trace probe listener. */
const std::string name() const;
/**
* Process any outstanding trace records, flush them out to the protobuf
* output streams and delete the streams at simulation exit.

View File

@@ -63,8 +63,7 @@ class SimpleTrace : public ProbeListenerObject
/** Register the probe listeners. */
void regProbeListeners() override;
/** Returns the name of the trace. */
const std::string
std::string
name() const override
{
return ProbeListenerObject::name() + ".trace";

View File

@@ -54,7 +54,7 @@ SimObjectResolver *SimObject::_objNameResolver = NULL;
//
SimObject::SimObject(const Params &p)
: EventManager(getEventQueue(p.eventq_index)),
statistics::Group(nullptr),
statistics::Group(nullptr), Named(p.name),
_params(p)
{
#ifdef DEBUG

View File

@@ -49,6 +49,7 @@
#include <string>
#include <vector>
#include "base/named.hh"
#include "base/stats/group.hh"
#include "params/SimObject.hh"
#include "sim/drain.hh"
@@ -140,7 +141,7 @@ class SimObjectResolver;
* \endcode
*/
class SimObject : public EventManager, public Serializable, public Drainable,
public statistics::Group
public statistics::Group, public Named
{
private:
typedef std::vector<SimObject *> SimObjectList;
@@ -179,12 +180,6 @@ class SimObject : public EventManager, public Serializable, public Drainable,
virtual ~SimObject();
public:
/**
* @ingroup api_simobject
*/
virtual const std::string name() const { return params().name; }
/**
* init() is called after all C++ SimObjects have been created and
* all ports are connected. Initializations that are independent