contur2
Loading...
Searching...
No Matches
contur::IMemory Class Referenceabstract

Abstract interface for linear addressable memory. More...

#include <i_memory.h>

Inheritance diagram for contur::IMemory:

Public Member Functions

virtual ~IMemory ()=default
virtual Result< Blockread (MemoryAddress address) const =0
 Reads a Block from the given address.
virtual Result< void > write (MemoryAddress address, const Block &block)=0
 Writes a Block to the given address.
virtual std::size_t size () const noexcept=0
 Returns the total number of addressable cells.
virtual void clear ()=0
 Clears all memory cells to default (Nop) blocks.

Detailed Description

Abstract interface for linear addressable memory.

Provides read/write access to Block-sized cells indexed by MemoryAddress. Implementations include PhysicalMemory (RAM simulation) and potential future wrappers (cached memory, protected memory, etc.).

Definition at line 18 of file i_memory.h.

Constructor & Destructor Documentation

◆ ~IMemory()

virtual contur::IMemory::~IMemory ( )
virtualdefault

Member Function Documentation

◆ clear()

virtual void contur::IMemory::clear ( )
pure virtual

Clears all memory cells to default (Nop) blocks.

Implemented in contur::PhysicalMemory.

◆ read()

virtual Result< Block > contur::IMemory::read ( MemoryAddress address) const
nodiscardpure virtual

Reads a Block from the given address.

Parameters
addressThe memory address to read from.
Returns
The Block at the address, or an error if the address is invalid.

Implemented in contur::PhysicalMemory.

◆ size()

virtual std::size_t contur::IMemory::size ( ) const
nodiscardpure virtualnoexcept

Returns the total number of addressable cells.

Implemented in contur::PhysicalMemory.

◆ write()

virtual Result< void > contur::IMemory::write ( MemoryAddress address,
const Block & block )
nodiscardpure virtual

Writes a Block to the given address.

Parameters
addressThe memory address to write to.
blockThe Block to store.
Returns
Success or an error if the address is invalid.

Implemented in contur::PhysicalMemory.


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