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; --- 205 unchanged lines hidden (view full) --- 214// Macros to encapsulate the magic of declaring & defining 215// SerializableBuilder and SerializableClass objects 216// 217 218#define REGISTER_SERIALIZEABLE(CLASS_NAME, OBJ_CLASS) \ 219SerializableClass the##OBJ_CLASS##Class(CLASS_NAME, \ 220 OBJ_CLASS::createForUnserialize); 221 |
222class Checkpoint 223{ 224 private: 225 226 IniFile *db; |
227 228 public: |
229 Checkpoint(const std::string &cpt_dir); |
230 231 const std::string cptDir; 232 233 bool find(const std::string §ion, const std::string &entry, 234 std::string &value); 235 236 bool findObj(const std::string §ion, const std::string &entry, 237 SimObject *&value); 238 239 bool sectionExists(const std::string §ion); 240 241 // The following static functions have to do with checkpoint 242 // creation rather than restoration. This class makes a handy |
243 // namespace for them though. Currently no Checkpoint object is 244 // created on serialization (only unserialization) so we track the 245 // directory name as a global. It would be nice to change this 246 // someday |
247 |
248 private: 249 // current directory we're serializing into. 250 static std::string currentDirectory; 251 252 public: 253 // Set the current directory. This function takes care of 254 // inserting curTick if there's a '%d' in the argument, and 255 // appends a '/' if necessary. The final name is returned. 256 static std::string setDir(const std::string &base_name); 257 |
258 // Export current checkpoint directory name so other objects can 259 // derive filenames from it (e.g., memory). The return value is 260 // guaranteed to end in '/' so filenames can be directly appended. 261 // This function is only valid while a checkpoint is being created. 262 static std::string dir(); 263 264 // Filename for base checkpoint file within directory. 265 static const char *baseFilename; 266}; 267 268#endif // __SERIALIZE_HH__ |