Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

vpr::ThreadRunFunctor Class Template Reference

A variation on vpr::ThreadMemberFunctor that requires a class that implements the "runnable" concept. More...

#include <ThreadFunctor.h>

Inheritance diagram for vpr::ThreadRunFunctor:

Inheritance graph
[legend]
Collaboration diagram for vpr::ThreadRunFunctor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef void(OBJ_TYPE::* FunPtr )()

Public Methods

 ThreadRunFunctor (OBJ_TYPE *theObject)
virtual ~ThreadRunFunctor ()
void operator() (void *arg)
 Overloaded operator() used for invoking the function encapsulated by this object. More...

void operator() ()
 Overloaded operator() used for invoking the function encapsulated by this object. More...

virtual void setArg (void *arg)
 Sets the argument passed to the encapsulated function. More...

virtual bool isValid ()
 Function to see if we have a valid functor. More...


Detailed Description

template<typename OBJ_TYPE>
class vpr::ThreadRunFunctor< OBJ_TYPE >

A variation on vpr::ThreadMemberFunctor that requires a class that implements the "runnable" concept.

That is, the class must have a run() method with the following signature: void run(). No argument will be passed to the runnable object when its run() method is invoked. Instead, it is up to the class author to ensure that the object has all information it needs to do its job before the thread is spawned.

Definition at line 171 of file ThreadFunctor.h.


Member Typedef Documentation

template<typename OBJ_TYPE>
typedef void(OBJ_TYPE::* vpr::ThreadRunFunctor::FunPtr)()
 

Definition at line 174 of file ThreadFunctor.h.


Constructor & Destructor Documentation

template<typename OBJ_TYPE>
vpr::ThreadRunFunctor< OBJ_TYPE >::ThreadRunFunctor OBJ_TYPE *    theObject [inline]
 

Definition at line 176 of file ThreadFunctor.h.

00176                                          : mObject(NULL), mFunction(NULL)
00177    {
00178       mObject   = theObject;
00179       mFunction = &OBJ_TYPE::run;
00180    }

template<typename OBJ_TYPE>
virtual vpr::ThreadRunFunctor< OBJ_TYPE >::~ThreadRunFunctor   [inline, virtual]
 

Definition at line 182 of file ThreadFunctor.h.

00183    {
00184       mObject   = (OBJ_TYPE*) 0xDEADBEEF;
00185 //      mFunction = (FunPtr) 0xDEADBEEF;
00186    }


Member Function Documentation

template<typename OBJ_TYPE>
void vpr::ThreadRunFunctor< OBJ_TYPE >::operator() void *    arg [inline, virtual]
 

Overloaded operator() used for invoking the function encapsulated by this object.

This version takes an argument that is passed on to the function.

Parameters:
arg  The argument to be passed to the encapsulated function.

Implements vpr::BaseThreadFunctor.

Definition at line 188 of file ThreadFunctor.h.

00189    {
00190       boost::ignore_unused_variable_warning(arg);
00191       (mObject->*mFunction)();
00192    }

template<typename OBJ_TYPE>
void vpr::ThreadRunFunctor< OBJ_TYPE >::operator()   [inline, virtual]
 

Overloaded operator() used for invoking the function encapsulated by this object.

This version takes no argument and instead passes the argument given when this object was constructed.

Implements vpr::BaseThreadFunctor.

Definition at line 194 of file ThreadFunctor.h.

00195    {
00196       (mObject->*mFunction)();
00197    }

template<typename OBJ_TYPE>
virtual void vpr::ThreadRunFunctor< OBJ_TYPE >::setArg void *    arg [inline, virtual]
 

Sets the argument passed to the encapsulated function.

This will be used when the function is invoked through the overloaded operator().

Implements vpr::BaseThreadFunctor.

Definition at line 199 of file ThreadFunctor.h.

00200    {
00201       boost::ignore_unused_variable_warning(arg);
00202    }

template<typename OBJ_TYPE>
virtual bool vpr::ThreadRunFunctor< OBJ_TYPE >::isValid   [inline, virtual]
 

Function to see if we have a valid functor.

Implements vpr::BaseThreadFunctor.

Definition at line 204 of file ThreadFunctor.h.

References vprASSERT.

00205    {
00206       if ( (NULL == mObject) || ((OBJ_TYPE*) 0xDEADBEEF == mObject) )
00207       {
00208          vprASSERT(NULL != mObject);
00209          vprASSERT((OBJ_TYPE*)0xDEADBEEF != mObject);
00210          return false;
00211       }
00212       else if ( (NULL == mFunction) /* || ((FunPtr) 0xDEADBEEF == mFunction) */ )
00213       {
00214          return false;
00215       }
00216       else
00217       {
00218          return true;
00219       }
00220    }


The documentation for this class was generated from the following file:
Generated on Sun May 2 14:47:12 2004 for VR Juggler Portable Runtime by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002