Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | List of all members
jau::io::ByteOutStream Class Referenceabstract

Abstract byte output stream object, to write data to a sink. More...

#include <byte_stream.hpp>

Inheritance diagram for jau::io::ByteOutStream:
Collaboration diagram for jau::io::ByteOutStream:

Public Member Functions

 ByteOutStream ()=default
 
 ByteOutStream (const ByteOutStream &)=delete
 
 ~ByteOutStream () noexcept override=default
 
virtual void close () noexcept=0
 Close the stream if supported by the underlying mechanism. More...
 
virtual std::string id () const noexcept
 return the id of this data source More...
 
virtual bool is_open () const noexcept=0
 Checks if the stream has an associated file. More...
 
ByteOutStreamoperator= (const ByteOutStream &)=delete
 
virtual uint64_t tellp () const noexcept=0
 Returns the output position indicator. More...
 
virtual std::string to_string () const noexcept=0
 
bool write (const uint8_t &in) noexcept
 Write one byte. More...
 
virtual size_t write (const void *in, size_t length) noexcept=0
 Write to the data sink. More...
 
- Public Member Functions inherited from jau::io::iostate_func
 iostate_func () noexcept
 
 iostate_func (const iostate_func &o) noexcept=default
 
 iostate_func (iostate_func &&o) noexcept=default
 
virtual ~iostate_func () noexcept=default
 
bool bad () const noexcept
 Checks if a non-recoverable error has occurred. More...
 
virtual void clear (const iostate state=iostate::goodbit) noexcept
 Clears state flags by assignment to the given value. More...
 
bool eof () const noexcept
 Checks if end-of-file has been reached. More...
 
bool fail () const noexcept
 Checks if an error has occurred. More...
 
bool good () const noexcept
 Checks if no error nor eof() has occurred i.e. More...
 
 operator bool () const noexcept
 Checks if no error has occurred, synonym of !fail(). More...
 
bool operator! () const noexcept
 Checks if an error has occurred, synonym of fail(). More...
 
iostate_funcoperator= (const iostate_func &o) noexcept=default
 
iostate_funcoperator= (iostate_func &&o) noexcept=default
 
virtual iostate rdstate () const noexcept
 Returns the current state flags. More...
 
void setstate (const iostate state) noexcept
 Sets state flags, by keeping its previous bits. More...
 
bool timeout () const noexcept
 Checks if a timeout (non-recoverable) has occurred. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jau::io::iostate_func
constexpr iostate rdstate_impl () const noexcept
 
constexpr void setstate_impl (iostate state) const noexcept
 

Detailed Description

Abstract byte output stream object, to write data to a sink.

All method implementations are of noexcept.

One may use fail() to detect whether an error has occurred.

Definition at line 806 of file byte_stream.hpp.

Constructor & Destructor Documentation

◆ ByteOutStream() [1/2]

jau::io::ByteOutStream::ByteOutStream ( )
default

◆ ~ByteOutStream()

jau::io::ByteOutStream::~ByteOutStream ( )
overridedefaultnoexcept

◆ ByteOutStream() [2/2]

jau::io::ByteOutStream::ByteOutStream ( const ByteOutStream )
delete

Member Function Documentation

◆ operator=()

ByteOutStream & jau::io::ByteOutStream::operator= ( const ByteOutStream )
delete

◆ is_open()

virtual bool jau::io::ByteOutStream::is_open ( ) const
pure virtualnoexcept

Checks if the stream has an associated file.

Implemented in jau::io::ByteOutStream_File.

◆ close()

virtual void jau::io::ByteOutStream::close ( )
pure virtualnoexcept

Close the stream if supported by the underlying mechanism.

Implemented in jau::io::ByteOutStream_File.

◆ write() [1/2]

virtual size_t jau::io::ByteOutStream::write ( const void *  in,
size_t  length 
)
pure virtualnoexcept

Write to the data sink.

Moves the internal offset so that every call to write will be appended to the sink.

This method is not blocking beyond the transfer length bytes.

Parameters
inthe input bytes to write out
lengththe length of the byte array in
Returns
length in bytes that were actually written

Implemented in jau::io::ByteOutStream_File.

◆ write() [2/2]

bool ByteOutStream::write ( const uint8_t &  in)
noexcept

Write one byte.

Parameters
inthe byte to be written
Returns
true if one byte has been written, otherwise false

Definition at line 630 of file byte_stream.cpp.

◆ id()

virtual std::string jau::io::ByteOutStream::id ( ) const
inlinevirtualnoexcept

return the id of this data source

Returns
std::string representing the id of this data source

Reimplemented in jau::io::ByteOutStream_File.

Definition at line 845 of file byte_stream.hpp.

◆ tellp()

virtual uint64_t jau::io::ByteOutStream::tellp ( ) const
pure virtualnoexcept

Returns the output position indicator.

Returns
number of bytes written so far.

Implemented in jau::io::ByteOutStream_File.

◆ to_string()

virtual std::string jau::io::ByteOutStream::to_string ( ) const
pure virtualnoexcept

Implemented in jau::io::ByteOutStream_File.


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