Xface Core Library: XFaceApp::TaskHandlerBase Class Reference

XFace / XEngine / XMath

XFaceApp::TaskHandlerBase Class Reference

#include <TaskHandlerBase.h>

Inheritance diagram for XFaceApp::TaskHandlerBase:

XFaceApp::ApplicationBase List of all members.

Detailed Description

Author:
Koray Balci
Task objects are issued and processed using this class. Current implementation has a Task queue (std::queue), and you can push new Tasks to the queue using TaskHandlerBase::newTask method. Then, when TaskHandlerBase::processTask method is called, the Task in queue is popped, and processed using TaskHandlerBase::dispatch method. In TaskHandlerBase::dispatch (private & non-virtual method), depending on Task type, the task is routed to appropriate handler method. If a time spanning task is being processed when the system tries to process a new task, it automatically waits until the end of the current task. That's why time spanning task handler methods return boolean values. All the task handler methods are defined as virtual with empty bodies, which means this class, by itself does nothing. You should never use this class directly, hence the destructor of the class is protected. This class only implements and hides the Task processing mechanism from its clients.
See also:
ApplicationBase

Public Member Functions

virtual void newTask (const Task &task)
 Post a new Task through here.
virtual bool processTask ()
 Process the Task queue.
void discardPendingTasks ()
 Discard all pending Task objects in the queue.
void pause (bool bPause=true)
 Pauses the system.

Protected Member Functions

virtual void onRenderFrame () const
 Task handler with empty body.
virtual void onAdvanceFrame () const
 Task handler with empty body.
virtual bool onResumePlayback ()
 Task handler with empty body.
virtual void onStopPlayback ()
 Task handler with empty body.
virtual void onRewindPlayback () const
 Task handler with empty body.
virtual bool onLoadFDP (const std::string &, const std::string &)
 Task handler with empty body.
virtual bool onLoadFAP (const std::string &)
 Task handler with empty body.
virtual bool onLoadPHO (const std::string &, const std::string &)
 Task handler with empty body.
virtual bool onLoadANIM (const std::string &)
 Task handler with empty body.
virtual bool onLoadWAV (const std::string &)
 Task handler with empty body.
virtual bool onUpLoadFAP (const std::string &)
 Task handler with empty body.
virtual bool onUpLoadPHO (const std::string &, const std::string &, const std::string &)
 Task handler with empty body.
virtual bool onUpLoadANIM (const std::string &)
 Task handler with empty body.
virtual bool onUpLoadScript (const std::string &, const std::string &)
 Task handler with empty body.

Protected Attributes

Task m_currentTask
 Pointer to current task that is being processed is stored for firing proper Notification(s).

Member Function Documentation

void XFaceApp::TaskHandlerBase::discardPendingTasks  ) 
 

Empties all the tasks in the queue. Not to be abused, might be necessary for high priority tasks like saving avi, and can be called before issueing such tasks.

void XFaceApp::TaskHandlerBase::newTask const Task task  )  [virtual]
 

Pushes the Task directly to the task queue.

bool XFaceApp::TaskHandlerBase::processTask  )  [virtual]
 

Pops the front task from the queue and tries to dispatch. Should be called externally every now and then (even when a task is being processed), derived class ApplicationBase does it well.

Returns:
false only if the queue is empty, true otherwise. Even if the task could not be dispatched, still we return true, because it means the system is busy, so we put back the task in the queue actually.
See also:
TaskHandlerBase::dispatch


The documentation for this class was generated from the following files:
Generated on Mon Aug 28 15:39:26 2006 for Xface Core Library by  doxygen 1.4.6-NO