#include "base/misc.hh"
#include "base/output.hh"
#include "dev/etherdump.hh"
-#include "sim/builder.hh"
#include "sim/core.hh"
using std::string;
-EtherDump::EtherDump(const string &name, const string &file, int max)
- : SimObject(name), stream(file.c_str()), maxlen(max)
+EtherDump::EtherDump(const Params *p)
+ : SimObject(p), stream(simout.resolve(p->file).c_str()),
+ maxlen(p->maxlen)
{
}
stream.flush();
}
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherDump)
-
- Param<string> file;
- Param<int> maxlen;
-
-END_DECLARE_SIM_OBJECT_PARAMS(EtherDump)
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(EtherDump)
-
- INIT_PARAM(file, "file to dump packets to"),
- INIT_PARAM(maxlen, "max portion of packet data to dump")
-
-END_INIT_SIM_OBJECT_PARAMS(EtherDump)
-
-CREATE_SIM_OBJECT(EtherDump)
+EtherDump *
+EtherDumpParams::create()
{
- return new EtherDump(getInstanceName(), simout.resolve(file), maxlen);
+ return new EtherDump(this);
}
-
-REGISTER_SIM_OBJECT("EtherDump", EtherDump)