class InferenceEngine::LockedMemory

Overview

This class represents locked memory for read/write memory. More…

#include <ie_locked_memory.hpp>

template <class T>
class LockedMemory: public InferenceEngine::details::LockedMemoryBase< T >
{
public:
    // construction

    LockedMemory(IAllocator* ptr, void* handle, size_t offsetInBytes = 0);
    LockedMemory(LockedMemory<T>&&);
    LockedMemory(LockedMemory<T>&& that, size_t offset);
    LockedMemory(const LockedMemory<T>&);

    // methods

    operator T* ();
    operator const T * () const;
    bool operator == (const T* pointer) const;

    template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
    S as();

    template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
    const S as() const;
};

Detailed Documentation

This class represents locked memory for read/write memory.

Construction

LockedMemory(IAllocator* ptr, void* handle, size_t offsetInBytes = 0)

A constructor.

Parameters:

ptr

Pointer to IAllocator object

handle

Handle provided by allocator

offsetInBytes

Offset in originally locked region

LockedMemory(LockedMemory<T>&&)

A default copy constructor, accepting rvalue.

LockedMemory(LockedMemory<T>&& that, size_t offset)

A default copy constructor that accepts rvalue.

Also sets the offset value for the new memory object

Parameters:

that

Rvalue reference for the other LockedMemoryBase instance

offset

Offset value

LockedMemory(const LockedMemory<T>&)

A disabled copy constructor for lvalue.

Methods

operator T* ()

Gets a pointer to the stored object.

Dereferences from the base class.

Returns:

The pointer to the object of the given template type

operator const T * () const

Gets the const pointer to the stored object.

Dereferences from the base class.

Returns:

The const pointer object of the given template type.

bool operator == (const T* pointer) const

Compares stored object with the given one.

Parameters:

pointer

An pointer to compare with.

Returns:

true if objects are equal, false otherwise

template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
S as()

Casts stored object to any provided type.

Uses reinterpret_cast.

Parameters:

S

Type to be casted to

Returns:

Casted to the given type object

template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
const S as() const

Casts stored object to any provided type.

Uses reinterpret_cast.

Parameters:

S

Type to be casted to

Returns:

Casted to the given type const object

class InferenceEngine::LockedMemory<void>

Overview

This class is for <void*> data and allows casting to any pointers. More…

#include <ie_locked_memory.hpp>

template <>
class LockedMemory<void>: public InferenceEngine::details::LockedMemoryBase< void >
{
public:
    // construction

    LockedMemory(IAllocator* ptr, void* handle, size_t offsetInBytes);
    LockedMemory(LockedMemory<void>&&);
    LockedMemory(LockedMemory<void>&& that, size_t offset);
    LockedMemory(const LockedMemory<void>&);

    // methods

    template <class S>
    operator S* ();

    bool operator == (const void* pointer) const;

    template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
    S as();

    template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
    const S as() const;
};

Detailed Documentation

This class is for <void*> data and allows casting to any pointers.

Construction

LockedMemory(IAllocator* ptr, void* handle, size_t offsetInBytes)

A constructor.

Parameters:

ptr

Pointer to IAllocator object

handle

Handle provided by allocator

offsetInBytes

Offset in originally locked region

LockedMemory(LockedMemory<void>&&)

A default copy constructor that accepts rvalue.

LockedMemory(LockedMemory<void>&& that, size_t offset)

A default copy constructor that accepts rvalue.

Also sets the offset value for the new memory object

Parameters:

that

Rvalue reference for the other LockedMemoryBase instance

offset

Offset value

LockedMemory(const LockedMemory<void>&)

A disabled copy constructor for lvalue.

Methods

template <class S>
operator S* ()

Gets the pointer to the stored object of the given template type.

Dereferences from the base class.

Parameters:

S

Type to be casted to

Returns:

The pointer to the object of the given template type

bool operator == (const void* pointer) const

Compares stored object with the given one.

Parameters:

pointer

A pointer to compare with

Returns:

true if objects are equal, false otherwise

template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
S as()

Casts stored object to any given type.

Uses reinterpret_cast.

Parameters:

S

Type to be casted to

Returns:

Casted to the given type object

template <class S, typename = std::enable_if<std::is_pointer<S>::value>>
const S as() const

Casts stored object to any given type.

Uses reinterpret_cast.

Parameters:

S

Type to be casted to

Returns:

Casted to the given type const object

class InferenceEngine::LockedMemory<const T>

Overview

This class is for read-only segments. More…

#include <ie_locked_memory.hpp>

template <class T>
class LockedMemory<const T>: public InferenceEngine::details::LockedMemoryBase< T >
{
public:
    // construction

    LockedMemory(IAllocator* ptr, void* handle, size_t offset);
    LockedMemory(LockedMemory<const T>&&);
    LockedMemory(LockedMemory<const T>&& that, size_t offset);
    LockedMemory(const LockedMemory<const T>&);

    // methods

    operator const T * () const;
    bool operator == (const T* pointer) const;

    template <
        class S,
        typename = std::enable_if<std::is_pointer<S>::value&& std::is_const<S>::value>
        >
    S as() const;
};

Detailed Documentation

This class is for read-only segments.

Construction

LockedMemory(IAllocator* ptr, void* handle, size_t offset)

A constructor.

Parameters:

ptr

Pointer to IAllocator object

handle

Handle provided by allocator

offset

Offset in bytes in originally locked region

LockedMemory(LockedMemory<const T>&&)

A default copy constructor that accepts rvalue.

LockedMemory(LockedMemory<const T>&& that, size_t offset)

A default copy constructor that accepts rvalue.

Also sets the offset value for the new memory object

Parameters:

that

Rvalue reference for the other LockedMemoryBase instance

offset

Offset value

LockedMemory(const LockedMemory<const T>&)

A disabled copy constructor for lvalue.

Methods

operator const T * () const

Gets the const pointer to the stored object.

Dereferences from the base class.

Returns:

The pointer to the object.

bool operator == (const T* pointer) const

Compares stored object with the given one.

Parameters:

pointer

A pointer to compare with

Returns:

true if objects are equal, false otherwise

template <
    class S,
    typename = std::enable_if<std::is_pointer<S>::value&& std::is_const<S>::value>
    >
S as() const

Casts stored object to any given type.

Uses reinterpret_cast.

Parameters:

S

Type to be casted to

Returns:

Casted to the given type object