implementation of the IBlobOutput interface
More...
#include <BlobOutputImplementations.h>
implementation of the IBlobOutput interface
An implementation of the IBlobOutput interface which allocates the data being delivered on the heap. The memory allocated is owned by the instance.
◆ GetData()
std::uint8_t * imgdoc2::BlobOutputOnHeap::GetData |
( |
| ) |
|
|
inline |
Gets a pointer to the data. The size of this buffer is given by "GetSizeOfData". If this instance has not been initialized, nullptr is returned.
- Returns
- If the instance is initialized, then a pointer to the buffer is returned; nullptr otherwise.
◆ GetDataC()
const std::uint8_t * imgdoc2::BlobOutputOnHeap::GetDataC |
( |
| ) |
const |
|
inline |
Gets a const pointer to the data. The size of this buffer is given by "GetSizeOfData". If this instance has not been initialized, nullptr is returned.
- Returns
- If the instance is initialized, then a pointer to the buffer is returned; nullptr otherwise.
◆ GetHasData()
bool imgdoc2::BlobOutputOnHeap::GetHasData |
( |
| ) |
const |
|
inline |
Gets a boolean indicating whether output data has been reserved, in other words - whether "Reserve" was called.
- Returns
- True if output memory was reserved; false otherwise.
◆ GetSizeOfData()
size_t imgdoc2::BlobOutputOnHeap::GetSizeOfData |
( |
| ) |
const |
|
inline |
Gets size of data in bytes. It is usually advised to check "GetHasData()" before.
- Returns
- The size of the data in bytes.
◆ Reserve()
bool imgdoc2::BlobOutputOnHeap::Reserve |
( |
size_t |
s | ) |
|
|
inlineoverridevirtual |
Notifies about the size of data to be returned. This method must only be called once, additional calls should result in an exception. If this method returns false, it is interpreted as "the client is
not interested in the data" and there will not be subsequent calls to "SetData".
- Parameters
-
s | The size of the data being returned. |
- Returns
- True if it succeeds (and the object is ready to handle "SetData" calls), false if it fails.
Implements imgdoc2::IBlobOutput.
◆ SetData()
bool imgdoc2::BlobOutputOnHeap::SetData |
( |
size_t |
offset, |
|
|
size_t |
size, |
|
|
const void * |
data |
|
) |
| |
|
inlineoverridevirtual |
Data is passed to the "blob-output"-object with this call. The pointer "data" is only assumed to be valid for the duration of this call - in other words, the object needs to access the memory only within the call (and e.g. make a copy of the data). The address (indicated by offset and size) must be completely within the size as advertised with the "Reserve"-call. The method should validate this condition and throw an exception in case of a violation. If the method returns "false", it is interpreted "the object is not interested in any
additional data", and subsequent calls may be suppressed.
- Parameters
-
offset | The offset. |
size | The size. |
data | The data. |
- Returns
- True if it succeeds, false if it fails.
Implements imgdoc2::IBlobOutput.
The documentation for this class was generated from the following file: