openMSX
memory
Ram.hh
Go to the documentation of this file.
1
#ifndef RAM_HH
2
#define RAM_HH
3
4
#include "
MemBuffer.hh
"
5
#include "
openmsx.hh
"
6
#include "
static_string_view.hh
"
7
#include <string>
8
#include <memory>
9
10
namespace
openmsx
{
11
12
class
XMLElement
;
13
class
DeviceConfig;
14
class
RamDebuggable;
15
16
class
Ram
17
{
18
public
:
20
Ram
(
const
DeviceConfig
& config,
const
std::string& name,
21
static_string_view
description,
unsigned
size);
22
24
Ram
(
const
XMLElement
& xml,
unsigned
size);
25
26
~Ram
();
27
28
[[nodiscard]]
const
byte
&
operator[]
(
unsigned
addr)
const
{
29
return
ram[addr];
30
}
31
[[nodiscard]]
byte
&
operator[]
(
unsigned
addr) {
32
return
ram[addr];
33
}
34
[[nodiscard]]
unsigned
getSize
()
const
{
35
return
size;
36
}
37
38
[[nodiscard]]
const
std::string&
getName
()
const
;
39
void
clear
(
byte
c = 0xff);
40
41
template
<
typename
Archive>
42
void
serialize
(Archive& ar,
unsigned
version);
43
44
private
:
45
const
XMLElement
& xml;
46
MemBuffer<byte>
ram;
47
unsigned
size;
// must come before debuggable
48
const
std::unique_ptr<RamDebuggable> debuggable;
// can be nullptr
49
};
50
51
}
// namespace openmsx
52
53
#endif
MemBuffer.hh
openmsx::DeviceConfig
Definition:
DeviceConfig.hh:20
openmsx::MemBuffer< byte >
openmsx::Ram
Definition:
Ram.hh:17
openmsx::Ram::Ram
Ram(const DeviceConfig &config, const std::string &name, static_string_view description, unsigned size)
Create Ram object with an associated debuggable.
Definition:
Ram.cc:31
openmsx::Ram::~Ram
~Ram()
openmsx::Ram::operator[]
const byte & operator[](unsigned addr) const
Definition:
Ram.hh:28
openmsx::Ram::getSize
unsigned getSize() const
Definition:
Ram.hh:34
openmsx::Ram::serialize
void serialize(Archive &ar, unsigned version)
Definition:
Ram.cc:121
openmsx::Ram::operator[]
byte & operator[](unsigned addr)
Definition:
Ram.hh:31
openmsx::Ram::clear
void clear(byte c=0xff)
Definition:
Ram.cc:52
openmsx::Ram::getName
const std::string & getName() const
Definition:
Ram.cc:96
openmsx::XMLElement
Definition:
XMLElement.hh:16
static_string_view
static_string_view
Definition:
static_string_view.hh:28
openmsx
This file implemented 3 utility functions:
Definition:
Autofire.cc:5
openmsx::XMLElement
XMLElement
Definition:
XMLElement.cc:300
openmsx.hh
static_string_view.hh
Generated on Fri Feb 26 2021 22:13:44 for openMSX by
1.9.1