Umbra::OutputStream class

Output byte stream abstraction.

OutputStream is an abstraction of a byte stream output from Umbra, hiding the storage of computation resources from the implementation. Typical implementations include output to the filesystem, over the network or directly to memory.

Constructors, destructors, conversion operators

~OutputStream(void) virtual

Public functions

auto write(const void* ptr, uint32_t numBytes) -> uint32_t pure virtual
Write a given number of data bytes into the output.

Function details

uint32_t Umbra::OutputStream::write(const void* ptr, uint32_t numBytes) pure virtual

Write a given number of data bytes into the output.

ptr A pointer to the source memory
numBytes Number of bytes to write
Returns The value of numBytes if the operation succeeded; anything else if an error was encountered.

Umbra uses this function to serialize data into user storage. The implementation should copy 'numBytes' bytes from memory pointer 'ptr' into the underlying storage.

The caller does not buffer the output in any way so if the individual write operation is slow the implementation of this function should maintain a write buffer. Note that OS stream write operations such as std::fwrite may already provide the buffering.

The caller also expects a single write operation to always be fully satisfied; returning anything but 'numBytes' from the operation is always treated as an error.