|
Open Model Railroad Network (OpenMRN)
|
Helper class for defining streams that forward data to another stream internally. More...
#include <SyncStream.hxx>
Public Member Functions | |
| WrappedStream (SyncStream *delegate) | |
| void | set_delegate (SyncStream *delegate) |
| Overrides the target where to send the incoming data onwards. | |
| int | finalize (int status) override |
| Called once after all data has been written to close the stream and release resources. | |
Public Member Functions inherited from SyncStream | |
| virtual ssize_t | write (const void *data, size_t len)=0 |
| Main entry point to the data consumption. | |
| ssize_t | write_all (const void *data, size_t len) |
| Repeatedly writes until all data has been consumed or an error occurs. | |
Protected Attributes | |
| std::unique_ptr< SyncStream > | delegate_ |
| Where to write the data to. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from SyncStream | |
| static const uint8_t * | to_8 (const void *d) |
| Converts a void pointer to an equivalent byte pointer. | |
| static uint8_t * | to_8 (void *d) |
| Converts a void pointer to an equivalent byte pointer. | |
Helper class for defining streams that forward data to another stream internally.
Definition at line 147 of file SyncStream.hxx.
|
inline |
Definition at line 150 of file SyncStream.hxx.
|
inlineoverridevirtual |
Called once after all data has been written to close the stream and release resources.
Return 0 on success, <0 on failure.
| status | is an error code seen by wrapping streams. Default 0 (OK), if negative, streams might want to roll back their changes. |
Reimplemented from SyncStream.
Definition at line 168 of file SyncStream.hxx.
|
inline |
Overrides the target where to send the incoming data onwards.
Frees (and finalizes) the previous delegate.
| delegate | is the wrapped stream. Takes ownership of the pointer. |
Definition at line 158 of file SyncStream.hxx.
|
protected |
Where to write the data to.
Definition at line 181 of file SyncStream.hxx.