ICG 2
Electric Boogaloo
J_CheckpointAgent.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include "DataTypeInator.hpp"
5 
10 
11  public:
12 
14 
17  virtual ~J_CheckpointAgent() {};
18 
19 
20  /* ==================================================================== */
21  /* VIRTUAL INTERFACE */
22  /* ==================================================================== */
23 
31  virtual int dump ( std::ostream& checkpoint_out, std::vector<AllocInfo *> allocations_to_checkpoint) override;
32 
40  virtual std::vector<AllocInfo *> restore( std::istream& checkpoint_in, std::vector<AllocInfo *> allocations_to_restore) override;
41 
42 
43  /* ==================================================================== */
44  /* CLASS INTERFACE */
45  /* ==================================================================== */
46 
47  bool writeDeclaration( std::ostream& checkpoint_out, const AllocInfo * alloc);
48  bool writeAssignment( std::ostream& checkpoint_out, const AllocInfo * alloc, const std::vector<AllocInfo *>& additional_search_allocs);
49 
50  AllocInfo * restoreDeclaration(std::string declaration);
51  bool restoreAssignment(std::string assignment_string, const std::vector<AllocInfo *>& additional_search_allocs);
52 
53 
54  private:
55 
56  DataTypeInator * dataTypeInator;
57 
58  static std::string getCheckpointableName(const AllocInfo * alloc);
59  static std::string resolvePointer(void * ptr_to_resolve, std::shared_ptr<const DataType> expected_type, const std::vector<AllocInfo *>& allocs_to_search);
60  static AllocInfo * findAllocByName(std::string name, std::vector<AllocInfo *> search_allocs);
61  static void * lookupPointer(std::string varname, const std::vector<AllocInfo *>& allocs_to_search);
62  static void handleResizeCommand (std::string command_str, const std::vector<AllocInfo *>& allocs_to_search);
63 
64  static const std::string error_str ;
65  static const std::string resize_command ;
66  static const std::string clear_command ;
67 };
Definition: AllocInfo.hpp:33
Definition: NewCheckpointAgentBase.hpp:13
Register and manage datatypes at runtime.
Definition: DataTypeInator.hpp:16
Definition: J_CheckpointAgent.hpp:9
virtual ~J_CheckpointAgent()
Definition: J_CheckpointAgent.hpp:17
J_CheckpointAgent(DataTypeInator *inator)
Definition: J_CheckpointAgent.cpp:17
virtual std::vector< AllocInfo * > restore(std::istream &checkpoint_in, std::vector< AllocInfo * > allocations_to_restore) override
Restore a checkpoint from an input stream.
Definition: J_CheckpointAgent.cpp:144
AllocInfo * restoreDeclaration(std::string declaration)
Definition: J_CheckpointAgent.cpp:207
virtual int dump(std::ostream &checkpoint_out, std::vector< AllocInfo * > allocations_to_checkpoint) override
Dump a checkpoint to the given string.
Definition: J_CheckpointAgent.cpp:24
bool writeDeclaration(std::ostream &checkpoint_out, const AllocInfo *alloc)
Definition: J_CheckpointAgent.cpp:61
bool restoreAssignment(std::string assignment_string, const std::vector< AllocInfo * > &additional_search_allocs)
Definition: J_CheckpointAgent.cpp:222
bool writeAssignment(std::ostream &checkpoint_out, const AllocInfo *alloc, const std::vector< AllocInfo * > &additional_search_allocs)
Definition: J_CheckpointAgent.cpp:70