Compute Library
 23.11
IMemoryRegion Class Referenceabstract

Memory region interface. More...

#include <IMemoryRegion.h>

Public Member Functions

 IMemoryRegion (size_t size)
 Default constructor. More...
 
virtual ~IMemoryRegion ()=default
 Virtual Destructor. More...
 
virtual std::unique_ptr< IMemoryRegionextract_subregion (size_t offset, size_t size)=0
 Extract a sub-region from the memory. More...
 
virtual void * buffer ()=0
 Returns the pointer to the allocated data. More...
 
virtual const void * buffer () const =0
 Returns the pointer to the allocated data. More...
 
size_t size () const
 Memory region size accessor. More...
 
void set_size (size_t size)
 Sets size of region. More...
 

Detailed Description

Memory region interface.

Definition at line 33 of file IMemoryRegion.h.

Constructor & Destructor Documentation

◆ IMemoryRegion()

IMemoryRegion ( size_t  size)
inlineexplicit

Default constructor.

Parameters
[in]sizeRegion size

Definition at line 40 of file IMemoryRegion.h.

40  : _size(size)
41  {
42  }

◆ ~IMemoryRegion()

virtual ~IMemoryRegion ( )
virtualdefault

Virtual Destructor.

Member Function Documentation

◆ buffer() [1/2]

virtual const void* buffer ( ) const
pure virtual

Returns the pointer to the allocated data.

Returns
Pointer to the allocated data

Implemented in ICLMemoryRegion, and MemoryRegion.

◆ buffer() [2/2]

virtual void* buffer ( )
pure virtual

Returns the pointer to the allocated data.

Returns
Pointer to the allocated data

Implemented in ICLMemoryRegion, and MemoryRegion.

Referenced by TensorAllocator::data(), CLTensorAllocator::map(), TensorAllocator::set_associated_memory_group(), and CLTensorAllocator::unmap().

◆ extract_subregion()

virtual std::unique_ptr<IMemoryRegion> extract_subregion ( size_t  offset,
size_t  size 
)
pure virtual

Extract a sub-region from the memory.

Warning
Ownership is maintained by the parent memory, while a wrapped raw memory region is returned by this function. Thus parent memory should not be released before this.
Parameters
[in]offsetOffset to the region
[in]sizeSize of the region
Returns
A wrapped memory sub-region with no ownership of the underlying memory

Implemented in ICLMemoryRegion, and MemoryRegion.

◆ set_size()

void set_size ( size_t  size)
inline

Sets size of region.

Warning
This should only be used in correlation with handle
Parameters
[in]sizeSize to set

Definition at line 82 of file IMemoryRegion.h.

83  {
84  _size = size;
85  }

References IMemoryRegion::size().

◆ size()

size_t size ( ) const
inline

Memory region size accessor.

Returns
Memory region size

Definition at line 72 of file IMemoryRegion.h.

73  {
74  return _size;
75  }

Referenced by ICLMemoryRegion::extract_subregion(), MemoryRegion::extract_subregion(), MemoryRegion::MemoryRegion(), and IMemoryRegion::set_size().


The documentation for this class was generated from the following file:
arm_compute::IMemoryRegion::size
size_t size() const
Memory region size accessor.
Definition: IMemoryRegion.h:72