Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
deskflow::IStream Class Referenceabstract

Bidirectional stream interface. More...

#include <IStream.h>

Inheritance diagram for deskflow::IStream:
Collaboration diagram for deskflow::IStream:

Public Member Functions

 IStream ()=default
manipulators
virtual void close ()=0
 Close the stream.
virtual uint32_t read (void *buffer, uint32_t n)=0
 Read from stream.
virtual void write (const void *buffer, uint32_t n)=0
 Write to stream.
virtual void flush ()=0
 Flush the stream.
virtual void shutdownInput ()=0
 Shutdown input.
virtual void shutdownOutput ()=0
 Shutdown output.
accessors
virtual void * getEventTarget () const =0
 Get event target.
virtual bool isReady () const =0
 Test if read() will succeed.
virtual uint32_t getSize () const =0
 Get bytes available to read.
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

Detailed Description

Bidirectional stream interface.

Defines the interface for all streams.

Constructor & Destructor Documentation

◆ IStream()

deskflow::IStream::IStream ( )
default

Member Function Documentation

◆ close()

virtual void deskflow::IStream::close ( )
pure virtual

Close the stream.

Closes the stream. Pending input data and buffered output data are discarded. Use flush() before close() to send buffered output data. Attempts to read() after a close return 0, attempts to write() generate output error events, and attempts to flush() return immediately.

Implemented in IDataSocket, PacketStreamFilter, SecureSocket, StreamFilter, and TCPSocket.

◆ flush()

virtual void deskflow::IStream::flush ( )
pure virtual

Flush the stream.

Waits until all buffered data has been written to the stream.

Implemented in IDataSocket, StreamFilter, and TCPSocket.

◆ getEventTarget()

virtual void * deskflow::IStream::getEventTarget ( ) const
pure virtual

Get event target.

Returns the event target for events generated by this stream. It should be the source stream in a chain of stream filters.

Implemented in IDataSocket, StreamFilter, and TCPSocket.

◆ getSize()

virtual uint32_t deskflow::IStream::getSize ( ) const
pure virtual

Get bytes available to read.

Returns a conservative estimate of the available bytes to read (i.e. a number not greater than the actual number of bytes). Some streams may not be able to determine this and will always return zero.

Implemented in IDataSocket, PacketStreamFilter, StreamFilter, and TCPSocket.

◆ isReady()

virtual bool deskflow::IStream::isReady ( ) const
pure virtual

Test if read() will succeed.

Returns true iff an immediate read() will return data. This may or may not be the same as getSize() > 0, depending on the stream type.

Implemented in IDataSocket, PacketStreamFilter, StreamFilter, and TCPSocket.

◆ read()

virtual uint32_t deskflow::IStream::read ( void * buffer,
uint32_t n )
pure virtual

Read from stream.

Read up to n bytes into buffer, returning the number read (zero if no data is available or input is shutdown). buffer may be nullptr in which case the data is discarded.

Implemented in IDataSocket, PacketStreamFilter, StreamFilter, and TCPSocket.

◆ shutdownInput()

virtual void deskflow::IStream::shutdownInput ( )
pure virtual

Shutdown input.

Shutdown the input side of the stream. Any pending input data is discarded and further reads immediately return 0.

Implemented in IDataSocket, PacketStreamFilter, StreamFilter, and TCPSocket.

◆ shutdownOutput()

virtual void deskflow::IStream::shutdownOutput ( )
pure virtual

Shutdown output.

Shutdown the output side of the stream. Any buffered output data is discarded and further writes generate output error events. Use flush() before shutdownOutput() to send buffered output data.

Implemented in IDataSocket, StreamFilter, and TCPSocket.

◆ write()

virtual void deskflow::IStream::write ( const void * buffer,
uint32_t n )
pure virtual

Write to stream.

Write n bytes from buffer to the stream. If this can't complete immediately it will block. Data may be buffered in order to return more quickly. A output error event is generated when writing fails.

Implemented in IDataSocket, PacketStreamFilter, StreamFilter, and TCPSocket.


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