PetaVision  Alpha
CheckpointerDataInterface.hpp
1 /*
2  * CheckpointerDataInterface.hpp
3  *
4  * Created on Feb 22, 2018
5  * Author: Pete Schultz
6  */
7 
8 #ifndef CHECKPOINTERDATAINTERFACE_HPP_
9 #define CHECKPOINTERDATAINTERFACE_HPP_
10 
11 #include "observerpattern/Observer.hpp"
12 
13 #include "Checkpointer.hpp"
14 #include "checkpointing/CheckpointingMessages.hpp"
15 
16 namespace PV {
17 
46  public:
47  virtual Response::Status registerData(Checkpointer *checkpointer);
48 
49  virtual Response::Status respond(std::shared_ptr<BaseMessage const> message) override;
50 
51  virtual Response::Status readStateFromCheckpoint(Checkpointer *checkpointer) {
52  return Response::NO_ACTION;
53  }
54 
55  MPIBlock const *getMPIBlock() { return mMPIBlock; }
56 
57  protected:
58  Response::Status
59  respondRegisterData(std::shared_ptr<RegisterDataMessage<Checkpointer> const> message);
60  Response::Status respondReadStateFromCheckpoint(
61  std::shared_ptr<ReadStateFromCheckpointMessage<Checkpointer> const> message);
62 
63  Response::Status
64  respondProcessCheckpointRead(std::shared_ptr<ProcessCheckpointReadMessage const> message);
65  Response::Status
66  respondPrepareCheckpointWrite(std::shared_ptr<PrepareCheckpointWriteMessage const> message);
67 
68  virtual Response::Status processCheckpointRead() { return Response::NO_ACTION; }
69  virtual Response::Status prepareCheckpointWrite() { return Response::NO_ACTION; }
70 
71  private:
72  MPIBlock const *mMPIBlock = nullptr;
73 };
74 
75 } // namespace PV
76 
77 #endif // CHECKPOINTERDATAINTERFACE_HPP_