serialize.cc (2797:b5f26b4eacef) | serialize.cc (2868:6a7e69fa92d3) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 217 unchanged lines hidden (view full) --- 226{ 227 const string §ion = name(); 228 UNSERIALIZE_SCALAR(curTick); 229 230 mainEventQueue.unserialize(cp, "MainEventQueue"); 231} 232 233void | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 217 unchanged lines hidden (view full) --- 226{ 227 const string §ion = name(); 228 UNSERIALIZE_SCALAR(curTick); 229 230 mainEventQueue.unserialize(cp, "MainEventQueue"); 231} 232 233void |
234Serializable::serializeAll() | 234Serializable::serializeAll(const std::string &cpt_dir) |
235{ | 235{ |
236 setCheckpointDir(cpt_dir); |
|
236 string dir = Checkpoint::dir(); 237 if (mkdir(dir.c_str(), 0775) == -1 && errno != EEXIST) 238 fatal("couldn't mkdir %s\n", dir); 239 240 string cpt_file = dir + Checkpoint::baseFilename; 241 ofstream outstream(cpt_file.c_str()); 242 time_t t = time(NULL); 243 outstream << "// checkpoint generated: " << ctime(&t); 244 245 globals.serialize(outstream); 246 SimObject::serializeAll(outstream); 247} 248 249void | 237 string dir = Checkpoint::dir(); 238 if (mkdir(dir.c_str(), 0775) == -1 && errno != EEXIST) 239 fatal("couldn't mkdir %s\n", dir); 240 241 string cpt_file = dir + Checkpoint::baseFilename; 242 ofstream outstream(cpt_file.c_str()); 243 time_t t = time(NULL); 244 outstream << "// checkpoint generated: " << ctime(&t); 245 246 globals.serialize(outstream); 247 SimObject::serializeAll(outstream); 248} 249 250void |
250Serializable::unserializeAll() | 251Serializable::unserializeAll(const std::string &cpt_dir) |
251{ | 252{ |
253 setCheckpointDir(cpt_dir); |
|
252 string dir = Checkpoint::dir(); 253 string cpt_file = dir + Checkpoint::baseFilename; 254 string section = ""; 255 256 DPRINTFR(Config, "Loading checkpoint dir '%s'\n", 257 dir); 258 Checkpoint *cp = new Checkpoint(dir, section); 259 unserializeGlobals(cp); --- 24 unchanged lines hidden (view full) --- 284{ 285 // use csprintf to insert curTick into directory name if it 286 // appears to have a format placeholder in it. 287 return (checkpointDirBase.find("%") != string::npos) ? 288 csprintf(checkpointDirBase, curTick) : checkpointDirBase; 289} 290 291void | 254 string dir = Checkpoint::dir(); 255 string cpt_file = dir + Checkpoint::baseFilename; 256 string section = ""; 257 258 DPRINTFR(Config, "Loading checkpoint dir '%s'\n", 259 dir); 260 Checkpoint *cp = new Checkpoint(dir, section); 261 unserializeGlobals(cp); --- 24 unchanged lines hidden (view full) --- 286{ 287 // use csprintf to insert curTick into directory name if it 288 // appears to have a format placeholder in it. 289 return (checkpointDirBase.find("%") != string::npos) ? 290 csprintf(checkpointDirBase, curTick) : checkpointDirBase; 291} 292 293void |
292debug_serialize() | 294debug_serialize(const std::string &cpt_dir) |
293{ | 295{ |
294 Serializable::serializeAll(); | 296 Serializable::serializeAll(cpt_dir); |
295} 296 297 298//////////////////////////////////////////////////////////////////////// 299// 300// SerializableClass member definitions 301// 302//////////////////////////////////////////////////////////////////////// --- 102 unchanged lines hidden --- | 297} 298 299 300//////////////////////////////////////////////////////////////////////// 301// 302// SerializableClass member definitions 303// 304//////////////////////////////////////////////////////////////////////// --- 102 unchanged lines hidden --- |