Main Page | Class Hierarchy | Class List | File List | Class Members

IOInterface Class Reference

General IO Interface. More...

#include <IOInterface.h>

Inheritance diagram for IOInterface:

IOInterfaceSerial MipBus List of all members.

Public Member Functions

 IOInterface (IOInterfaceList *iolist)
 Constructor.
 ~IOInterface ()
 Destructor.
IOInterfaceListGetIOInterfaceList ()
 Returns the IOInterfaceList to which this IOInterface belongs to.
IOInterfaceGetIOInterfaceNext ()
 Returns the next IOInterface in the list.
virtual void OnInputAvailable ()
 (abstract) This is called by the application when the filehandle has become active.
virtual void OnDataArrival (unsigned char *data, int len)=0
 (abstract) This is called by OnInputAvailable() to process data that arrived.
virtual void OnClose ()=0
 (abstract) This is called when the filehandle is closed.
virtual bool Send (unsigned char *data, int len)
 (abstract) Writes data.
virtual bool Send (const std::string &str)
 (abstract) Writes a string.
int GetFileHandle () const
 Returns the file handle.
int IsOpen () const
 Returns whether the IO is open.
bool SetInputLogFile (const std::string &file, bool append=true)
 Sets the input log file. A copy of all input is saved in this file. If the string is empty, no log is saved.
bool SetOutputLogFile (const std::string &file, bool append=true)
 Sets the output log file. A copy of all output is saved in this file. If the string is empty, no log is saved.

Protected Attributes

IOInterfaceListmIOInterfaceList
 The next IOInterface in the list.
IOInterfacemIOInterfaceNext
 The next IOInterface in the list.
int mFileHandle
 The file handle of the open file/device (or -1 if the file/device is closed).
std::ofstream mLogInput
 The file where incoming traffic is logged.
std::ofstream mLogOutput
 The file where outgoing traffic is logged.

Detailed Description

General IO Interface.

An IOInterface object is attached to a file handle. The application should invoke OnInputAvailable whenever the filehandle becomes active. This class then reads the new data and dispatches it.

Data can be sent using the Send() method.

All incoming and outgoing data can be logged to a file using SetInputLogFile() and SetOutputLogFile().

This is an abstract class. You need to overwrite at least the OnDataArrival() and the OnClose() methods.

See also:
IOInterfaceSerial, IOInterfaceList


The documentation for this class was generated from the following file:
Generated on Wed Jun 1 09:19:07 2005 for libmip by doxygen 1.3.8