Location:
e32std.h
Link against: euser.lib
TCallBack
Supported from 5.0
Encapsulates a general call-back function.
Although widely applicable, it simplifies the programming interface of:
the CIdle
class, the Idle time active
object
the CPeriodic
class, the regular timer event
generator.
The class encapsulates:
a pointer to a function which takes an argument of type
TAny*
and returns a TInt
.
a pointer which is passed to the function every time it is called. The pointer can point to any object. It can also be NULL.
The callback function can be a static function of a class, e.g.
TInt X::Foo(TAny *)
or it can be a function which is not a member
of any class, e.g. TInt Foo(TAny *)
.
When used with the CIdle
and the
CPeriodic
classes, the callback function is intended to be called
repeatedly; the encapsulated pointer is passed on each call. Typically, the
pointer refers to an object which records the state of the task across each
call. The callback function should also return a true (non-zero) value if it is
intended to be called again, otherwise it should return a false (zero)
value.
Defined in TCallBack
:
CallBack()
, TCallBack()
TCallBack(TInt (*aFunction)(TAny* aPtr));
TCallBack(TInt (*aFunction)(TAny* aPtr),TAny* aPtr);
Constructs the callback object with the specified callback function and, optionally, a pointer to an object.
|
TInt CallBack() const;
Calls the callback function.
|