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

vpr::ThreadNonMemberFunctor Class Reference

Nonmember functor class. More...

#include <ThreadFunctor.h>

Inheritance diagram for vpr::ThreadNonMemberFunctor:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef void(* NonMemFunPtr )(void *)

Public Methods

 ThreadNonMemberFunctor (NonMemFunPtr f, void *a=NULL)
 Constructor. More...

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

virtual 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...


Public Attributes

NonMemFunPtr mFunc
 Thread startup function (C++ linkage). More...

void * mArgument
 Argument to thread startup function. More...


Detailed Description

Nonmember functor class.

Converts a non-member function or a static class member function into a functor.

Definition at line 232 of file ThreadFunctor.h.


Member Typedef Documentation

typedef void(* vpr::ThreadNonMemberFunctor::NonMemFunPtr)(void*)
 

Definition at line 235 of file ThreadFunctor.h.

Referenced by ThreadNonMemberFunctor.


Constructor & Destructor Documentation

vpr::ThreadNonMemberFunctor::ThreadNonMemberFunctor NonMemFunPtr    f,
void *    a = NULL
[inline]
 

Constructor.

Parameters:
f  A pointer to a function that is not a class member.
a  A pointer to an argument to be passed to the function. This argument is optional and defaults to NULL.

Definition at line 244 of file ThreadFunctor.h.

References mArgument, mFunc, and NonMemFunPtr.

00245       : mFunc(f), mArgument(a)
00246    {
00247       ;
00248    }

virtual vpr::ThreadNonMemberFunctor::~ThreadNonMemberFunctor   [inline, virtual]
 

Definition at line 250 of file ThreadFunctor.h.

References mArgument, and mFunc.

00251    {
00252       mFunc = (NonMemFunPtr)0xDEADBEEF;
00253       mArgument = (void*)0xDEADBEEF;
00254    }


Member Function Documentation

virtual void vpr::ThreadNonMemberFunctor::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 256 of file ThreadFunctor.h.

00257    {
00258       (*mFunc)(arg);
00259    }

virtual void vpr::ThreadNonMemberFunctor::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 261 of file ThreadFunctor.h.

00262    {
00263       (*mFunc)(mArgument);
00264    }

void vpr::ThreadNonMemberFunctor::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 266 of file ThreadFunctor.h.

References mArgument.

00267    {
00268       mArgument = arg;
00269    }

bool vpr::ThreadNonMemberFunctor::isValid   [inline, virtual]
 

Function to see if we have a valid functor.

Implements vpr::BaseThreadFunctor.

Definition at line 271 of file ThreadFunctor.h.

References mArgument, mFunc, and vprASSERT.

00272    {
00273       vprASSERT(mFunc != NULL);
00274       vprASSERT( mArgument != (void*)0xDEADBEEF);
00275       return( (mFunc != NULL) && (mArgument != (void*)0xDEADBEEF) );
00276    }


Member Data Documentation

NonMemFunPtr vpr::ThreadNonMemberFunctor::mFunc
 

Thread startup function (C++ linkage).

Definition at line 280 of file ThreadFunctor.h.

Referenced by isValid, ThreadNonMemberFunctor, and ~ThreadNonMemberFunctor.

void* vpr::ThreadNonMemberFunctor::mArgument
 

Argument to thread startup function.

Definition at line 281 of file ThreadFunctor.h.

Referenced by isValid, setArg, ThreadNonMemberFunctor, and ~ThreadNonMemberFunctor.


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