Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound 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


Member Function Documentation

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.

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::Initialize int    argc,
char *    arcv[]
 

This method is for setting up the processes.

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.

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.

void vtkThreadedController::MultipleMethodExecute   [virtual]
 

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

Implements vtkMultiProcessController.

vtkThreadedController* vtkThreadedController::New   [static]
 

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

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.

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

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

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.

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

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

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

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.

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


The documentation for this class was generated from the following file:
Generated on Tue Mar 19 13:33:45 2002 for VTK by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002