xvr2::BackgroundFunction Class Reference

#include <xvr2/BackgroundFunction.h>

Inheritance diagram for xvr2::BackgroundFunction:

Inheritance graph
[legend]

List of all members.


Detailed Description

Interface class for functions which are to be ran in the background as a separate thread subprocess.

Definition at line 25 of file BackgroundFunction.h.


Public Member Functions

 BackgroundFunction ()
 Default constructor, it does nothing.
virtual ~BackgroundFunction ()
 Destructor that destroys nothing.
virtual void operator() (void)=0
 Default functor function, in fact this method is the one to be run in the background, please override it in your implementation classes.
virtual void onStart ()
 Routine to be called when the BackgroundFunction is about to be called (before it starts).
virtual void onTerminate ()
 Routine to be called after the BackgroundFunction has finished.
virtual const char * getClassName ()
 Returns the name of the current class.
virtual std::string toString ()
void registerFinalizer (FinalizerCallback *f_cb)
 Registers a new finalization callback to be called when thread finalizes.
void registerCancellationCB (FinalizerCallback *f_cb)
 Registers a new cancellation callback to be called in the event of thread cancellation only.
void callFinalizers ()
 Calls each finalizer in reverse registration order.
void callCancellationCallbacks ()
 Calls each cancellation callback in reverse registration order.
void removeCancellationCBs ()
 Removes all cancellation callbacks without executing them.

Static Public Member Functions

static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Public Attributes

UInt64 id
SharedVar< bool > called
 Tells wheter the function has been called already, it moves from false to true just once in the lifetime of a BackgroundFunction.
SharedVar< bool > terminated

Protected Attributes

std::string __cls_name
std::deque< FinalizerCallback * > finalizers
 Doubly-ended queue which stores finalization callbacks.
std::deque< FinalizerCallback * > cancelCBs
 Doubly-ended queue which stores cancellation callbacks.
std::string __cls_name

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)
std::ostream & operator<< (std::ostream &stream, const Object &s)

Constructor & Destructor Documentation

xvr2::BackgroundFunction::BackgroundFunction (  ) 

Default constructor, it does nothing.

virtual xvr2::BackgroundFunction::~BackgroundFunction (  )  [virtual]

Destructor that destroys nothing.


Member Function Documentation

virtual void xvr2::BackgroundFunction::operator() ( void   )  [pure virtual]

Default functor function, in fact this method is the one to be run in the background, please override it in your implementation classes.

virtual void xvr2::BackgroundFunction::onStart (  )  [virtual]

Routine to be called when the BackgroundFunction is about to be called (before it starts).

virtual void xvr2::BackgroundFunction::onTerminate (  )  [virtual]

Routine to be called after the BackgroundFunction has finished.

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

virtual std::string xvr2::Object::toString (  )  [virtual, inherited]

void xvr2::ThreadFinalizator::registerFinalizer ( FinalizerCallback f_cb  )  [inherited]

Registers a new finalization callback to be called when thread finalizes.

void xvr2::ThreadFinalizator::registerCancellationCB ( FinalizerCallback f_cb  )  [inherited]

Registers a new cancellation callback to be called in the event of thread cancellation only.

void xvr2::ThreadFinalizator::callFinalizers (  )  [inherited]

Calls each finalizer in reverse registration order.

Warning:
DO NOT CALL THIS METHOD DIRECTLY

void xvr2::ThreadFinalizator::callCancellationCallbacks (  )  [inherited]

Calls each cancellation callback in reverse registration order.

Warning:
DO NOT CALL THIS METHOD DIRECTLY

void xvr2::ThreadFinalizator::removeCancellationCBs (  )  [inherited]

Removes all cancellation callbacks without executing them.

Warning:
DO NOT CALL THIS METHOD DIRECTLY

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

Definition at line 28 of file BackgroundFunction.h.

Tells wheter the function has been called already, it moves from false to true just once in the lifetime of a BackgroundFunction.

You should never modify its value.

Definition at line 32 of file BackgroundFunction.h.

Definition at line 33 of file BackgroundFunction.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.

std::deque<FinalizerCallback *> xvr2::ThreadFinalizator::finalizers [protected, inherited]

Doubly-ended queue which stores finalization callbacks.

Definition at line 27 of file ThreadFinalizator.h.

std::deque<FinalizerCallback *> xvr2::ThreadFinalizator::cancelCBs [protected, inherited]

Doubly-ended queue which stores cancellation callbacks.

Definition at line 29 of file ThreadFinalizator.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


The documentation for this class was generated from the following file:

Generated on Fri Jun 20 22:55:50 2008 for X-VR2 SDK by  doxygen 1.5.5