serialize.cc (2667:fe64b8353b1c) serialize.cc (2738:5d7a31c7fa29)
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;

--- 30 unchanged lines hidden (view full) ---

39#include <string>
40#include <vector>
41
42#include "base/inifile.hh"
43#include "base/misc.hh"
44#include "base/output.hh"
45#include "base/str.hh"
46#include "base/trace.hh"
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;

--- 30 unchanged lines hidden (view full) ---

39#include <string>
40#include <vector>
41
42#include "base/inifile.hh"
43#include "base/misc.hh"
44#include "base/output.hh"
45#include "base/str.hh"
46#include "base/trace.hh"
47#include "sim/config_node.hh"
48#include "sim/eventq.hh"
49#include "sim/param.hh"
50#include "sim/serialize.hh"
51#include "sim/sim_events.hh"
52#include "sim/sim_exit.hh"
53#include "sim/sim_object.hh"
54
55using namespace std;

--- 381 unchanged lines hidden (view full) ---

437Serializable::create(Checkpoint *cp, const std::string &section)
438{
439 Serializable *object = SerializableClass::createObject(cp, section);
440 object->unserialize(cp, section);
441 return object;
442}
443
444
47#include "sim/eventq.hh"
48#include "sim/param.hh"
49#include "sim/serialize.hh"
50#include "sim/sim_events.hh"
51#include "sim/sim_exit.hh"
52#include "sim/sim_object.hh"
53
54using namespace std;

--- 381 unchanged lines hidden (view full) ---

436Serializable::create(Checkpoint *cp, const std::string &section)
437{
438 Serializable *object = SerializableClass::createObject(cp, section);
439 object->unserialize(cp, section);
440 return object;
441}
442
443
445Checkpoint::Checkpoint(const std::string &cpt_dir, const std::string &path,
446 const ConfigNode *_configNode)
447 : db(new IniFile), basePath(path), configNode(_configNode), cptDir(cpt_dir)
444Checkpoint::Checkpoint(const std::string &cpt_dir, const std::string &path)
445 : db(new IniFile), basePath(path), cptDir(cpt_dir)
448{
449 string filename = cpt_dir + "/" + Checkpoint::baseFilename;
450 if (!db->load(filename)) {
451 fatal("Can't load checkpoint file '%s'\n", filename);
452 }
453}
454
455

--- 9 unchanged lines hidden (view full) ---

465Checkpoint::findObj(const std::string &section, const std::string &entry,
466 Serializable *&value)
467{
468 string path;
469
470 if (!db->find(section, entry, path))
471 return false;
472
446{
447 string filename = cpt_dir + "/" + Checkpoint::baseFilename;
448 if (!db->load(filename)) {
449 fatal("Can't load checkpoint file '%s'\n", filename);
450 }
451}
452
453

--- 9 unchanged lines hidden (view full) ---

463Checkpoint::findObj(const std::string &section, const std::string &entry,
464 Serializable *&value)
465{
466 string path;
467
468 if (!db->find(section, entry, path))
469 return false;
470
473 if ((value = configNode->resolveSimObject(path)) != NULL)
474 return true;
475
476 if ((value = objMap[path]) != NULL)
477 return true;
478
479 return false;
480}
481
482
483bool
484Checkpoint::sectionExists(const std::string &section)
485{
486 return db->sectionExists(section);
487}
471 if ((value = objMap[path]) != NULL)
472 return true;
473
474 return false;
475}
476
477
478bool
479Checkpoint::sectionExists(const std::string &section)
480{
481 return db->sectionExists(section);
482}