Compute Library
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)

Default constructor.

[in]sizeRegion size

Definition at line 40 of file IMemoryRegion.h.

References IMemoryRegion::buffer(), IMemoryRegion::extract_subregion(), offset(), IMemoryRegion::size(), and IMemoryRegion::~IMemoryRegion().

41  : _size(size)
42  {
43  }
size_t size() const
Memory region size accessor.
Definition: IMemoryRegion.h:73

◆ ~IMemoryRegion()

virtual ~IMemoryRegion ( )

Virtual Destructor.

Referenced by IMemoryRegion::IMemoryRegion().

Member Function Documentation

◆ buffer() [1/2]

virtual void* buffer ( )
pure virtual

◆ buffer() [2/2]

virtual const void* buffer ( ) const
pure virtual

Returns the pointer to the allocated data.

Pointer to the allocated data

Implemented in MemoryRegion, ICLMemoryRegion, and IGCMemoryRegion.

◆ extract_subregion()

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

Extract a sub-region from the memory.

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.
[in]offsetOffset to the region
[in]sizeSize of the region
A wrapped memory sub-region with no ownership of the underlying memory

Implemented in GCBufferMemoryRegion, MemoryRegion, and ICLMemoryRegion.

Referenced by IMemoryRegion::IMemoryRegion().

◆ set_size()

void set_size ( size_t  size)

Sets size of region.

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

Definition at line 83 of file IMemoryRegion.h.

References IMemoryRegion::size().

84  {
85  _size = size;
86  }
size_t size() const
Memory region size accessor.
Definition: IMemoryRegion.h:73

◆ size()

size_t size ( ) const

Memory region size accessor.

Memory region size

Definition at line 73 of file IMemoryRegion.h.

Referenced by MemoryRegion::extract_subregion(), IMemoryRegion::IMemoryRegion(), GCBufferMemoryRegion::map(), IMemoryRegion::set_size(), and CLBufferMemoryRegion::unmap().

74  {
75  return _size;
76  }

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