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

vpr::ThreadMemberFunctor Class Template Reference

Member functor class. More...

#include <ThreadFunctor.h>

Inheritance diagram for vpr::ThreadMemberFunctor:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef void(OBJ_TYPE::* FunPtr )(void *)

Public Methods

 ThreadMemberFunctor (OBJ_TYPE *theObject, FunPtr func, void *arg=NULL)
virtual ~ThreadMemberFunctor ()
void operator() (void *arg)
 Overloaded operator() used for invoking the function encapsulated by this object. More...

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

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

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


Detailed Description

template<class OBJ_TYPE>
class vpr::ThreadMemberFunctor< OBJ_TYPE >

Member functor class.

This class allows non-static class member functions to be used as functors.

Definition at line 102 of file ThreadFunctor.h.


Member Typedef Documentation

template<class OBJ_TYPE>
typedef void(OBJ_TYPE::* vpr::ThreadMemberFunctor::FunPtr)(void*)
 

Definition at line 105 of file ThreadFunctor.h.

Referenced by vpr::ThreadMemberFunctor< ThreadPosix >::ThreadMemberFunctor.


Constructor & Destructor Documentation

template<class OBJ_TYPE>
vpr::ThreadMemberFunctor< OBJ_TYPE >::ThreadMemberFunctor OBJ_TYPE *    theObject,
FunPtr    func,
void *    arg = NULL
[inline]
 

Definition at line 107 of file ThreadFunctor.h.

00108    {
00109       mObject = theObject;
00110       mFunction = func;
00111       mArgument = arg;
00112    }

template<class OBJ_TYPE>
virtual vpr::ThreadMemberFunctor< OBJ_TYPE >::~ThreadMemberFunctor   [inline, virtual]
 

Definition at line 114 of file ThreadFunctor.h.

00115    {
00116       mObject = (OBJ_TYPE*)0xDEADBEEF;
00117       //mFunction = 0xDEADBEEF;
00118       mArgument = (void*)0xDEADBEEF;
00119    }


Member Function Documentation

template<class OBJ_TYPE>
void vpr::ThreadMemberFunctor< 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 121 of file ThreadFunctor.h.

00122    {
00123       (mObject->*mFunction)(arg);
00124    }

template<class OBJ_TYPE>
void vpr::ThreadMemberFunctor< OBJ_TYPE >::operator() void    [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 126 of file ThreadFunctor.h.

00127    {
00128       (mObject->*mFunction)(mArgument);
00129    }

template<class OBJ_TYPE>
void vpr::ThreadMemberFunctor< 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 131 of file ThreadFunctor.h.

00132    {
00133       mArgument = arg;
00134    }

template<class OBJ_TYPE>
bool vpr::ThreadMemberFunctor< OBJ_TYPE >::isValid   [inline, virtual]
 

Function to see if we have a valid functor.

Implements vpr::BaseThreadFunctor.

Definition at line 136 of file ThreadFunctor.h.

00137    {
00138       if ( (NULL == mObject) || ((OBJ_TYPE*)0xDEADBEEF == mObject) )
00139       {
00140          vprASSERT( NULL != mObject);
00141          vprASSERT( (OBJ_TYPE*)0xDEADBEEF != mObject);
00142          return false;
00143       }
00144       /*
00145       else if (NULL == mFunction)
00146       {
00147          return false;
00148       }
00149       */
00150       else
00151       {
00152          return true;
00153       }
00154    }


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