CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
CYB::API::SafeStream Class Referenceabstract

A Stream guaranteed to not throw exceptions. More...

#include <Stream.hpp>

Inheritance diagram for CYB::API::SafeStream:
Inheritance graph
[legend]
Collaboration diagram for CYB::API::SafeStream:
Collaboration graph
[legend]

Public Member Functions

virtual unsigned long long CursorPosition (void) const noexcept=0
 Get the current position of the read/write cursor in the Stream. Equivalent of Seek(0, SeekLocation::CURSOR) More...
 
virtual unsigned long long Seek (const long long AOffset, const SeekLocation ALocation) const noexcept=0
 Set the cursor position in the Stream. More...
 
virtual unsigned long long Read (void *const ABuffer, const unsigned long long AMaxAmount) const noexcept=0
 Read data from a Stream at the current cursor position and advance the cursor by that amount. More...
 
virtual unsigned long long Write (const void *const ABuffer, const unsigned long long AAmount) noexcept=0
 Write data to the Stream at the current cursor position and advance the cursor by that amount. More...
 
- Public Member Functions inherited from CYB::API::Stream
virtual void Capabilities (Mode &AMode, bool &ASeek) const noexcept=0
 Get the capabilities of the stream. More...
 

Additional Inherited Members

- Public Types inherited from CYB::API::Stream
enum  Mode : byte { Mode::READ = 1, Mode::WRITE, Mode::READ_WRITE }
 The available operations for the Stream. Bitset. More...
 
enum  SeekLocation { SeekLocation::BEGIN, SeekLocation::CURSOR, SeekLocation::END }
 The location to begin a seek operation at. More...
 

Detailed Description

A Stream guaranteed to not throw exceptions.

Attention
As a result, invalid operations will result in calls to HCF

Definition at line 79 of file Stream.hpp.

Member Function Documentation

virtual unsigned long long CYB::API::SafeStream::CursorPosition ( void  ) const
pure virtualnoexcept

Get the current position of the read/write cursor in the Stream. Equivalent of Seek(0, SeekLocation::CURSOR)

Returns
The current position of the cursor in the Stream
Thread Safety
This function requires synchronization at the object level

Implements CYB::API::Stream.

virtual unsigned long long CYB::API::SafeStream::Read ( void *const  ABuffer,
const unsigned long long  AMaxAmount 
) const
pure virtualnoexcept

Read data from a Stream at the current cursor position and advance the cursor by that amount.

Parameters
[out]ABufferThe location to store the read data
AMaxAmountThe maximum number of bytes to be read
Returns
The number of bytes read. If zero is returned, and the cursor position is not as SeekLocation::END an error has occurred and the read should not be retried
Thread Safety
This function requires synchronization at the object level

Implements CYB::API::Stream.

virtual unsigned long long CYB::API::SafeStream::Seek ( const long long  AOffset,
const SeekLocation  ALocation 
) const
pure virtualnoexcept

Set the cursor position in the Stream.

Parameters
AOffsetThe offset from ALocation to set the cursor to
ALocationThe initial location to begin the offset
Returns
The current cursor position
Thread Safety
This function requires synchronization at the object level

Implements CYB::API::Stream.

virtual unsigned long long CYB::API::SafeStream::Write ( const void *const  ABuffer,
const unsigned long long  AAmount 
)
pure virtualnoexcept

Write data to the Stream at the current cursor position and advance the cursor by that amount.

Parameters
ABufferThe location to get the data to write
AAmountThe number of bytes to be written
Returns
The number of bytes written. If zero is returned, an error has occurred and the write should not be retried
Thread Safety
This function requires synchronization at the object level

Implements CYB::API::Stream.


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