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

#include <RectangleShadow.hpp>

Inheritance diagram for ComSquare::Memory::RectangleShadow:
Collaboration diagram for ComSquare::Memory::RectangleShadow:

Public Member Functions

 RectangleShadow (IMemory &initial, uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage)
 Create a shadow for the memory given as parameter. More...
 
 RectangleShadow (const RectangleShadow &)=default
 A rectangle shadow is copy constructable. More...
 
RectangleShadowoperator= (const RectangleShadow &)=delete
 @brrief A rectangle shadow is not assignable More...
 
 ~RectangleShadow () override=default
 A default destructor. More...
 
uint8_t read (uint24_t addr) override
 Read from the initial AMemory given. More...
 
void write (uint24_t addr, uint8_t data) override
 Write data to the ram. More...
 
uint24_t getRelativeAddress (uint24_t addr) const override
 Translate an absolute address to a relative address. More...
 
uint24_t getSize () const override
 Get the size of the data. This size can be lower than the mapped data. More...
 
std::string getName () const override
 Get the name of this accessor (used for debug purpose) More...
 
Component getComponent () const override
 Get the component of this accessor (used for debug purpose) More...
 
IMemorygetMirrored () const
 Return the memory accessor this accessor mirror if any. More...
 
void setBankOffset (int bankOffset)
 Set the number of bank this component do not shadow. Referring to the first byte of this component will refer to the first byte of the bank at (bankOffset + start of initial memory). More...
 
- Public Member Functions inherited from ComSquare::Memory::ARectangleMemory
bool hasMemoryAt (uint24_t addr) const override
 Return true if this component has mapped the address. More...
 
void setMemoryRegion (uint8_t startBank, uint8_t endBank, uint16_t startPage, uint16_t endPage)
 Change starting and ending points of this mapped memory. More...
 
std::string getValueName (uint24_t addr) const override
 Get the name of the data at the address. More...
 
 ~ARectangleMemory () override=default
 A default destructor. More...
 
- Public Member Functions inherited from ComSquare::Memory::IMemory
virtual ~IMemory ()=default
 A virtual default destructor. More...
 

Private Attributes

IMemory_initial
 Memory to shadow from. More...
 
int _bankOffset = 0
 The number of banks to add to the memory before accessing it from the initial data. More...
 

Additional Inherited Members

- Protected Attributes inherited from ComSquare::Memory::ARectangleMemory
uint8_t _startBank = 0
 The first bank to map to. More...
 
uint8_t _endBank = 0
 The last bank to map to. More...
 
uint16_t _startPage = 0
 The first address of each bank to map. More...
 
uint16_t _endPage = 0
 The last address of each bank to map. More...
 

Constructor & Destructor Documentation

◆ RectangleShadow() [1/2]

ComSquare::Memory::RectangleShadow::RectangleShadow ( IMemory initial,
uint8_t  startBank,
uint8_t  endBank,
uint16_t  startPage,
uint16_t  endPage 
)

Create a shadow for the memory given as parameter.

Parameters
startBankThe starting bank of the memory to shadow.
endBankThe ending bank of the memory to shadow
startPageThe starting page of the memory to shadow
endPageThe ending page of the memory to shadow

◆ RectangleShadow() [2/2]

ComSquare::Memory::RectangleShadow::RectangleShadow ( const RectangleShadow )
default

A rectangle shadow is copy constructable.

◆ ~RectangleShadow()

ComSquare::Memory::RectangleShadow::~RectangleShadow ( )
overridedefault

A default destructor.

Member Function Documentation

◆ getComponent()

Component ComSquare::Memory::RectangleShadow::getComponent ( ) const
overridevirtual

Get the component of this accessor (used for debug purpose)

Implements ComSquare::Memory::IMemory.

◆ getMirrored()

IMemory & ComSquare::Memory::RectangleShadow::getMirrored ( ) const

Return the memory accessor this accessor mirror if any.

Returns
nullptr if isMirror is false, the source otherwise.

◆ getName()

std::string ComSquare::Memory::RectangleShadow::getName ( ) const
overridevirtual

Get the name of this accessor (used for debug purpose)

Implements ComSquare::Memory::IMemory.

◆ getRelativeAddress()

uint24_t ComSquare::Memory::RectangleShadow::getRelativeAddress ( uint24_t  addr) const
overridevirtual

Translate an absolute address to a relative address.

Parameters
addrThe absolute address (in the 24 bit bus)
Returns
The local address (0 refers to the first byte of this component).
Exceptions
InvalidAddressis thrown if the address is not mapped by this component.

Reimplemented from ComSquare::Memory::ARectangleMemory.

◆ getSize()

uint24_t ComSquare::Memory::RectangleShadow::getSize ( ) const
overridevirtual

Get the size of the data. This size can be lower than the mapped data.

Returns
The number of bytes inside this memory.

Implements ComSquare::Memory::IMemory.

◆ operator=()

RectangleShadow& ComSquare::Memory::RectangleShadow::operator= ( const RectangleShadow )
delete

@brrief A rectangle shadow is not assignable

◆ read()

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

Read from the initial AMemory given.

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

Implements ComSquare::Memory::IMemory.

◆ setBankOffset()

void ComSquare::Memory::RectangleShadow::setBankOffset ( int  bankOffset)

Set the number of bank this component do not shadow. Referring to the first byte of this component will refer to the first byte of the bank at (bankOffset + start of initial memory).

◆ write()

void ComSquare::Memory::RectangleShadow::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 AMemory.
dataThe data to write.
Exceptions
InvalidAddresswill be thrown if the address is more than the size of the initial AMemory.

Implements ComSquare::Memory::IMemory.

Member Data Documentation

◆ _bankOffset

int ComSquare::Memory::RectangleShadow::_bankOffset = 0
private

The number of banks to add to the memory before accessing it from the initial data.

◆ _initial

IMemory& ComSquare::Memory::RectangleShadow::_initial
private

Memory to shadow from.


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