openMSX
HD.hh
Go to the documentation of this file.
1 #ifndef HD_HH
2 #define HD_HH
3 
4 #include "Filename.hh"
6 #include "DiskContainer.hh"
7 #include "TigerTree.hh"
8 #include "serialize_meta.hh"
9 #include <string>
10 #include <memory>
11 
12 namespace openmsx {
13 
14 class MSXMotherBoard;
15 class HDCommand;
16 class File;
17 class DeviceConfig;
18 
19 class HD : public SectorAccessibleDisk, public DiskContainer
20  , public TTData
21 {
22 public:
23  explicit HD(const DeviceConfig& config);
24  virtual ~HD();
25 
26  const std::string& getName() const;
27  const Filename& getImageName() const;
28  void switchImage(const Filename& filename);
29 
30  std::string getTigerTreeHash();
31 
32  template<typename Archive>
33  void serialize(Archive& ar, unsigned version);
34 
35  MSXMotherBoard& getMotherBoard() const { return motherBoard; }
36 
37 private:
38  // SectorAccessibleDisk:
39  virtual void readSectorImpl (size_t sector, SectorBuffer& buf);
40  virtual void writeSectorImpl(size_t sector, const SectorBuffer& buf);
41  virtual size_t getNbSectorsImpl() const;
42  virtual bool isWriteProtectedImpl() const;
43  virtual Sha1Sum getSha1Sum();
44 
45  // Diskcontainer:
46  virtual SectorAccessibleDisk* getSectorAccessibleDisk();
47  virtual const std::string& getContainerName() const;
48  virtual bool diskChanged();
49  virtual int insertDisk(const std::string& filename);
50 
51  // TTData
52  virtual uint8_t* getData(size_t offset, size_t size);
53  virtual bool isCacheStillValid(time_t& time);
54 
55  void openImage();
56 
57  MSXMotherBoard& motherBoard;
58  std::string name;
59  std::unique_ptr<HDCommand> hdCommand;
60  std::unique_ptr<TigerTree> tigerTree;
61 
62  std::unique_ptr<File> file;
63  Filename filename;
64  size_t filesize;
65  bool alreadyTried;
66 };
67 
68 REGISTER_BASE_CLASS(HD, "HD");
70 
71 } // namespace openmsx
72 
73 #endif
signed char offset
Definition: CPUCore.cc:252
The TigerTree class will query the to-be-hashed data via this abstract interface. ...
Definition: TigerTree.hh:42
HD(const DeviceConfig &config)
Definition: HD.cc:26
virtual ~HD()
Definition: HD.cc:78
const Filename & getImageName() const
Definition: HD.cc:103
REGISTER_BASE_CLASS(Connector,"Connector")
This class represents the result of a sha1 calculation (a 160-bit value).
Definition: sha1.hh:18
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
This class represents a filename.
Definition: Filename.hh:17
HD
Definition: HD.cc:316
void switchImage(const Filename &filename)
Definition: HD.cc:130
const std::string & getName() const
Definition: HD.cc:98
void serialize(Archive &ar, unsigned version)
Definition: HD.cc:242
size_t size() const
MSXMotherBoard & getMotherBoard() const
Definition: HD.hh:35
std::string getTigerTreeHash()
Definition: HD.cc:179