The IDynamicMemoryBlock interface extends allocated memory dynamically.
More...
|
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.
|
|
The IDynamicMemoryBlock interface extends allocated memory dynamically.
Definition at line 28 of file dynamic_memoryblock.h.
◆ 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_NOERROR | if allocation was successful or nDataSize equals zero. |
ERR_POINTER | if pvData pointer is NULL. |
ERR_INVALID_ARG | if nDataSize is negativ. |
ERR_MEMORY | if 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.
◆ 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_NOERROR | sample 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_NOERROR | if increment has been successful changed. |
ERR_INVALID_ARG | if nNewIncrement is less than zero. |