diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-11-14 13:16:56 +0000 |
---|---|---|
committer | Isabella Gottardi <isabella.gottardi@arm.com> | 2018-11-21 09:52:04 +0000 |
commit | df3103622b7de05f4e35b22a2c94b4a46eab4efc (patch) | |
tree | 17e10253e7a069c69d10bea0882b699b99d74b86 /arm_compute/runtime/IMemoryRegion.h | |
parent | c47ef20d69e8ea0f519fdc679435cd7037fc18fe (diff) | |
download | ComputeLibrary-df3103622b7de05f4e35b22a2c94b4a46eab4efc.tar.gz |
COMPMID-1088: Use IMemoryRegion in interfaces where possible
-Simplifies import memory interface
-Changes the used of void** handles with appropriate interfaces.
Change-Id: I5918c855c11f46352058864623336b352162a4b7
Diffstat (limited to 'arm_compute/runtime/IMemoryRegion.h')
-rw-r--r-- | arm_compute/runtime/IMemoryRegion.h | 23 |
1 files changed, 16 insertions, 7 deletions
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 <cstddef> +#include <memory> 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<IMemoryRegion> 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; } |