20 class PreAllocator :
public IAllocator {
25 PreAllocator(
void *ptr,
size_t bytes_size)
26 : _actualData(ptr), _sizeInBytes(bytes_size) {}
31 void *
lock(
void * handle, LockOp = LOCK_FOR_WRITE) noexcept
override {
32 if (handle != _actualData) {
40 void unlock(
void *) noexcept
override {}
47 void *
alloc(
size_t size) noexcept
override {
48 if (size <= _sizeInBytes) {
58 bool free(
void *) noexcept
override {
66 void Release() noexcept
override {
71 virtual ~PreAllocator() =
default;
81 std::shared_ptr<IAllocator> make_pre_allocator(T *ptr,
size_t size) {
82 return shared_from_irelease(
new PreAllocator(ptr, size *
sizeof(T)));
Definition: ie_argmax_layer.hpp:11
virtual bool free(void *handle) noexcept=0
Releases 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.
virtual void unlock(void *handle) noexcept=0
Unmaps memory by handle with multiple sequential mappings of the same handle. The multiple sequential...
A header file for the main Inference Engine exception.
virtual void * lock(void *handle, LockOp=LOCK_FOR_WRITE) noexcept=0
Maps handle to heap memory accessible by any memory manipulation routines.