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

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

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

Public Member Functions

virtual bool isWritable () const noexcept
 Checks if the stream is writable.
 
virtual Async< size_twrite (const void *data, size_t n)
 Writes data tp the data stream from a buffer of raw memory data with length n.
 
virtual Async< size_twriteExactly (void *data, size_t n)
 Similar to write(const void*, size_t), but ensures that the entire data buffer is written 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

◆ isWritable()

virtual bool CeresEngine::IAsyncOutputStream::isWritable ( ) const
inlinevirtualnoexcept

Checks if the stream is writable.

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

Reimplemented in CeresEngine::SyncDataStreamAdapter.

◆ write()

virtual Async< size_t > CeresEngine::IAsyncOutputStream::write ( const void data,
size_t  n 
)
virtual

Writes data tp the data stream from a buffer of raw memory data with length n.

Note
This method is only callable if isWritable() returns true.
Parameters
dataThe memory location to which written data should be copied from.
nThe maximum number of bytes to be write to the data stream.
Returns
The number of bytes actually written. Can be smaller than n, in that case the write operation must be repeated to ensure that all data was written. If 0, indicates that the stream has ended.

Reimplemented in CeresEngine::SyncDataStreamAdapter.

◆ writeExactly()

virtual Async< size_t > CeresEngine::IAsyncOutputStream::writeExactly ( void data,
size_t  n 
)
virtual

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


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