CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::IAsyncInputStream Class Reference

#include <CeresEngine/Foundation/IO/Stream.hpp>

Inheritance diagram for CeresEngine::IAsyncInputStream:
CeresEngine::IAsyncStream CeresEngine::IAsyncDataStream CeresEngine::SyncDataStreamAdapter

Public Member Functions

virtual bool isReadable () const noexcept
 Checks if the stream is readable.
 
virtual Async< size_tread (void *data, size_t n)
 Reads data from the data stream to a buffer of raw memory data with length n.
 
virtual Async< size_treadExactly (void *data, size_t n)
 Similar to read(void*, size_t), but ensures that the entire data buffer is filled with exactly n bytes or up to the end of the data stream.
 
- Public Member Functions inherited from CeresEngine::IAsyncStream
virtual ~IAsyncStream ()=default
 Default virtual destructor.
 
virtual bool isSeekable (Seek mode=Seek::Start) const noexcept
 Checks if the stream is seekable.
 
virtual Async seek (std::streamsize position, Seek mode=Seek::Start)
 Changes the position of the data stream.
 
Async skip (const size_t n)
 Skips n bytes from the data stream.
 
virtual bool isTellable () const noexcept
 Checks if the stream knows the size of the data.
 
virtual Async< size_ttell ()
 Gets the number of bytes available on the stream.
 
virtual bool isSizeKnown () const noexcept
 Checks if the stream knows the size of the data.
 
virtual Async< size_tsize ()
 Gets the number of bytes available on the stream.
 
virtual Async wait ()=0
 Waits until all pending operations on the stream are complete.
 

Additional Inherited Members

- Public Types inherited from CeresEngine::IAsyncStream
using Seek = IStream::Seek
 An enumeration that describes how a data stream should be seeked.
 

Member Function Documentation

◆ isReadable()

virtual bool CeresEngine::IAsyncInputStream::isReadable ( ) const
inlinevirtualnoexcept

Checks if the stream is readable.

If this method returns true, read() is safe to be called on this stream.

Reimplemented in CeresEngine::SyncDataStreamAdapter.

◆ read()

virtual Async< size_t > CeresEngine::IAsyncInputStream::read ( void data,
size_t  n 
)
virtual

Reads data from the data stream to a buffer of raw memory data with length n.

Note
This method is only callable if isReadable() returns true.
Parameters
dataThe memory location to which read data should be placed.
nThe maximum number of bytes to be read from the data stream.
Returns
The number of bytes actually read. Can be smaller than n. If 0, indicates that the stream has ended.

Reimplemented in CeresEngine::SyncDataStreamAdapter.

◆ readExactly()

virtual Async< size_t > CeresEngine::IAsyncInputStream::readExactly ( void data,
size_t  n 
)
virtual

Similar to read(void*, size_t), but ensures that the entire data buffer is filled with exactly n bytes or up to the end of the data stream.


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