From df3103622b7de05f4e35b22a2c94b4a46eab4efc Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 14 Nov 2018 13:16:56 +0000 Subject: COMPMID-1088: Use IMemoryRegion in interfaces where possible -Simplifies import memory interface -Changes the used of void** handles with appropriate interfaces. Change-Id: I5918c855c11f46352058864623336b352162a4b7 --- arm_compute/runtime/IMemoryRegion.h | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'arm_compute/runtime/IMemoryRegion.h') diff --git a/arm_compute/runtime/IMemoryRegion.h b/arm_compute/runtime/IMemoryRegion.h index 4c08b4ab09..aa8c07ef2a 100644 --- a/arm_compute/runtime/IMemoryRegion.h +++ b/arm_compute/runtime/IMemoryRegion.h @@ -25,6 +25,7 @@ #define __ARM_COMPUTE_RUNTIME_IMEMORY_REGION_H__ #include +#include namespace arm_compute { @@ -36,12 +37,25 @@ public: * * @param[in] size Region size */ - IMemoryRegion(size_t size) + explicit IMemoryRegion(size_t size) : _size(size) { } /** Virtual Destructor */ virtual ~IMemoryRegion() = default; + /** 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. + * + * + * @param[in] offset Offset to the region + * @param[in] size Size of the region + * + * @return A wrapped memory sub-region with no ownership of the underlying memory + */ + virtual std::unique_ptr extract_subregion(size_t offset, size_t size) = 0; /** Returns the pointer to the allocated data. * * @return Pointer to the allocated data @@ -52,16 +66,11 @@ public: * @return Pointer to the allocated data */ virtual void *buffer() const = 0; - /** Handle of internal memory - * - * @return Handle of memory - */ - virtual void **handle() = 0; /** Memory region size accessor * * @return Memory region size */ - size_t size() + size_t size() const { return _size; } -- cgit v1.2.1