C4 Engine
C4 Engine API Documentation

class Completable

Defined in:  TSCompletable.h
Objects inherit from the Completable class when they perform a time-consuming task and wish to provide a mechanism for notifying the user of the object when such a task has been completed.
Definition

template <class classType> class Completable

Member Functions
Completable::GetCompletionCallback Returns the completion callback function for an object.
Completable::SetCompletionCallback Sets the completion callback function for an object.
Completable::GetCompletionCookie Returns the cookie that is passed to the completion callback function.
Completable::SetCompletionCookie Sets the cookie that is passed to the completion callback function.
Completable::HandleCompletion Invokes the completion callback function for an object.
Template Parameters
classType The type of the class which performs a completable action. This parameter should be the type of the class that inherits directly from the Completable class.
Constructor

Completable();

Description
The Completable class encapsulates a completion callback function pointer and a data value that is passed to this function. The completion callback function is invoked when the Completable::HandleCompletion function is called. This usually happens when a subclass of Completable completes a time consuming task and needs to notify some other piece of code.

Upon construction, the completion callback function is set to nullptr, causing calls to the Completable::HandleCompletion function to have no effect.