Xface Core Library: XFaceApp::ApplicationBase Class Reference

XFace / XEngine / XMath

XFaceApp::ApplicationBase Class Reference

#include <ApplicationBase.h>

Inheritance diagram for XFaceApp::ApplicationBase:

XFaceApp::TaskHandlerBase List of all members.

Detailed Description

Author:
Koray Balci
Abstract base class for Xface related Task processing. Implements the empty Task handlers defined in base class TaskHandlerBase, but pure virtual create* methods also enforces derivation from this class. For basic use, task handlers in this class does the job, at least Xface related job. For example, for adding GUI related things, you should reimplement these task handlers, and call the implementations provided here from derived ones. So, the main idea is to provide the basic mechanism and hide the Xface related implementation while letting users to develop their own application using various available libraries and technologies.

Public Types

enum  QUERY

Public Member Functions

virtual void muteAudio (bool bSnd)
bool query (const QUERY &q)
virtual bool init ()

Protected Member Functions

virtual bool yield ()=0
virtual bool createScriptProcessors ()=0
 Creates an object implementing IScriptProcessor interface.
virtual boost::shared_ptr<
ITimer
createTimer () const =0
 Creates an object implementing ITimer interface.
virtual boost::shared_ptr<
ISound
createSound () const =0
 Creates an object implementing ISound interface.
virtual boost::shared_ptr<
FaceBase
createFace () const =0
 Creates a FaceBase object (or a derived one).
virtual boost::shared_ptr<
IRenderer
createRenderer () const =0
 Creates an object implementing XFace::IRenderer interface.
virtual boost::shared_ptr<
IFapStream
createFapStream () const =0
 Creates an object implementing IFapStream interface.
virtual void fireNotification (const Notification &note) const =0
virtual void renderBegin () const
virtual void renderEnd () const
unsigned long synchronize (bool)
virtual void onRenderFrame () const
 Task Handler.
virtual void onAdvanceFrame ()
virtual bool onResumePlayback ()
virtual void onStopPlayback ()
virtual void onRewindPlayback () const
virtual bool onLoadFDP (const std::string &param1, const std::string &param2)
virtual bool onLoadFAP (const std::string &param)
virtual bool onLoadPHO (const std::string &param1, const std::string &param2)
virtual bool onLoadANIM (const std::string &param1)
virtual bool onLoadWAV (const std::string &param)
virtual bool onUpLoadFAP (const std::string &param)
virtual bool onUpLoadPHO (const std::string &param1, const std::string &param2, const std::string &param3)
virtual bool onUpLoadANIM (const std::string &param1)
virtual bool onUpLoadScript (const std::string &param1, const std::string &param2)

Member Enumeration Documentation

enum XFaceApp::ApplicationBase::QUERY
 

Basic query mechanism. To be changed..


Member Function Documentation

virtual void XFaceApp::ApplicationBase::fireNotification const Notification note  )  const [protected, pure virtual]
 

Fires the Notification, implementation is probably TCP/IP related, hence left out of core library and implemented in derived class in XfacePlayer.

bool XFaceApp::ApplicationBase::init  )  [virtual]
 

Pure virtual create* methods are called here to create necessary objects and stored in interface pointers. This way, we provide the mechanism but developers might be interested/need using platform dependent or external library dependent classes, or just improve the already supplied classes in Xface.

Sound, Xface::FaceBase, timer, renderer, fap stream, script processor objects are created.

void XFaceApp::ApplicationBase::muteAudio bool  bSnd  )  [virtual]
 

Mutes the audio. Good for testing purposes during development!

void XFaceApp::ApplicationBase::onAdvanceFrame  )  [protected, virtual]
 

Advances the FAP frame, and updates the deformation. No Notification is fired.

bool XFaceApp::ApplicationBase::onLoadANIM const std::string &  param1  )  [protected, virtual]
 

Loads the ANIM file from the server (XfacePlayer) side.

Parameters:
param1 is the filename Notification::kError is fired on error and Notification::kFinished is fired on success.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onLoadFAP const std::string &  param  )  [protected, virtual]
 

Loads the FAP file from the server (XfacePlayer) side.

Parameters:
param is the filename Notification::kError is fired on error and Notification::kFinished is fired on success.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onLoadFDP const std::string &  param1,
const std::string &  param2
[protected, virtual]
 

Loads the FDP file from the server (XfacePlayer) harddisk.

Parameters:
param1 is the filename
param2 is the path Notification::kError is fired on error and Notification::kFinished is fired on success.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onLoadPHO const std::string &  param1,
const std::string &  param2
[protected, virtual]
 

Loads the PHO file from the server (XfacePlayer) side.

Parameters:
param1 is the filename
param2 is the language Notification::kError is fired on error and Notification::kFinished is fired on success.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onLoadWAV const std::string &  param  )  [protected, virtual]
 

Loads the WAV file from the server (XfacePlayer) disk.

Parameters:
param is the filename Notification::kError is fired on error and Notification::kFinished is fired on success.

Reimplemented from XFaceApp::TaskHandlerBase.

void XFaceApp::ApplicationBase::onRenderFrame  )  const [protected, virtual]
 

Renders the current frame. No Notification is fired.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onResumePlayback  )  [protected, virtual]
 

Starts/Resumes the playback of FAP stream and the WAV file and sends back Notification::kStarted in the beginning and Notification::kFinished in the end to the client. On error, Notification::kError is returned. Also yields the message pump for checking if there is a pause or stop Task arrived or not. If by chance, another resume playback Task is in the task queue, it is not executed until tht current task finishes.

Reimplemented from XFaceApp::TaskHandlerBase.

void XFaceApp::ApplicationBase::onRewindPlayback  )  const [protected, virtual]
 

Rewinds the FAP stream and the WAV file to beginning and fires Notification::kFinished.

Reimplemented from XFaceApp::TaskHandlerBase.

void XFaceApp::ApplicationBase::onStopPlayback  )  [protected, virtual]
 

Stops and rewinds the FAP stream and the WAV file to beginning and fires Notification::kFinished.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onUpLoadANIM const std::string &  param1  )  [protected, virtual]
 

Parameters:
param1 is the ANIM contents

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onUpLoadFAP const std::string &  param  )  [protected, virtual]
 

Parameters:
param is the FAP contents

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onUpLoadPHO const std::string &  param1,
const std::string &  param2,
const std::string &  param3
[protected, virtual]
 

Parameters:
param1 is the PHO contents
param2 is the PHO language

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::onUpLoadScript const std::string &  param1,
const std::string &  param2
[protected, virtual]
 

Processes the script string passed (from remote client possibly). Current IScriptProcessor implementation (Expl2fapProcessor class) also loads the FAP and WAV file produced automatically by issuing proper Tasks.

Parameters:
param1 is the script string to process
param2 is the name of script processor Notification::kError is sent on error and Notification::kStarted is sent on start and Notification::kFinished when finished, to the client.

Reimplemented from XFaceApp::TaskHandlerBase.

bool XFaceApp::ApplicationBase::query const QUERY q  ) 
 

Provides basic query mechanism.

Todo:
The mechanism can be improved and reverted to Task/Notification type easily. Or at least we can add a new Task type for QUERY and implement handlers.

virtual void XFaceApp::ApplicationBase::renderBegin  )  const [inline, protected, virtual]
 

Some GUI libraries (wxWidgets, SDL, MFC) for OpenGL windowing operation require pre and especially post processing for double buffering. Derived classes should re-implement these empty methods properly

virtual void XFaceApp::ApplicationBase::renderEnd  )  const [inline, protected, virtual]
 

Some GUI libraries (wxWidgets, SDL, MFC) for OpenGL windowing operation require pre and especially post processing for double buffering. Derived classes should re-implement these empty methods properly

unsigned long XFaceApp::ApplicationBase::synchronize bool  bStart  )  [protected]
 

Synchronizes the animation to frames per seconds required by current FAP being played back.

Todo:
Check this function, not tested extensively. Especially in debug mode, we seem to have some problem, should skip the frames, but not as it seems, lagging animation.

virtual bool XFaceApp::ApplicationBase::yield  )  [protected, pure virtual]
 

You should provide an application specific (probably external library dependent) yield functionality which enables processing the task queue, while a task is already being done. We use wxWidgets yield method to achieve this in XfacePlayer implementation (see wxFace class).


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