22 class PreAllocator :
public IAllocator {
27 PreAllocator(
void* ptr,
size_t bytes_size): _actualData(ptr), _sizeInBytes(bytes_size) {}
33 if (handle != _actualData) {
41 void unlock(
void*) noexcept
override {}
48 void*
alloc(
size_t size) noexcept
override {
49 if (size <= _sizeInBytes) {
59 bool free(
void*) noexcept
override {
67 void Release() noexcept
override {
72 virtual ~PreAllocator() =
default;
82 std::shared_ptr<IAllocator> make_pre_allocator(T* ptr,
size_t size) {
83 return shared_from_irelease(
new PreAllocator(ptr, size *
sizeof(T)));
LockOp
Allocator handle mapping type.
Definition: ie_allocator.hpp:21
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
virtual bool free(void *handle) noexcept=0
Releases the handle and all associated memory resources which invalidates the handle.
A header file that provides Allocator interface.
virtual void * alloc(size_t size) noexcept=0
Allocates memory.
A flag to lock data for write.
Definition: ie_allocator.hpp:23
virtual void unlock(void *handle) noexcept=0
Unmaps memory by handle with multiple sequential mappings of the same handle.
virtual void * lock(void *handle, LockOp op=LOCK_FOR_WRITE) noexcept=0
Maps handle to heap memory accessible by any memory manipulation routines.
A header file for the main Inference Engine exception.