メイン・コンテンツまでスキップ

GenericCallback<void>

GenericCallback is the base class for callbacks. The reason this base class exists, is that a normal Callback requires the class type where the callback function resides to be known. This is problematic for ie. framework widgets like AbstractButton, on which it should be possible to register a callback on object types that are user-specific and thus unknown to AbstractButton. This is solved by having AbstractButton contain a pointer to a GenericCallback instead. This pointer must then be initialized to point on an instance of Callback, created by the user, which is initialized with the appropriate object type.

See: Callback

Note: As with Callback, this class exists in four versions to support callback functions taking zero, one, two or three arguments.

Public Functions

virtual voidexecute() =0
Calls the member function.
virtual boolisValid() const =0
Function to check whether the Callback has been initialized with values.
virtual ~GenericCallback()
Finalizes an instance of the GenericCallback<void> class.

Public Functions Documentation

execute

virtual void execute()=0

Calls the member function.

Do not call execute unless isValid() returns true (ie. a pointer to the object and the function has been set).

isValid

virtual bool isValid()const =0

Function to check whether the Callback has been initialized with values.

Returns:

true If the callback is valid (i.e. safe to call execute).

~GenericCallback

virtual ~GenericCallback()

Finalizes an instance of the GenericCallback<void> class.