OXYGENHUB
◆ main openmsx / src / memory / RomDatabase.hh
755 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef ROMDATABASE_HH
2
#define ROMDATABASE_HH
3
4
#include "RomInfo.hh"
5
6
#include "MemBuffer.hh"
7
#include "sha1.hh"
8
9
#include <vector>
10
11
namespace openmsx {
12
13
class CliComm;
14
15
class RomDatabase
16
{
17
public:
18
	struct Entry {
19
		Sha1Sum sha1;
20
		RomInfo romInfo;
21
	};
22
	using RomDB = std::vector<Entry>; // sorted on sha1
23
24
	explicit RomDatabase(CliComm& cliComm);
25
26
	/** Lookup an entry in the database by sha1sum.
27
	 * Returns nullptr when no corresponding entry was found.
28
	 */
29
	[[nodiscard]] const RomInfo* fetchRomInfo(const Sha1Sum& sha1sum) const;
30
31
	[[nodiscard]] const RomDB& getFullDB() const { return db; }
32
	[[nodiscard]] const char* getBufferStart() const { return buffer.data(); }
33
34
private:
35
	RomDB db;
36
	MemBuffer<char> buffer;
37
};
38
39
} // namespace openmsx
40
41
#endif