GNU CommonC++
Public Member Functions | List of all members
ost::ttystream Class Reference

A more natural C++ "ttystream" class for use by non-threaded applications. More...

#include <serial.h>

Inheritance diagram for ost::ttystream:
ost::TTYStream ost::Serial

Public Member Functions

 ttystream ()
 Construct an unopened "ttystream" object.
 ttystream (const char *name)
 Construct and "open" a tty stream object.
void open (const char *name)
 Open method for a tty stream.
void close (void)
 Close method for a tty stream.
bool operator! ()
 Test to see if stream is opened.
- Public Member Functions inherited from ost::TTYStream
 TTYStream (const char *filename, timeout_t to=0)
 Create and open a tty serial port.
virtual ~TTYStream ()
 End the tty stream and cleanup.
void setTimeout (timeout_t to)
 Set the timeout control.
void interactive (bool flag)
 Set tty mode to buffered or "interactive".
int sync (void)
 Flushes the stream input and out buffers, writes pending output.
bool isPending (Pending pend, timeout_t timeout=TIMEOUT_INF)
 Get the status of pending operations.
- Public Member Functions inherited from ost::Serial
virtual ~Serial ()
 The serial base class may be "thrown" as a result on an error, and the "catcher" may then choose to destory the object.
Serialoperator= (const Serial &from)
 Serial ports may also be duplecated by the assignment operator.
Error setSpeed (unsigned long speed)
 Set serial port speed for both input and output.
Error setCharBits (int bits)
 Set character size.
Error setParity (Parity parity)
 Set parity mode.
Error setStopBits (int bits)
 Set number of stop bits.
Error setFlowControl (Flow flow)
 Set flow control.
void toggleDTR (timeout_t millisec)
 Set the DTR mode off momentarily.
void sendBreak (void)
 Send the "break" signal.
Error getErrorNumber (void)
 Often used by a "catch" to fetch the last error of a thrown serial.
char * getErrorString (void)
 Often used by a "catch" to fetch the user set error string of a thrown serial.
int getBufferSize (void)
 Get the "buffer" size for buffered operations.

Additional Inherited Members

- Public Types inherited from ost::Serial
enum  Error {
  errSuccess = 0, errOpenNoTty, errOpenFailed, errSpeedInvalid,
  errFlowInvalid, errParityInvalid, errCharsizeInvalid, errStopbitsInvalid,
  errOptionInvalid, errResourceFailure, errOutput, errInput,
  errTimeout, errExtended
}
enum  Flow { flowNone, flowSoft, flowHard, flowBoth }
enum  Parity { parityNone, parityOdd, parityEven }
enum  Pending { pendingInput, pendingOutput, pendingError }
typedef enum Error Error
typedef enum Flow Flow
typedef enum Parity Parity
typedef enum Pending Pending
- Protected Member Functions inherited from ost::TTYStream
 TTYStream ()
 This constructor is used to derive "ttystream", a more C++ style version of the TTYStream class.
void allocate (void)
 Used to allocate the buffer space needed for iostream operations.
void endStream (void)
 Used to terminate the buffer space and clean up the tty connection.
int underflow (void)
 This streambuf method is used to load the input buffer through the established tty serial port.
int uflow (void)
 This streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode.
int overflow (int ch)
 This streambuf method is used to write the output buffer through the established tty port.
- Protected Attributes inherited from ost::TTYStream
char * gbuf
char * pbuf
timeout_t timeout

Detailed Description

A more natural C++ "ttystream" class for use by non-threaded applications.

This class behaves a lot more like fstream and similar classes.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m C++ "fstream" style ttystream class.

Constructor & Destructor Documentation

ost::ttystream::ttystream ( )

Construct an unopened "ttystream" object.

ost::ttystream::ttystream ( const char *  name)

Construct and "open" a tty stream object.

A filename in the form "device:options[,options]" may be used to pass device options as part of the open.

Parameters
nameof file and serial options.

Member Function Documentation

void ost::ttystream::close ( void  )

Close method for a tty stream.

Reimplemented from ost::Serial.

void ost::ttystream::open ( const char *  name)

Open method for a tty stream.

Parameters
namefilename to open.

Reimplemented from ost::Serial.

bool ost::ttystream::operator! ( void  )
inline

Test to see if stream is opened.


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