qb
2.0.0.0
C++17 Actor Framework
|
Output stream template class. More...
#include <stream.h>
Public Types | |
using | transport_io_type = _IO_ |
Type of the underlying transport IO. | |
using | output_buffer_type = qb::allocator::pipe<char> |
Type of the output buffer. |
Public Member Functions | |
~ostream () noexcept | |
Destructor. | |
_IO_ & | transport () noexcept |
Get the underlying transport object. | |
const _IO_ & | transport () const noexcept |
Get the underlying transport object (const version) | |
output_buffer_type & | out () noexcept |
Get the output buffer. | |
std::size_t | pendingWrite () const noexcept |
Get the number of bytes pending for writing. | |
template<typename Available = void> | |
int | write (std::enable_if_t< has_method_write< _IO_, int, const char *, std::size_t >::value, Available > *=nullptr) noexcept |
Write data from the output buffer to the transport. | |
char * | publish (char const *data, std::size_t size) noexcept |
Add data to the output buffer for later writing. | |
void | close () noexcept |
Close the stream. |
Protected Attributes | |
_IO_ | _out |
The underlying IO object. | |
output_buffer_type | _out_buffer |
Buffer for outgoing data. |
Output stream template class.
This template class provides output stream functionality for various transport implementations. It manages an output buffer and provides methods for writing data from the buffer to the underlying IO object.
_IO_ | The IO type that implements the actual transport operations |
|
inlinenoexcept |
Destructor.
Ensures that the stream is closed properly when destroyed.
|
inlinenodiscardnoexcept |
Get the underlying transport object.
|
inlinenodiscardnoexcept |
Get the underlying transport object (const version)
|
inlinenodiscardnoexcept |
Get the output buffer.
|
inlinenodiscardnoexcept |
Get the number of bytes pending for writing.
|
inlinenodiscardnoexcept |
Write data from the output buffer to the transport.
This method is enabled only if the IO type has a compatible write method. It writes the entire buffer content and adjusts or resets the buffer based on the actual number of bytes written.
|
inlinenoexcept |
Add data to the output buffer for later writing.
data | Pointer to the data to add |
size | Size of the data to add |
Copies the specified data to the output buffer for later transmission by the write method.
|
inlinenoexcept |
Close the stream.
Resets the output buffer and closes or disconnects the underlying transport, depending on the available methods.