ComSquare
IMemory.hpp
Go to the documentation of this file.
1 //
2 // Created by anonymus-raccoon on 1/23/20.
3 //
4 
5 #pragma once
6 
7 #include <cstdint>
8 #include <vector>
9 #include <memory>
10 #include <string>
11 #include "Models/Ints.hpp"
12 #include "Models/Components.hpp"
13 
14 namespace ComSquare::Memory
15 {
17  class IMemory
18  {
19  public:
24  virtual uint8_t read(uint24_t addr) = 0;
25 
30  virtual void write(uint24_t addr, uint8_t data) = 0;
31 
35  virtual bool hasMemoryAt(uint24_t addr) const = 0;
36 
41  virtual uint24_t getRelativeAddress(uint24_t addr) const = 0;
42 
45  virtual uint24_t getSize() const = 0;
46 
48  virtual std::string getName() const = 0;
50  virtual Component getComponent() const = 0;
51 
54  virtual std::string getValueName(uint24_t addr) const = 0;
55 
57  virtual ~IMemory() = default;
58  };
59 };
Ints.hpp
ComSquare::Memory::IMemory::~IMemory
virtual ~IMemory()=default
A virtual default destructor.
ComSquare::Component
Component
Definition: Components.hpp:9
ComSquare::Memory::IMemory::read
virtual uint8_t read(uint24_t addr)=0
Read data from the component.
uint24_t
unsigned uint24_t
Definition: Ints.hpp:10
ComSquare::Memory::IMemory
Common interface implemented by all components mapping memory.
Definition: IMemory.hpp:17
ComSquare::Memory::IMemory::getSize
virtual uint24_t getSize() const =0
Get the size of the data. This size can be lower than the mapped data.
ComSquare::Memory::IMemory::getName
virtual std::string getName() const =0
Get the name of this accessor (used for debug purpose)
ComSquare::Memory::IMemory::getComponent
virtual Component getComponent() const =0
Get the component of this accessor (used for debug purpose)
ComSquare::Memory::IMemory::getRelativeAddress
virtual uint24_t getRelativeAddress(uint24_t addr) const =0
Translate an absolute address to a relative address.
ComSquare::Memory
Definition: AMemory.cpp:7
ComSquare::Memory::IMemory::getValueName
virtual std::string getValueName(uint24_t addr) const =0
Get the name of the data at the address.
ComSquare::Memory::IMemory::write
virtual void write(uint24_t addr, uint8_t data)=0
Write data to this component.
ComSquare::Memory::IMemory::hasMemoryAt
virtual bool hasMemoryAt(uint24_t addr) const =0
Return true if this component has mapped the address.
Components.hpp