#include <ThreadFunctor.h>
Inheritance diagram for vpr::ThreadRunFunctor:


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... | |
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.
|
|||||
|
Definition at line 174 of file ThreadFunctor.h. |
|
||||||||||
|
Definition at line 176 of file ThreadFunctor.h.
00176 : mObject(NULL), mFunction(NULL)
00177 {
00178 mObject = theObject;
00179 mFunction = &OBJ_TYPE::run;
00180 }
|
|
|||||||||
|
Definition at line 182 of file ThreadFunctor.h.
00183 {
00184 mObject = (OBJ_TYPE*) 0xDEADBEEF;
00185 // mFunction = (FunPtr) 0xDEADBEEF;
00186 }
|
|
||||||||||
|
Overloaded operator() used for invoking the function encapsulated by this object. This version takes an argument that is passed on to the function.
Implements vpr::BaseThreadFunctor. Definition at line 188 of file ThreadFunctor.h.
00189 {
00190 boost::ignore_unused_variable_warning(arg);
00191 (mObject->*mFunction)();
00192 }
|
|
|||||||||
|
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 }
|
|
||||||||||
|
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 }
|
|
|||||||||
|
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 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002