template <class T>
void
-paramOut(ostream &os, const std::string &name, const T ¶m)
+paramOut(ostream &os, const string &name, const T ¶m)
{
os << name << "=";
showParam(os, param);
template <class T>
void
-arrayParamOut(ostream &os, const std::string &name,
- const std::vector<T> ¶m)
+arrayParamOut(ostream &os, const string &name, const vector<T> ¶m)
{
int size = param.size();
os << name << "=";
template <class T>
void
-paramIn(Checkpoint *cp, const std::string §ion,
- const std::string &name, T ¶m)
+paramIn(Checkpoint *cp, const string §ion, const string &name, T ¶m)
{
- std::string str;
+ string str;
if (!cp->find(section, name, str) || !parseParam(str, param)) {
fatal("Can't unserialize '%s:%s'\n", section, name);
}
template <class T>
void
-arrayParamOut(ostream &os, const std::string &name,
- const T *param, int size)
+arrayParamOut(ostream &os, const string &name, const T *param, int size)
{
os << name << "=";
if (size > 0)
template <class T>
void
-arrayParamIn(Checkpoint *cp, const std::string §ion,
- const std::string &name, T *param, int size)
+arrayParamIn(Checkpoint *cp, const string §ion, const string &name,
+ T *param, int size)
{
- std::string str;
+ string str;
if (!cp->find(section, name, str)) {
fatal("Can't unserialize '%s:%s'\n", section, name);
}
template <class T>
void
-arrayParamIn(Checkpoint *cp, const std::string §ion,
- const std::string &name, std::vector<T> ¶m)
+arrayParamIn(Checkpoint *cp, const string §ion,
+ const string &name, vector<T> ¶m)
{
- std::string str;
+ string str;
if (!cp->find(section, name, str)) {
fatal("Can't unserialize '%s:%s'\n", section, name);
}
void
-objParamIn(Checkpoint *cp, const std::string §ion,
- const std::string &name, SimObject * ¶m)
+objParamIn(Checkpoint *cp, const string §ion,
+ const string &name, SimObject * ¶m)
{
if (!cp->findObj(section, name, param)) {
fatal("Can't unserialize '%s:%s'\n", section, name);
#define INSTANTIATE_PARAM_TEMPLATES(type) \
template void \
-paramOut(ostream &os, const std::string &name, type const ¶m); \
+paramOut(ostream &os, const string &name, type const ¶m); \
template void \
-paramIn(Checkpoint *cp, const std::string §ion, \
- const std::string &name, type & param); \
+paramIn(Checkpoint *cp, const string §ion, \
+ const string &name, type & param); \
template void \
-arrayParamOut(ostream &os, const std::string &name, \
+arrayParamOut(ostream &os, const string &name, \
type const *param, int size); \
template void \
-arrayParamIn(Checkpoint *cp, const std::string §ion, \
- const std::string &name, type *param, int size); \
+arrayParamIn(Checkpoint *cp, const string §ion, \
+ const string &name, type *param, int size); \
template void \
-arrayParamOut(ostream &os, const std::string &name, \
- const std::vector<type> ¶m); \
+arrayParamOut(ostream &os, const string &name, \
+ const vector<type> ¶m); \
template void \
-arrayParamIn(Checkpoint *cp, const std::string §ion, \
- const std::string &name, std::vector<type> ¶m);
+arrayParamIn(Checkpoint *cp, const string §ion, \
+ const string &name, vector<type> ¶m);
INSTANTIATE_PARAM_TEMPLATES(signed char)
INSTANTIATE_PARAM_TEMPLATES(unsigned char)
}
void
-Serializable::serialize(std::ostream &os)
+Serializable::serialize(ostream &os)
{
}
void
-Serializable::unserialize(Checkpoint *cp, const std::string §ion)
+Serializable::unserialize(Checkpoint *cp, const string §ion)
{
}
void
-Serializable::serializeAll(const std::string &cpt_dir)
+Serializable::serializeAll(const string &cpt_dir)
{
setCheckpointDir(cpt_dir);
string dir = Checkpoint::dir();
}
void
-Serializable::unserializeAll(const std::string &cpt_dir)
+Serializable::unserializeAll(const string &cpt_dir)
{
setCheckpointDir(cpt_dir);
string dir = Checkpoint::dir();
static string checkpointDirBase;
void
-setCheckpointDir(const std::string &name)
+setCheckpointDir(const string &name)
{
checkpointDirBase = name;
if (checkpointDirBase[checkpointDirBase.size() - 1] != '/')
}
void
-debug_serialize(const std::string &cpt_dir)
+debug_serialize(const string &cpt_dir)
{
Serializable::serializeAll(cpt_dir);
}
// Need to make this a pointer so we can force initialization on the
// first reference; otherwise, some SerializableClass constructors
// may be invoked before the classMap constructor.
-map<string,SerializableClass::CreateFunc> *SerializableClass::classMap = 0;
+map<string, SerializableClass::CreateFunc> *SerializableClass::classMap = 0;
// SerializableClass constructor: add mapping to classMap
SerializableClass::SerializableClass(const string &className,
- CreateFunc createFunc)
+ CreateFunc createFunc)
{
if (classMap == NULL)
- classMap = new map<string,SerializableClass::CreateFunc>();
+ classMap = new map<string, SerializableClass::CreateFunc>();
if ((*classMap)[className])
- {
- cerr << "Error: simulation object class " << className << " redefined"
- << endl;
- fatal("");
- }
+ fatal("Error: simulation object class %s redefined\n", className);
// add className --> createFunc to class map
(*classMap)[className] = createFunc;
}
-
//
//
Serializable *
-SerializableClass::createObject(Checkpoint *cp,
- const std::string §ion)
+SerializableClass::createObject(Checkpoint *cp, const string §ion)
{
string className;
Serializable *
-Serializable::create(Checkpoint *cp, const std::string §ion)
+Serializable::create(Checkpoint *cp, const string §ion)
{
Serializable *object = SerializableClass::createObject(cp, section);
object->unserialize(cp, section);
}
-Checkpoint::Checkpoint(const std::string &cpt_dir, const std::string &path)
+Checkpoint::Checkpoint(const string &cpt_dir, const string &path)
: db(new IniFile), basePath(path), cptDir(cpt_dir)
{
string filename = cpt_dir + "/" + Checkpoint::baseFilename;
bool
-Checkpoint::find(const std::string §ion, const std::string &entry,
- std::string &value)
+Checkpoint::find(const string §ion, const string &entry, string &value)
{
return db->find(section, entry, value);
}
bool
-Checkpoint::findObj(const std::string §ion, const std::string &entry,
+Checkpoint::findObj(const string §ion, const string &entry,
SimObject *&value)
{
string path;
bool
-Checkpoint::sectionExists(const std::string §ion)
+Checkpoint::sectionExists(const string §ion)
{
return db->sectionExists(section);
}