Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: e32std.h

Class TCallBack

class TCallBack;

Description

Encapsulates a general call-back function.

The class encapsulates:

1. a pointer to a function which takes an argument of type TAny* and returns a TInt.

2. 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. When used with CIdle, 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.

Members

Defined in TCallBack:
CallBack(), TCallBack(), TCallBack(), TCallBack(), iFunction, iPtr

See also:


Construction and destruction


TCallBack()

inline TCallBack();

Description

Default constructor.

Sets the function pointer to Null.


TCallBack()

inline TCallBack(TInt(*aFunction)(TAny *aPtr));

Description

Constructs the callback object with the specified callback function.

Parameters

TInt(*)(TAny *aPtr) aFunction

A pointer to the callback function. It takes an argument of type TAny* and returns a TInt. It must be either a static member of a class or a function which is not a member of any class.


TCallBack()

inline TCallBack(TInt(*aFunction)(TAny *aPtr), TAny *aPtr);

Description

Constructs the callback object with the specified callback function and a pointer to any object.

Parameters

TInt(*)(TAny *aPtr) aFunction

A pointer to the callback function. It takes an argument of type TAny* and returns a TInt. It must be either a static member of a class or a function which is not a member of any class.

TAny *aPtr

A pointer which is always passed to the callback function.

[Top]


Member functions


CallBack()

inline TInt CallBack() const;

Description

Calls the callback function.

Return value

TInt

The value returned by the callback function. The meaning of this value depends entirely on the context in which the callback function is called. For example, when used with the CIdle class, a false (zero) value indicates that the callback function should not be called again. As another example, when used with the CPeriodic class, the return value is ignored and is irrelevant in that context.

See also:

[Top]


Member data


iFunction

TInt(* iFunction;

Description

A pointer to the callback function.


iPtr

TAny * iPtr;

Description

A pointer that is passed to the callback function when the function is called.