ComSquare
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ComSquare::Memory::MemoryShadow Class Reference

#include <MemoryShadow.hpp>

Inheritance diagram for ComSquare::Memory::MemoryShadow:
Inheritance graph
Collaboration diagram for ComSquare::Memory::MemoryShadow:
Collaboration graph

Public Member Functions

 MemoryShadow (std::shared_ptr< IMemory > initial, uint24_t start, uint24_t end)
 Create a shadow for the memory given as parameter. More...
 
uint8_t read (uint24_t addr) override
 Read from the initial IMemory given. More...
 
void write (uint24_t addr, uint8_t data) override
 Write data to the ram. More...
 
- Public Member Functions inherited from ComSquare::Memory::IMemory
void setMemoryRegion (uint24_t start, uint24_t end)
 Change starting and ending points of this mapped memory. More...
 
virtual bool hasMemoryAt (uint24_t addr)
 Return true if this component has mapped the address. More...
 
virtual uint24_t getStart ()
 Get the first address mapped to this component. More...
 

Static Public Member Functions

static std::shared_ptr< IMemorycreateShadow (std::shared_ptr< IMemory > initial, uint24_t start, uint24_t end)
 

Private Attributes

std::shared_ptr< IMemory_initial
 Memory to shadow from. More...
 

Constructor & Destructor Documentation

◆ MemoryShadow()

ComSquare::Memory::MemoryShadow::MemoryShadow ( std::shared_ptr< IMemory initial,
uint24_t  start,
uint24_t  end 
)
explicit

Create a shadow for the memory given as parameter.

Member Function Documentation

◆ createShadow()

std::shared_ptr< IMemory > ComSquare::Memory::MemoryShadow::createShadow ( std::shared_ptr< IMemory initial,
uint24_t  start,
uint24_t  end 
)
static

◆ read()

uint8_t ComSquare::Memory::MemoryShadow::read ( uint24_t  addr)
overridevirtual

Read from the initial IMemory given.

Parameters
addrThe address to read from. The address 0x0 should refer to the first byte of the initial IMemory.
Exceptions
InvalidAddresswill be thrown if the address is more than the size of the initial IMemory.
Returns
Return the data at the address.

Implements ComSquare::Memory::IMemory.

◆ write()

void ComSquare::Memory::MemoryShadow::write ( uint24_t  addr,
uint8_t  data 
)
overridevirtual

Write data to the ram.

Parameters
addrThe address to write to. The address 0x0 should refer to the first byte of the initial IMemory.
dataThe data to write.
Exceptions
InvalidAddresswill be thrown if the address is more than the size of the initial IMemory.

Implements ComSquare::Memory::IMemory.

Member Data Documentation

◆ _initial

std::shared_ptr<IMemory> ComSquare::Memory::MemoryShadow::_initial
private

Memory to shadow from.


The documentation for this class was generated from the following files: