ubit::UInput Class Reference

a UInput object fires callbacks when a file or a socket gets data. More...

#include <uinput.hpp>

Inheritance diagram for ubit::UInput:

ubit::UBrick ubit::UObject List of all members.

Public Member Functions

 UInput (int source)
virtual void onAction (UCall &call)
virtual void onInput (UCall &call)
 adds a callback that is fired when data is received.
virtual void onClose (UCall &call)
 adds a callback that is fired when source is closed.
virtual void open (int source)
 starts listening to the source (a file, a socket, a pipe ID).
virtual void close ()
 stops listening to the source.
int getSource () const
bool isOpened () const
 returns true if the UInput is opened.

Friends

class UNatAppli

Detailed Description

a UInput object fires callbacks when a file or a socket gets data.

Example:

    int source = ...;
    uptr<UInput> i = new UInput(source);
    i->onAction( ucall(x, y, printArgs) );
    i->onAction( ucall(obj, val, &Demo::doIt) );
 

See also: USocket (Ubit simple sockets).


Member Function Documentation

virtual void ubit::UInput::onInput ( UCall call  )  [virtual]

adds a callback that is fired when data is received.

the argument is a ucall<> expression (see UCall) that is destroyed when the UInput is destroyed (except if "referenced elsewhere"; see UBrick).


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:51 2007 for Ubit by  doxygen 1.4.7