NAME¶
IOCallback - generic callback class for readers, writers, or I/O exception
handlers
SYNOPSIS¶
#include <Dispatch/iocallback.h>
DESCRIPTION¶
For convenience, the macros defined in iocallback.h allow the user to define an
iohandler which does nothing more than call an arbitrary object's member
function. The actual code to read data from a file descriptor, write data to a
file descriptor, handle an I/O exception on a file descriptor, or handle a
timer's expiration can reside in any arbitrary class rather than in the
iohandler.
MACROS¶
- declareIOCallback(T)
- Declare an iocallback type for the given class type T.
- implementIOCallback(T)
- Emit code at this point to implement the iocallback's member
functions.
- IOCallback(T)* instance = new IOCallback(T)(...)
- Define an instance of the iocallback type for the given class type T.
CONSTRUCTORS¶
- typedef int T::IOReady(T)(int fd)
- typedef void T::IOTimer(T)(long sec, long usec)
- IOCallback(T)(T*, IOReady(T)* in, IOReady(T)* out = nil, IOReady(T)* ex
= nil)
- IOCallback(T)(T*, IOTimer(T)*, IOReady(T)* in = nil, IOReady(T)* out =
nil, IOReady(T)* ex = nil)
- Construct an instance of the iocallback type that will call the given
member functions of the given class type T's instance. Note that you do
not have to use the IOReady(T) or IOTimer(T) macros; rather, you only have
to pass the address of a T member function, such as
&T::inputReady.
SEE ALSO¶
Dispatcher(3I), IOHandler(3I)