VART-X  0.3.0
vart::MemoryImplBase Class Referenceabstract

Abstract interface for memory implementation used by Memory. More...

#include <vart_memory_impl_base.hpp>

Public Member Functions

 MemoryImplBase ()=delete
 Default construction is disabled. More...
 
 MemoryImplBase (std::shared_ptr< Device > dev)
 MemoryImplBase() - Constructor that takes device instance as an input. More...
 
virtual ~MemoryImplBase ()
 Virtual destructor to ensure proper cleanup of derived implementations. More...
 
virtual const uint8_t * map (DataMapFlags map_flags)=0
 map() - Maps allocated memory to user space More...
 
virtual void unmap ()=0
 unmap() - Unmaps allocated memory from user space. More...
 
virtual std::shared_ptr< Deviceget_device_handle ()=0
 get_device_handle() - Retrieves the device handle associated with memory allocation More...
 
virtual size_t get_size ()=0
 get_size() - Retrieves the size of the allocated memory More...
 
virtual uint64_t get_physical_addr ()=0
 get_physical_addr() - Retrieves the physical address of the allocated memory if applicable. More...
 
virtual int export_buffer () const =0
 export_buffer() - Export the underlying buffer as a dma-buf file descriptor More...
 

Protected Attributes

std::shared_ptr< Devicedevice
 Device handle for this implementation. More...
 

Detailed Description

Abstract interface for memory implementation used by Memory.

Note
Applications should use vart::Memory rather than this type directly, unless extending or integrating a new backend.

Constructor & Destructor Documentation

◆ MemoryImplBase() [1/2]

vart::MemoryImplBase::MemoryImplBase ( )
delete

Default construction is disabled.

◆ MemoryImplBase() [2/2]

vart::MemoryImplBase::MemoryImplBase ( std::shared_ptr< Device dev)
inline

MemoryImplBase() - Constructor that takes device instance as an input.

Parameters
devDevice instance

◆ ~MemoryImplBase()

virtual vart::MemoryImplBase::~MemoryImplBase ( )
inlinevirtual

Virtual destructor to ensure proper cleanup of derived implementations.

Member Function Documentation

◆ export_buffer()

virtual int vart::MemoryImplBase::export_buffer ( ) const
pure virtual

export_buffer() - Export the underlying buffer as a dma-buf file descriptor

Returns
File descriptor representing the exported buffer. Implementations may return -1 to indicate that exporting is not supported for this memory type.

◆ get_device_handle()

virtual std::shared_ptr<Device> vart::MemoryImplBase::get_device_handle ( )
pure virtual

get_device_handle() - Retrieves the device handle associated with memory allocation

Returns
Returns Device handle

◆ get_physical_addr()

virtual uint64_t vart::MemoryImplBase::get_physical_addr ( )
pure virtual

get_physical_addr() - Retrieves the physical address of the allocated memory if applicable.

Returns
Physical (device) address of the underlying buffer. Implementations may return 0 to indicate that a physical address is not available or applicable for this memory type.

◆ get_size()

virtual size_t vart::MemoryImplBase::get_size ( )
pure virtual

get_size() - Retrieves the size of the allocated memory

Returns
returns the memory size

◆ map()

virtual const uint8_t* vart::MemoryImplBase::map ( DataMapFlags  map_flags)
pure virtual

map() - Maps allocated memory to user space

Parameters
[in]map_flagsFlag used to indicate mode of memory mapping
Returns
Virtual address of the mapped region. Implementations may return nullptr to signal that no buffer is currently mapped or that the request was rejected without throwing.

◆ unmap()

virtual void vart::MemoryImplBase::unmap ( )
pure virtual

unmap() - Unmaps allocated memory from user space.

Member Data Documentation

◆ device

std::shared_ptr<Device> vart::MemoryImplBase::device
protected

Device handle for this implementation.


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