libimgdoc2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
imgdoc2::IBlobOutput Class Referenceabstract

interface for outputting binary data More...

#include <IBlobOutput.h>

Inheritance diagram for imgdoc2::IBlobOutput:
imgdoc2::BlobOutputOnHeap

Public Member Functions

virtual bool Reserve (size_t s)=0
 
virtual bool SetData (size_t offset, size_t size, const void *data)=0
 
 IBlobOutput (const IBlobOutput &)=delete
 
IBlobOutputoperator= (const IBlobOutput &)=delete
 
 IBlobOutput (IBlobOutput &&)=delete
 
IBlobOutputoperator= (IBlobOutput &&)=delete
 

Detailed Description

interface for outputting binary data

This interface is used to output binary data from libimgdoc2. It is passed in to the corresponding operation, then the "Reserve"-method is called for advertising the size of the data. Then (multiple) calls to "SetData" follow, where the object is requested to copy data into its internal storage.

Member Function Documentation

◆ Reserve()

virtual bool imgdoc2::IBlobOutput::Reserve ( size_t  s)
pure virtual

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
sThe size of the data being returned.
Returns
True if it succeeds (and the object is ready to handle "SetData" calls), false if it fails.

Implemented in imgdoc2::BlobOutputOnHeap.

◆ SetData()

virtual bool imgdoc2::IBlobOutput::SetData ( size_t  offset,
size_t  size,
const void *  data 
)
pure virtual

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
offsetThe offset.
sizeThe size.
dataThe data.
Returns
True if it succeeds, false if it fails.

Implemented in imgdoc2::BlobOutputOnHeap.


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