serialize.hh (11069:c5388db11c76) | serialize.hh (11072:6a447a3138ef) |
---|---|
1/* 2 * Copyright (c) 2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 336 unchanged lines hidden (view full) --- 345 void serializeSectionOld(CheckpointOut &cp, const std::string &name) { 346 serializeSectionOld(cp, name.c_str()); 347 } 348 /** @} */ 349 350 /** Get the fully-qualified name of the active section */ 351 static const std::string ¤tSection(); 352 | 1/* 2 * Copyright (c) 2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 336 unchanged lines hidden (view full) --- 345 void serializeSectionOld(CheckpointOut &cp, const std::string &name) { 346 serializeSectionOld(cp, name.c_str()); 347 } 348 /** @} */ 349 350 /** Get the fully-qualified name of the active section */ 351 static const std::string ¤tSection(); 352 |
353 static Serializable *create(CheckpointIn &cp, const std::string §ion); 354 | |
355 static int ckptCount; 356 static int ckptMaxCount; 357 static int ckptPrevCount; 358 static void serializeAll(const std::string &cpt_dir); 359 static void unserializeGlobals(CheckpointIn &cp); 360 361 private: 362 static std::stack<std::string> path; 363}; 364 365void debug_serialize(const std::string &cpt_dir); 366 | 353 static int ckptCount; 354 static int ckptMaxCount; 355 static int ckptPrevCount; 356 static void serializeAll(const std::string &cpt_dir); 357 static void unserializeGlobals(CheckpointIn &cp); 358 359 private: 360 static std::stack<std::string> path; 361}; 362 363void debug_serialize(const std::string &cpt_dir); 364 |
367// 368// An instance of SerializableClass corresponds to a class derived from 369// Serializable. The SerializableClass instance serves to bind the string 370// name (found in the config file) to a function that creates an 371// instance of the appropriate derived class. 372// 373// This would be much cleaner in Smalltalk or Objective-C, where types 374// are first-class objects themselves. 375// 376class SerializableClass 377{ 378 public: | |
379 | 365 |
380 // Type CreateFunc is a pointer to a function that creates a new 381 // simulation object builder based on a .ini-file parameter 382 // section (specified by the first string argument), a unique name 383 // for the object (specified by the second string argument), and 384 // an optional config hierarchy node (specified by the third 385 // argument). A pointer to the new SerializableBuilder is returned. 386 typedef Serializable *(*CreateFunc)(CheckpointIn &cp, 387 const std::string §ion); 388 389 static std::map<std::string,CreateFunc> *classMap; 390 391 // Constructor. For example: 392 // 393 // SerializableClass baseCacheSerializableClass("BaseCacheSerializable", 394 // newBaseCacheSerializableBuilder); 395 // 396 SerializableClass(const std::string &className, CreateFunc createFunc); 397 398 // create Serializable given name of class and pointer to 399 // configuration hierarchy node 400 static Serializable *createObject(CheckpointIn &cp, 401 const std::string §ion); 402}; 403 404// 405// Macros to encapsulate the magic of declaring & defining 406// SerializableBuilder and SerializableClass objects 407// 408 409#define REGISTER_SERIALIZEABLE(CLASS_NAME, OBJ_CLASS) \ 410SerializableClass the##OBJ_CLASS##Class(CLASS_NAME, \ 411 OBJ_CLASS::createForUnserialize); 412 413 | |
414class CheckpointIn 415{ 416 private: 417 418 IniFile *db; 419 420 SimObjectResolver &objNameResolver; 421 --- 42 unchanged lines hidden --- | 366class CheckpointIn 367{ 368 private: 369 370 IniFile *db; 371 372 SimObjectResolver &objNameResolver; 373 --- 42 unchanged lines hidden --- |