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(const std::string &cpt_dir) |
235{ |
236 setCheckpointDir(cpt_dir); |
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 |
251Serializable::unserializeAll(const std::string &cpt_dir) |
252{ |
253 setCheckpointDir(cpt_dir); |
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 |
294debug_serialize(const std::string &cpt_dir) |
295{ |
296 Serializable::serializeAll(cpt_dir); |
297} 298 299 300//////////////////////////////////////////////////////////////////////// 301// 302// SerializableClass member definitions 303// 304//////////////////////////////////////////////////////////////////////// --- 102 unchanged lines hidden --- |