Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

LibGPIB::GPIBEquipmentBuffer Class Reference

The streambuf associated with GPIBEquipment. More...

#include <GPIBEquipment.h>

Inheritance diagram for LibGPIB::GPIBEquipmentBuffer:

LibGPIB::streambuf List of all members.

Public Methods

 GPIBEquipmentBuffer (GPIBEquipment *device)
 Construct a buffer and associate it with the specified GPIBEquipment. More...


Protected Methods

virtual streambufsetbuf (char_type *, streamsize)
 Performs an operation that is defined separately for each class derived from streambuf. More...

virtual int_type overflow (int_type c)
 Writes the specified character to the associated GPIBEquipment if one. More...

virtual int_type uflow ()
 Reads and returns the next character from the associated GPIBEquipment if one otherwise returns traits::eof(). More...

virtual int_type underflow ()
 Reads and returns the next character from the associated GPIBEquipment if one otherwise returns traits::eof(). More...

virtual streamsize xsgetn (char_type *s, streamsize n)
 Reads upto n characters from the GPIBEquipment and returns them through the character array located at s. More...

virtual streamsize xsputn (const char_type* s, streamsize n)
 Writes upto n characters from tha character sequence at s to the GPIBEquipment associated with the buffer. More...

virtual int_type pbackfail (int_type c = EOF)
 This function is called when a putback of a character fails. More...


Private Methods

char_type GetChar ()
 This routine reads and returns one character from the associated GPIBEquipment if one otherwise returns traits::eof().

void PutChar (const char_type c)
 This routine writes the specified character to the associated GPIBEquipment if one otherwise does nothing.


Private Attributes

GPIBEquipmentmParentGPIBEquipment
 The GPIBEquipment associated with this streambuf.

char mPutbackChar
 Each streambuf subclass is required to allow putback of at least one character. More...

bool mPutbackAvailable
 This flag indicates that a character has been put back into the buffer. More...


Detailed Description

The streambuf associated with GPIBEquipment.

Communication with a GPIBEquipment usually involves sending a set of commands to the GPIBController associated with the GPIBEquipment followed by the data transmission to/from the GPIBEquipment and then another set of commands being sent to the GPIBController. This class takes care of these steps so that the GPIBEquipment class can behave just like a iostream while communicating with a given GPIBEquipment.

Definition at line 38 of file GPIBEquipment.h.


Constructor & Destructor Documentation

LibGPIB::GPIBEquipmentBuffer::GPIBEquipmentBuffer ( GPIBEquipment * device ) [inline]

Construct a buffer and associate it with the specified GPIBEquipment.

It does not make sense to attach the same GPIBEquipmentBuffer to more than one GPIBEquipment; if this is attempted the output is undefined.

Parameters:
device   The GPIBEquipment which will be using this GPIBEquipmentBuffer for GPIB communication.

Definition at line 163 of file GPIBEquipment.h.


Member Function Documentation

char_type LibGPIB::GPIBEquipmentBuffer::GetChar ( ) [private]

This routine reads and returns one character from the associated GPIBEquipment if one otherwise returns traits::eof().

void LibGPIB::GPIBEquipmentBuffer::PutChar ( char_type c ) [private]

This routine writes the specified character to the associated GPIBEquipment if one otherwise does nothing.

GPIBEquipmentBuffer::int_type LibGPIB::GPIBEquipmentBuffer::overflow ( int_type c ) [inline, protected, virtual]

Writes the specified character to the associated GPIBEquipment if one.

Returns:
The character c.

Definition at line 185 of file GPIBEquipment.h.

GPIBEquipmentBuffer::int_type LibGPIB::GPIBEquipmentBuffer::pbackfail ( int_type c = EOF ) [inline, protected, virtual]

This function is called when a putback of a character fails.

This must be implemented for unbuffered I/O as all streambuf subclasses are required to provide putback of at lease on character.

Definition at line 205 of file GPIBEquipment.h.

streambuf * LibGPIB::GPIBEquipmentBuffer::setbuf ( char_type *,
streamsize ) [inline, protected, virtual]

Performs an operation that is defined separately for each class derived from streambuf.

The default behavior is to do nothing if gptr() is non-null and gptr()!=egptr(). Also, setbuf(0, 0) usually means unbuffered I/O and setbuf(p, n) means use p[0]...p[n-1] to hold the buffered characters. In general, this method implements the subclass's notion of getting memory for the buffered characters.

In the case of the GPIBEquipment it is not safe to read more than one character at a time and hence we do not allow buffered I/O. An attempt to call this routine to set the buffer will have no effect on the functionality of the class.

Returns:
Returns "streambuf::setbuf(0, 0)".

Definition at line 175 of file GPIBEquipment.h.

GPIBEquipmentBuffer::int_type LibGPIB::GPIBEquipmentBuffer::uflow ( ) [inline, protected, virtual]

Reads and returns the next character from the associated GPIBEquipment if one otherwise returns traits::eof().

This method is used for unbuffered I/O while underflow() is called for buffer I/O.

Returns:
The next character from the GPIBEquipment.

Definition at line 198 of file GPIBEquipment.h.

GPIBEquipmentBuffer::int_type LibGPIB::GPIBEquipmentBuffer::underflow ( ) [inline, protected, virtual]

Reads and returns the next character from the associated GPIBEquipment if one otherwise returns traits::eof().

This method is used for buffered I/O while uflow() is called for unbuffered I/O.

Returns:
The next character from the GPIBEquipment.

Definition at line 192 of file GPIBEquipment.h.

streamsize LibGPIB::GPIBEquipmentBuffer::xsgetn ( char_type * s,
streamsize n ) [protected, virtual]

Reads upto n characters from the GPIBEquipment and returns them through the character array located at s.

Returns:
The number of characters actually read from the GPIBEquipment.

streamsize LibGPIB::GPIBEquipmentBuffer::xsputn ( const char_type * s,
streamsize n ) [protected, virtual]

Writes upto n characters from tha character sequence at s to the GPIBEquipment associated with the buffer.

Returns:
The number of characters that were successfully written to the GPIBEquipment.

Member Data Documentation

GPIBEquipment * LibGPIB::GPIBEquipmentBuffer::mParentGPIBEquipment [private]

The GPIBEquipment associated with this streambuf.

Definition at line 132 of file GPIBEquipment.h.

bool LibGPIB::GPIBEquipmentBuffer::mPutbackAvailable [private]

This flag indicates that a character has been put back into the buffer.

The next attempt to read a character from the buffer will return mPutbackChar.

Definition at line 146 of file GPIBEquipment.h.

char LibGPIB::GPIBEquipmentBuffer::mPutbackChar [private]

Each streambuf subclass is required to allow putback of at least one character.

This character contains this putback value.

Definition at line 139 of file GPIBEquipment.h.


The documentation for this class was generated from the following file:
Generated at Tue Aug 8 01:37:56 2000 for libgpib by doxygen1.1.4 written by Dimitri van Heesch, © 1997-2000