PetaVision  Alpha
CheckpointEntry.hpp
1 /*
2  * CheckpointEntry.hpp
3  *
4  * Created on Sep 27, 2016
5  * Author: Pete Schultz
6  */
7 
8 #ifndef CHECKPOINTENTRY_HPP_
9 #define CHECKPOINTENTRY_HPP_
10 
11 #include "structures/MPIBlock.hpp"
12 #include <string>
13 
14 namespace PV {
15 
17  public:
18  CheckpointEntry(std::string const &name, MPIBlock const *mpiBlock)
19  : mName(name), mMPIBlock(mpiBlock) {}
21  std::string const &objName,
22  std::string const &dataName,
23  MPIBlock const *mpiBlock) {
24  mName = objName;
25  if (!(objName.empty() || dataName.empty())) {
26  mName.append("_");
27  }
28  mName.append(dataName);
29  mMPIBlock = mpiBlock;
30  }
31  virtual void
32  write(std::string const &checkpointDirectory, double simTime, bool verifyWritesFlag) const {
33  return;
34  }
35  virtual void read(std::string const &checkpointDirectory, double *simTimePtr) const { return; }
36  virtual void remove(std::string const &checkpointDirectory) const { return; }
37  std::string const &getName() const { return mName; }
38 
39  protected:
40  std::string
41  generatePath(std::string const &checkpointDirectory, std::string const &extension) const;
42  void deleteFile(std::string const &checkpointDirectory, std::string const &extension) const;
43  MPIBlock const *getMPIBlock() const { return mMPIBlock; }
44 
45  // data members
46  private:
47  std::string mName;
48  MPIBlock const *mMPIBlock;
49 };
50 
51 } // end namespace PV
52 
53 #endif // CHECKPOINTENTRY_HPP_