ADTF_DISPLAY_TOOLBOX  3.8.0 (ADTF 3.14.3)
IDynamicMemoryBlockabstract

The IDynamicMemoryBlock interface extends allocated memory dynamically. More...

Inheritance diagram for IDynamicMemoryBlock:
[legend]

Public Member Functions

virtual tResult Append (const tVoid *pvData, tInt nDataSize)=0
 Append data to the allocated memory. More...
 
virtual tVoid * GetPtr ()=0
 Get a pointer to the allocated memory. More...
 
virtual tSize GetSize ()=0
 Get the amount of used memory in bytes. More...
 
virtual tResult Reset ()=0
 Resets the size. More...
 
virtual tResult SetIncrement (tInt nNewIncrement)=0
 Sets the allocated memory growing size Default growing size is 256 bytes. More...
 
virtual tVoid Destroy ()=0
 Destroys the object and frees the allocated memory.
 

Protected Member Functions

 ~IDynamicMemoryBlock ()
 Prohibit class destructor.
 

Detailed Description

The IDynamicMemoryBlock interface extends allocated memory dynamically.

Definition at line 28 of file dynamic_memoryblock.h.

Member Function Documentation

◆ Append()

virtual tResult Append ( const tVoid *  pvData,
tInt  nDataSize 
)
pure virtual

Append data to the allocated memory.

If necessary, the method reallocated memory large enough to hold the new data, copy the existing data to it and add the new data.

Parameters
pvData[in] Pointer to the data.
nDataSize[in] The size of the data in bytes.
Return values
ERR_NOERRORif allocation was successful or nDataSize equals zero.
ERR_POINTERif pvData pointer is NULL.
ERR_INVALID_ARGif nDataSize is negativ.
ERR_MEMORYif memory allocation failed.

◆ GetPtr()

virtual tVoid* GetPtr ( )
pure virtual

Get a pointer to the allocated memory.

Returns
A valid pointer to the allocated memory or NULL if no memory has been allocated.
Remarks
In case memory has been reallocated (see IDynamicMemoryBlock::Append), pointer to the allocated memory returned by a previous call to GetPtr method is no longer valid!

◆ GetSize()

virtual tSize GetSize ( )
pure virtual

Get the amount of used memory in bytes.

Returns
The amount of used memory in bytes or zero if no memory has been allocated.

◆ Reset()

virtual tResult Reset ( )
pure virtual

Resets the size.

Allready allocated memory remains cached for future Append operations.

Return values
ERR_NOERRORsample is reset

◆ SetIncrement()

virtual tResult SetIncrement ( tInt  nNewIncrement)
pure virtual

Sets the allocated memory growing size Default growing size is 256 bytes.

Parameters
nNewIncrement[in] The growing size.
Return values
ERR_NOERRORif increment has been successful changed.
ERR_INVALID_ARGif nNewIncrement is less than zero.
Remarks
If nNewIncrement equals zero, the default growing size is used instead.