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

vtkThreadedController Class Reference

Allows communication between running threads. More...

#include <vtkThreadedController.h>

Inheritance diagram for vtkThreadedController:

Inheritance graph
[legend]
Collaboration diagram for vtkThreadedController:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
void Initialize (int argc, char *arcv[])
virtual int GetLocalProcessId ()
void SingleMethodExecute ()
void MultipleMethodExecute ()
int Send (vtkDataObject *data, int remoteProcessId, int tag)
int Send (int *data, int length, int remoteProcessId, int tag)
int Send (unsigned long *data, int length, int remoteProcessId, int tag)
int Send (char *data, int length, int remoteProcessId, int tag)
int Send (float *data, int length, int remoteProcessId, int tag)
int Receive (vtkDataObject *data, int remoteProcessId, int tag)
int Receive (int *data, int length, int remoteProcessId, int tag)
int Receive (unsigned long *data, int length, int remoteProcessId, int tag)
int Receive (char *data, int length, int remoteProcessId, int tag)
int Receive (float *data, int length, int remoteProcessId, int tag)
void Start (int threadIdx)

Static Public Methods

vtkThreadedController * New ()
int IsTypeOf (const char *type)
vtkThreadedController * SafeDownCast (vtkObject *o)

Protected Methods

 vtkThreadedController ()
 ~vtkThreadedController ()
 vtkThreadedController (const vtkThreadedController &)
void operator= (const vtkThreadedController &)
void CreateProcessControllers ()
vtkThreadedControllerMessage * NewMessage (vtkDataObject *object, void *data, int dataLength)
void DeleteMessage (vtkThreadedControllerMessage *message)
void AddMessage (vtkThreadedControllerMessage *message)
vtkThreadedControllerMessage * FindMessage (int sendId, int tag)
int Send (vtkDataObject *object, void *data, int dataLength, int remoteProcessId, int tag)
int Receive (vtkDataObject *object, void *data, int dataLength, int remoteProcessId, int tag)
vtkMultiProcessControllerGetLocalController ()

Protected Attributes

vtkThreadedController * Controllers [VTK_MP_CONTROLLER_MAX_PROCESSES]
int LocalProcessId
int WaitingForId
vtkMultiThreaderMultiThreader
int MultipleMethodFlag
vtkMutexLockMessageListLock
vtkMutexLockGate
vtkThreadedControllerMessage * MessageListStart
vtkThreadedControllerMessage * MessageListEnd
FILE * LogFile

Detailed Description

Allows communication between running threads.

Date:
2000/12/10 20:08:27
Revision:
1.14

vtkThreadedController just uses a vtkMultiThreader to spawn threads. It the implements sends and receives using shared memory and reference counting.

Unfortunately, as this is written, it is not thread safe. All threads use the same controller object, so operations like adding an RMI could potentially conflict. We need to have our own RegisterAndGetGlobalController method to create different controllers for each thread. This would also simplify the GetLocalProcessId methods.

See also:
vtkDownStreamPort vtkUpStreamPort vtkMultiThreader vtkMultiProcessController
Examples:
vtkThreadedController (examples)

Definition at line 72 of file vtkThreadedController.h.


Constructor & Destructor Documentation

vtkThreadedController::vtkThreadedController   [protected]
 

vtkThreadedController::~vtkThreadedController   [protected]
 

vtkThreadedController::vtkThreadedController const vtkThreadedController &    [inline, protected]
 

Definition at line 125 of file vtkThreadedController.h.


Member Function Documentation

vtkThreadedController* vtkThreadedController::New   [static]
 

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkMultiProcessController.

virtual const char* vtkThreadedController::GetClassName   [virtual]
 

Return the class name as a string. This method is defined in all subclasses of vtkObject with the vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::IsTypeOf const char *    type [static]
 

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

virtual int vtkThreadedController::IsA const char *    type [virtual]
 

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

vtkThreadedController* vtkThreadedController::SafeDownCast vtkObject   o [static]
 

Will cast the supplied object to vtkObject* is this is a safe operation (i.e., a safe downcast); otherwise NULL is returned. This method is defined in all subclasses of vtkObject with the vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

void vtkThreadedController::PrintSelf ostream &    os,
vtkIndent    indent
[virtual]
 

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkMultiProcessController.

void vtkThreadedController::Initialize int    argc,
char *    arcv[]
 

This method is for setting up the processes.

virtual int vtkThreadedController::GetLocalProcessId   [virtual]
 

This method returns an integer from 0 to (NumberOfProcesses-1) indicating which process we are in. Note: The correct controller is passed as an argument to the initial function (SingleMethod/MultipleMethod). Calling this method on another controller may give wrong results.

Reimplemented from vtkMultiProcessController.

void vtkThreadedController::SingleMethodExecute   [virtual]
 

Execute the SingleMethod (as define by SetSingleMethod) using this->NumberOfProcesses processes. This will only return when all the processes finish executing their methods.

Reimplemented from vtkMultiProcessController.

void vtkThreadedController::MultipleMethodExecute   [virtual]
 

Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required this->NumberOfProcesses methods) using this->NumberOfProcesses processes.

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Send vtkDataObject   data,
int    remoteProcessId,
int    tag
[virtual]
 

This method sends data to another process. Tag eliminates ambiguity and is used to match sends with receives.

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Send int *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Subclass have to supply these methods to send various arrays of data.

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Send unsigned long *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Send char *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Send float *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Receive vtkDataObject   data,
int    remoteProcessId,
int    tag
[virtual]
 

This method receives data from a corresponding send. It blocks until the receive is finished.

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Receive int *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Subclass have to supply these methods to receive various arrays of data. The methods also have to support a remoteProcessId of VTK_MP_CONTROLLER_ANY_SOURCE

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Receive unsigned long *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Receive char *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Reimplemented from vtkMultiProcessController.

int vtkThreadedController::Receive float *    data,
int    length,
int    remoteProcessId,
int    tag
[virtual]
 

Reimplemented from vtkMultiProcessController.

void vtkThreadedController::Start int    threadIdx
 

First method called after threads are spawned. It is public because the function vtkThreadedControllerStart is not a friend yet. You should not call this method.

void vtkThreadedController::operator= const vtkThreadedController &    [inline, protected]
 

Definition at line 126 of file vtkThreadedController.h.

void vtkThreadedController::CreateProcessControllers   [protected]
 

vtkThreadedControllerMessage* vtkThreadedController::NewMessage vtkDataObject   object,
void *    data,
int    dataLength
[protected]
 

void vtkThreadedController::DeleteMessage vtkThreadedControllerMessage *    message [protected]
 

void vtkThreadedController::AddMessage vtkThreadedControllerMessage *    message [protected]
 

vtkThreadedControllerMessage* vtkThreadedController::FindMessage int    sendId,
int    tag
[protected]
 

int vtkThreadedController::Send vtkDataObject   object,
void *    data,
int    dataLength,
int    remoteProcessId,
int    tag
[protected]
 

int vtkThreadedController::Receive vtkDataObject   object,
void *    data,
int    dataLength,
int    remoteProcessId,
int    tag
[protected]
 

vtkMultiProcessController* vtkThreadedController::GetLocalController   [protected, virtual]
 

Reimplemented from vtkMultiProcessController.


Member Data Documentation

vtkThreadedController* vtkThreadedController::Controllers[VTK_MP_CONTROLLER_MAX_PROCESSES] [protected]
 

Definition at line 136 of file vtkThreadedController.h.

int vtkThreadedController::LocalProcessId [protected]
 

Reimplemented from vtkMultiProcessController.

Definition at line 147 of file vtkThreadedController.h.

int vtkThreadedController::WaitingForId [protected]
 

Definition at line 148 of file vtkThreadedController.h.

vtkMultiThreader* vtkThreadedController::MultiThreader [protected]
 

Definition at line 150 of file vtkThreadedController.h.

int vtkThreadedController::MultipleMethodFlag [protected]
 

Definition at line 152 of file vtkThreadedController.h.

vtkMutexLock* vtkThreadedController::MessageListLock [protected]
 

Definition at line 157 of file vtkThreadedController.h.

vtkMutexLock* vtkThreadedController::Gate [protected]
 

Definition at line 161 of file vtkThreadedController.h.

vtkThreadedControllerMessage* vtkThreadedController::MessageListStart [protected]
 

Definition at line 164 of file vtkThreadedController.h.

vtkThreadedControllerMessage* vtkThreadedController::MessageListEnd [protected]
 

Definition at line 165 of file vtkThreadedController.h.

FILE* vtkThreadedController::LogFile [protected]
 

Definition at line 168 of file vtkThreadedController.h.


The documentation for this class was generated from the following file:
Generated on Wed Nov 21 13:00:50 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001