All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::BinaryStream Class Referenceabstract

Abstract base class for binary streams. More...

#include <Radiant/BinaryStream.hpp>

Inheritance diagram for Radiant::BinaryStream:
Radiant::SerialPort Radiant::TCPSocket Radiant::UDPSocket

Public Member Functions

 BinaryStream ()
 Constructor.
 
virtual bool close ()
 Close the stream. More...
 
virtual bool isHungUp () const
 Returns true if the stream has been closed. More...
 
virtual bool isOpen () const
 Checks whether the stream is still accessible. More...
 
virtual bool isPendingInput (unsigned int waitMicroSeconds=0)
 Returns true if the stream has at least one byte waiting to be read; otherwise returns false. More...
 
virtual int read (void *buffer, int bytes, bool waitfordata=true)=0
 Read bytes from the stream. More...
 
virtual int write (const void *buffer, int bytes)=0
 Write bytes to the stream. More...
 
virtual ~BinaryStream ()
 Destructor.
 

Detailed Description

Abstract base class for binary streams.

Member Function Documentation

virtual bool Radiant::BinaryStream::close ( )
inlinevirtual

Close the stream.

Returns
True if succeeded. Base implementation returns always true

Reimplemented in Radiant::UDPSocket, Radiant::TCPSocket, and Radiant::SerialPort.

virtual bool Radiant::BinaryStream::isHungUp ( ) const
inlinevirtual

Returns true if the stream has been closed.

Returns
True if hung up. Base implementation returns always false.

Reimplemented in Radiant::TCPSocket.

virtual bool Radiant::BinaryStream::isOpen ( ) const
inlinevirtual

Checks whether the stream is still accessible.

Returns
True if the stream is open and accessible

Reimplemented in Radiant::SerialPort, Radiant::TCPSocket, and Radiant::UDPSocket.

virtual bool Radiant::BinaryStream::isPendingInput ( unsigned int  waitMicroSeconds = 0)
inlinevirtual

Returns true if the stream has at least one byte waiting to be read; otherwise returns false.

Parameters
waitMicroSecondsHow many microseconds this call will block at most. In this class the implementation ignores this parameter.
Returns
True if pending input. Base implementation returns always false.

Reimplemented in Radiant::TCPSocket.

virtual int Radiant::BinaryStream::read ( void *  buffer,
int  bytes,
bool  waitfordata = true 
)
pure virtual

Read bytes from the stream.

Parameters
bufferBuffer to read from
bytesNumber of bytes to read
waitfordataDoes this call block until all of the data is available
Returns
Number of bytes to read

Implemented in Radiant::TCPSocket, Radiant::UDPSocket, and Radiant::SerialPort.

virtual int Radiant::BinaryStream::write ( const void *  buffer,
int  bytes 
)
pure virtual

Write bytes to the stream.

Parameters
bufferBuffer to write
bytesNumber of bytes to write
Returns
Number of bytes actually written

Implemented in Radiant::TCPSocket, Radiant::UDPSocket, and Radiant::SerialPort.