Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
SyncStream Class Referenceabstract
Inheritance diagram for SyncStream:
DelegateStream HeaderStream StringAppendStream WrappedStream CCMHelper::DecryptorStream MaxLengthStream MinWriteStream

Public Member Functions

virtual ssize_t write (const void *data, size_t len)=0
 Main entry point to the data consumption.
 
virtual int finalize (int status)
 Called once after all data has been written to close the stream and release resources.
 
ssize_t write_all (const void *data, size_t len)
 Repeatedly writes until all data has been consumed or an error occurs.
 

Static Protected Member Functions

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.
 

Detailed Description

Definition at line 45 of file SyncStream.hxx.

Constructor & Destructor Documentation

◆ ~SyncStream()

virtual SyncStream::~SyncStream ( )
inlinevirtual

Definition at line 48 of file SyncStream.hxx.

Member Function Documentation

◆ finalize()

virtual int SyncStream::finalize ( int  status)
inlinevirtual

Called once after all data has been written to close the stream and release resources.

Return 0 on success, <0 on failure.

Parameters
statusis an error code seen by wrapping streams. Default 0 (OK), if negative, streams might want to roll back their changes.

Reimplemented in CCMHelper::DecryptorStream, WrappedStream, and MinWriteStream.

Definition at line 66 of file SyncStream.hxx.

◆ to_8() [1/2]

static const uint8_t * SyncStream::to_8 ( const void *  d)
inlinestaticprotected

Converts a void pointer to an equivalent byte pointer.

Definition at line 97 of file SyncStream.hxx.

◆ to_8() [2/2]

static uint8_t * SyncStream::to_8 ( void *  d)
inlinestaticprotected

Converts a void pointer to an equivalent byte pointer.

Definition at line 103 of file SyncStream.hxx.

◆ write()

virtual ssize_t SyncStream::write ( const void *  data,
size_t  len 
)
pure virtual

Main entry point to the data consumption.

Parameters
datais the pointer to a block of data to consume.
lenis the number of bytes to consume.
Returns
0 if the stream is completed/EOF (not consuming data anymore); negative value if there is an error; or the number of bytes consumed from the stream.

Implemented in CCMHelper::DecryptorStream, HeaderStream, MaxLengthStream, MinWriteStream, StringAppendStream, and DelegateStream.

◆ write_all()

ssize_t SyncStream::write_all ( const void *  data,
size_t  len 
)
inline

Repeatedly writes until all data has been consumed or an error occurs.

Returns a short write only when an EOF occured.

Definition at line 73 of file SyncStream.hxx.


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