ComSquare
AMemory.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 #include "IMemory.hpp"
14 
15 namespace ComSquare::Memory
16 {
18  class AMemory : public IMemory {
19  protected:
24  public:
29  [[nodiscard]] uint24_t getRelativeAddress(uint24_t addr) const override;
30 
35  void setMemoryRegion(uint24_t start, uint24_t end);
36 
40  [[nodiscard]] bool hasMemoryAt(uint24_t addr) const override;
41 
43  ~AMemory() override = default;
44  };
45 }
Ints.hpp
ComSquare::Memory::AMemory::getRelativeAddress
uint24_t getRelativeAddress(uint24_t addr) const override
Translate an absolute address to a relative address.
Definition: AMemory.cpp:9
ComSquare::Memory::AMemory::~AMemory
~AMemory() override=default
A default destructor.
ComSquare::Memory::AMemory::_start
uint24_t _start
The starting address mapped to this component.
Definition: AMemory.hpp:21
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::AMemory::_end
uint24_t _end
The last continuous address mapped to this components. For shadows, see the MemoryShadow class.
Definition: AMemory.hpp:23
ComSquare::Memory::AMemory
Abstract class representing a continuous block of memory.
Definition: AMemory.hpp:18
ComSquare::Memory::AMemory::hasMemoryAt
bool hasMemoryAt(uint24_t addr) const override
Return true if this component has mapped the address.
Definition: AMemory.cpp:20
ComSquare::Memory
Definition: AMemory.cpp:7
ComSquare::Memory::AMemory::setMemoryRegion
void setMemoryRegion(uint24_t start, uint24_t end)
Change starting and ending points of this mapped memory.
Definition: AMemory.cpp:14
IMemory.hpp
Components.hpp