#include <IOInteractor.h>
class CIOInteractor {CIOInteractor(CInteractor& rInput, CInteractor& rOutput);
virtual ~CIOInteractor();
const CInteractor* getOutput();
const CInteractor* getInput();
virtual int Read(UInt_t nBytes, void* pBuffer);
virtual int Write(UInt_t nBytes, void* pBuffer);
virtual void Flush();
}
This class models an interactor that is made up of a read-only and
a write-only interactor. Prompt/written data goes to the write-only
interactor while reads go to the read-only interactor.
A sample usage would be for an interactive application where
the output interactor would be a
CFdInteractor
connected to stdout,
and the input interactor
CFdInteractor
connected to stdin
Note that this class has no copy constructor as it is not possible to ensure that all iteractor classes now and in the future will have copy constructors. In most cases, this is not a restriction.
CIOInteractor(CInteractor& rInput, CInteractor& rOutput);
Constructs the interactor,
rInput
is the interactor that will be used to get the input credentials.
rOutput
the interator to which prompts will be sent.
const CInteractor* getOutput();
Informational function that returns a pointer to the output interactor used to construct this object.
const CInteractor* getInput();
Informational function that returns a pointer to the input interactor used to construct this object.
virtual int Read(UInt_t nBytes, void* pBuffer);
Attempts to read
nBytes
from the input interactor into the buffer pointed to by
pBuffer
. The return value is determined
by the type of the actual interactor, but generally is the actual
number of bytes read. Usually a negative value indicates an error
condition of some sort, and a zero indicates there is no data
to be read, either because the end of the data source has been
reached or because the input source is a non-blocking entity.
virtual int Write(UInt_t nBytes, void* pBuffer);
Writes
nBytes
of data from
pBuffer
to the output interactor.
The return value depends on the actual interactor.
Usually negative values indicate an error,
zero usually indicates output to a non-blocking entity that
is not able to accept output at that time, and values
less than
nBytes
represent devices with some blocking/buffering
factor that has been
exceeded by the write.
virtual void Flush();
Flushes data in output buffes the output interactor may have.