diff options
Diffstat (limited to 'sim/builder.cc')
-rw-r--r-- | sim/builder.cc | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/sim/builder.cc b/sim/builder.cc index fa435d322..e2345556e 100644 --- a/sim/builder.cc +++ b/sim/builder.cc @@ -34,10 +34,45 @@ #include "sim/configfile.hh" #include "sim/host.hh" #include "sim/sim_object.hh" -#include "sim/sim_stats.hh" +#include "sim/universe.hh" using namespace std; + +ostream & +builderStream() +{ + static ofstream file; + static ostream *stream = NULL; + + if (!stream) { + if (!outputDirectory.empty()) { + string filename = outputDirectory + "builder.txt"; + file.open(filename.c_str()); + stream = &file; + } else { + stream = outputStream; + } + } + + return *stream; +} + +SimObjectBuilder::SimObjectBuilder(const string &_configClass, + const string &_instanceName, + ConfigNode *_configNode, + const string &_simObjClassName) + : ParamContext(_configClass, true), + instanceName(_instanceName), + configNode(_configNode), + simObjClassName(_simObjClassName) +{ +} + +SimObjectBuilder::~SimObjectBuilder() +{ +} + /////////////////////////////////////////// // // SimObjectBuilder member definitions @@ -151,10 +186,10 @@ SimObjectClass::createObject(IniFile &configDB, // echo object parameters to stats file (for documenting the // config used to generate the associated stats) - *statStream << "[" << object->name() << "]" << endl; - *statStream << "type=" << simObjClassName << endl; - objectBuilder->showParams(*statStream); - *statStream << endl; + builderStream() << "[" << object->name() << "]" << endl; + builderStream() << "type=" << simObjClassName << endl; + objectBuilder->showParams(builderStream()); + builderStream() << endl; // done with the SimObjectBuilder now delete objectBuilder; |