MeVisLab Toolbox Reference
MLMemoryBlockHandle Class Reference

The strong handle of a MLMemoryBlock. More...

#include <mlMemoryBlockHandle.h>

Public Member Functions

 MLMemoryBlockHandle ()
 Creates a memory block handle that is null.
 
 MLMemoryBlockHandle (const MLMemoryBlockHandle &memoryBlockHandle)
 Creates an additional memory block handle to the memory block of memoryBlockHandle.
 
 MLMemoryBlockHandle (const MLWeakMemoryBlockHandle &weakMemoryBlockHandle)
 Creates an memory block handle to the memory block of weakMemoryBlockHandle.
 
 ~MLMemoryBlockHandle ()
 If only weak handles to the memory block exist, then the memory block is added to the cache list.
 
bool isNull () const
 Returns true if the handle does not reference a valid memory block.
 
voiddata () const
 Returns the data of the memory block. If this handle is null, then NULL is returned.
 
size_t size () const
 Returns the size of the data. If this handle is null, then 0 is returned.
 
void clear ()
 Releases the reference to the memory block.
 
MLMemoryBlockHandleoperator= (const MLMemoryBlockHandle &memoryBlockHandle)
 Creates a memory block handle from the memory block handle.
 
MLMemoryBlockHandleoperator= (const MLWeakMemoryBlockHandle &weakMemoryBlockHandle)
 Creates a memory block handle from the weak memory block handle.
 

Detailed Description

The strong handle of a MLMemoryBlock.

It is the only way to access the memory block data. Internally it manages whether the memory block is contained in the cache list, or if is locked memory. The memory block is passed to the handle either by the allocation methods of the MLMemoryManager, or by the assignment from a MLWeakMemoryBlockHandle.

Definition at line 38 of file mlMemoryBlockHandle.h.

Constructor & Destructor Documentation

◆ MLMemoryBlockHandle() [1/3]

MLMemoryBlockHandle::MLMemoryBlockHandle ( )

Creates a memory block handle that is null.

See also
isNull()

◆ MLMemoryBlockHandle() [2/3]

MLMemoryBlockHandle::MLMemoryBlockHandle ( const MLMemoryBlockHandle & memoryBlockHandle)

Creates an additional memory block handle to the memory block of memoryBlockHandle.

The memory block of memoryBlockHandle may be null.

See also
isNull()

◆ MLMemoryBlockHandle() [3/3]

MLMemoryBlockHandle::MLMemoryBlockHandle ( const MLWeakMemoryBlockHandle & weakMemoryBlockHandle)

Creates an memory block handle to the memory block of weakMemoryBlockHandle.

The memory block may already have been destroyed, so check if it is null after the assigment.

See also
isNull()

◆ ~MLMemoryBlockHandle()

MLMemoryBlockHandle::~MLMemoryBlockHandle ( )

If only weak handles to the memory block exist, then the memory block is added to the cache list.

If neither weak handles or strong handles

Member Function Documentation

◆ clear()

void MLMemoryBlockHandle::clear ( )

Releases the reference to the memory block.

The memory block handle is null afterwards.

See also
isNull()

◆ data()

void * MLMemoryBlockHandle::data ( ) const

Returns the data of the memory block. If this handle is null, then NULL is returned.

Referenced by ml::SubImage::setDataFromMemoryBlockHandle().

◆ isNull()

bool MLMemoryBlockHandle::isNull ( ) const

Returns true if the handle does not reference a valid memory block.

For example, it can be null if the memory block has been already deleted from cache. true is also returned if the data of the memory block is NULL.

◆ size()

size_t MLMemoryBlockHandle::size ( ) const

Returns the size of the data. If this handle is null, then 0 is returned.


The documentation for this class was generated from the following file: