VTK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
vtkSocketController Class Reference

Process communication using Sockets. More...

#include <vtkSocketController.h>

Inheritance diagram for vtkSocketController:
[legend]
Collaboration diagram for vtkSocketController:
[legend]

Public Types

enum  Consts { ENDIAN_TAG =1010580540, IDTYPESIZE_TAG =1027423549, VERSION_TAG =1044266558, HASH_TAG =0x3f3f3f3f }
 
typedef vtkMultiProcessController Superclass
 
- Public Types inherited from vtkMultiProcessController
enum  Errors { RMI_NO_ERROR, RMI_TAG_ERROR, RMI_ARG_ERROR }
 
enum  Consts { ANY_SOURCE = -1, INVALID_SOURCE = -2 }
 
enum  Tags { RMI_TAG = 1, RMI_ARG_TAG = 2, BREAK_RMI_TAG = 3, XML_WRITER_DATA_INFO = 4 }
 
typedef vtkObject Superclass
 

Public Member Functions

virtual int IsA (const char *type)
 
vtkSocketControllerNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent)
 
void SingleMethodExecute ()
 
void MultipleMethodExecute ()
 
void CreateOutputWindow ()
 
virtual int WaitForConnection (int port)
 
virtual void CloseConnection ()
 
virtual int ConnectTo (const char *hostName, int port)
 
int GetSwapBytesInReceivedData ()
 
void SetCommunicator (vtkSocketCommunicator *comm)
 
vtkMultiProcessControllerCreateCompliantController ()
 
virtual void Initialize (int *argc, char ***argv, int)
 
virtual void Initialize (int *argc, char ***argv)
 
virtual void Initialize ()
 
void Finalize ()
 
void Finalize (int)
 
- Public Member Functions inherited from vtkMultiProcessController
vtkMultiProcessControllerNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent)
 
virtual void Initialize (int *vtkNotUsed(argc), char ***vtkNotUsed(argv))=0
 
void SetSingleMethod (vtkProcessFunctionType, void *data)
 
int GetLocalProcessId ()
 
virtual unsigned long AddRMI (vtkRMIFunctionType, void *localArg, int tag)
 
virtual int RemoveFirstRMI (int tag)
 
virtual int RemoveRMI (unsigned long id)
 
virtual unsigned long AddRMICallback (vtkRMIFunctionType, void *localArg, int tag)
 
virtual void RemoveAllRMICallbacks (int tag)
 
virtual bool RemoveRMICallback (unsigned long id)
 
void TriggerRMI (int remoteProcessId, void *arg, int argLength, int tag)
 
void TriggerBreakRMIs ()
 
void Barrier ()
 
vtkIdType GetCount ()
 
virtual void Initialize (int *vtkNotUsed(argc), char ***vtkNotUsed(argv), int initializedExternally)=0
 
void SetNumberOfProcesses (int num)
 
int GetNumberOfProcesses ()
 
void SetSingleProcessObject (vtkProcess *p)
 
void SetMultipleMethod (int index, vtkProcessFunctionType, void *data)
 
virtual vtkMultiProcessControllerCreateSubController (vtkProcessGroup *group)
 
virtual vtkMultiProcessControllerPartitionController (int localColor, int localKey)
 
virtual void RemoveRMI (vtkRMIFunctionType f, void *arg, int tag)
 
void TriggerRMI (int remoteProcessId, const char *arg, int tag)
 
void TriggerRMI (int remoteProcessId, int tag)
 
void TriggerRMIOnAllChildren (void *arg, int argLength, int tag)
 
void TriggerRMIOnAllChildren (const char *arg, int tag)
 
void TriggerRMIOnAllChildren (int tag)
 
int ProcessRMIs (int reportErrors, int dont_loop=0)
 
int ProcessRMIs ()
 
virtual void SetBreakFlag (int)
 
virtual int GetBreakFlag ()
 
virtual vtkCommunicatorGetCommunicator ()
 
int Send (const int *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (const unsigned int *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (const unsigned long *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (const char *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (const unsigned char *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (const float *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (const double *data, vtkIdType length, int remoteProcessId, int tag)
 
int Send (vtkDataObject *data, int remoteId, int tag)
 
int Send (vtkDataArray *data, int remoteId, int tag)
 
int Send (const vtkMultiProcessStream &stream, int remoteId, int tag)
 
int Receive (int *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (unsigned int *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (unsigned long *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (char *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (unsigned char *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (float *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (double *data, vtkIdType maxlength, int remoteProcessId, int tag)
 
int Receive (vtkDataObject *data, int remoteId, int tag)
 
int Receive (vtkDataArray *data, int remoteId, int tag)
 
int Receive (vtkMultiProcessStream &stream, int remoteId, int tag)
 
vtkDataObject * ReceiveDataObject (int remoteId, int tag)
 
int Broadcast (int *data, vtkIdType length, int srcProcessId)
 
int Broadcast (unsigned int *data, vtkIdType length, int srcProcessId)
 
int Broadcast (unsigned long *data, vtkIdType length, int srcProcessId)
 
int Broadcast (unsigned char *data, vtkIdType length, int srcProcessId)
 
int Broadcast (char *data, vtkIdType length, int srcProcessId)
 
int Broadcast (float *data, vtkIdType length, int srcProcessId)
 
int Broadcast (double *data, vtkIdType length, int srcProcessId)
 
int Broadcast (vtkDataObject *data, int srcProcessId)
 
int Broadcast (vtkDataArray *data, int srcProcessId)
 
int Broadcast (vtkMultiProcessStream &stream, int srcProcessId)
 
int Gather (const int *sendBuffer, int *recvBuffer, vtkIdType length, int destProcessId)
 
int Gather (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length, int destProcessId)
 
int Gather (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length, int destProcessId)
 
int Gather (const char *sendBuffer, char *recvBuffer, vtkIdType length, int destProcessId)
 
int Gather (const float *sendBuffer, float *recvBuffer, vtkIdType length, int destProcessId)
 
int Gather (const double *sendBuffer, double *recvBuffer, vtkIdType length, int destProcessId)
 
int Gather (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, int destProcessId)
 
int GatherV (const int *sendBuffer, int *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (const char *sendBuffer, char *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (const float *sendBuffer, float *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (const double *sendBuffer, double *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId)
 
int GatherV (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, int destProcessId)
 
int Scatter (const int *sendBuffer, int *recvBuffer, vtkIdType length, int srcProcessId)
 
int Scatter (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length, int srcProcessId)
 
int Scatter (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length, int srcProcessId)
 
int Scatter (const char *sendBuffer, char *recvBuffer, vtkIdType length, int srcProcessId)
 
int Scatter (const float *sendBuffer, float *recvBuffer, vtkIdType length, int srcProcessId)
 
int Scatter (const double *sendBuffer, double *recvBuffer, vtkIdType length, int srcProcessId)
 
int Scatter (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, int srcProcessId)
 
int ScatterV (const int *sendBuffer, int *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int srcProcessId)
 
int ScatterV (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int srcProcessId)
 
int ScatterV (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int srcProcessId)
 
int ScatterV (const char *sendBuffer, char *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int srcProcessId)
 
int ScatterV (const float *sendBuffer, float *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int srcProcessId)
 
int ScatterV (const double *sendBuffer, double *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int srcProcessId)
 
int AllGather (const int *sendBuffer, int *recvBuffer, vtkIdType length)
 
int AllGather (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length)
 
int AllGather (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length)
 
int AllGather (const char *sendBuffer, char *recvBuffer, vtkIdType length)
 
int AllGather (const float *sendBuffer, float *recvBuffer, vtkIdType length)
 
int AllGather (const double *sendBuffer, double *recvBuffer, vtkIdType length)
 
int AllGather (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer)
 
int AllGatherV (const int *sendBuffer, int *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (const char *sendBuffer, char *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (const float *sendBuffer, float *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (const double *sendBuffer, double *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, vtkIdType *recvLengths, vtkIdType *offsets)
 
int AllGatherV (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer)
 
int Reduce (const int *sendBuffer, int *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (const unsigned int *sendBuffer, unsigned int *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (const char *sendBuffer, char *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (const float *sendBuffer, float *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (const double *sendBuffer, double *recvBuffer, vtkIdType length, int operation, int destProcessId)
 
int Reduce (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, int operation, int destProcessId)
 
int Reduce (const int *sendBuffer, int *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation, int destProcessId)
 
int Reduce (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation, int destProcessId)
 
int Reduce (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation, int destProcessId)
 
int Reduce (const char *sendBuffer, char *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation, int destProcessId)
 
int Reduce (const float *sendBuffer, float *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation, int destProcessId)
 
int Reduce (const double *sendBuffer, double *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation, int destProcessId)
 
int Reduce (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, vtkCommunicator::Operation *operation, int destProcessId)
 
int AllReduce (const int *sendBuffer, int *recvBuffer, vtkIdType length, int operation)
 
int AllReduce (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length, int operation)
 
int AllReduce (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length, int operation)
 
int AllReduce (const char *sendBuffer, char *recvBuffer, vtkIdType length, int operation)
 
int AllReduce (const float *sendBuffer, float *recvBuffer, vtkIdType length, int operation)
 
int AllReduce (const double *sendBuffer, double *recvBuffer, vtkIdType length, int operation)
 
int AllReduce (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, int operation)
 
int AllReduce (const int *sendBuffer, int *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation)
 
int AllReduce (const unsigned long *sendBuffer, unsigned long *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation)
 
int AllReduce (const unsigned char *sendBuffer, unsigned char *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation)
 
int AllReduce (const char *sendBuffer, char *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation)
 
int AllReduce (const float *sendBuffer, float *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation)
 
int AllReduce (const double *sendBuffer, double *recvBuffer, vtkIdType length, vtkCommunicator::Operation *operation)
 
int AllReduce (vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, vtkCommunicator::Operation *operation)
 

Static Public Member Functions

static vtkSocketControllerNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSocketControllerSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkMultiProcessController
static int IsTypeOf (const char *type)
 
static vtkMultiProcessControllerSafeDownCast (vtkObjectBase *o)
 
static vtkMultiProcessControllerGetGlobalController ()
 
static void SetGlobalController (vtkMultiProcessController *controller)
 
static int GetBreakRMITag ()
 
static int GetRMITag ()
 
static int GetRMIArgTag ()
 

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 
 vtkSocketController ()
 
 ~vtkSocketController ()
 
- Protected Member Functions inherited from vtkMultiProcessController
 vtkMultiProcessController ()
 
 ~vtkMultiProcessController ()
 
void GetMultipleMethod (int index, vtkProcessFunctionType &func, void *&data)
 
void ProcessRMI (int remoteProcessId, void *arg, int argLength, int rmiTag)
 
virtual vtkMultiProcessControllerGetLocalController ()
 
virtual void TriggerRMIInternal (int remoteProcessId, void *arg, int argLength, int rmiTag, bool propagate)
 

Static Protected Attributes

static int Initialized
 

Additional Inherited Members

- Protected Attributes inherited from vtkMultiProcessController
vtkProcessFunctionType SingleMethod
 
void * SingleData
 
int BreakFlag
 
int ForceDeepCopy
 
vtkOutputWindow * OutputWindow
 
vtkCommunicatorCommunicator
 
vtkCommunicatorRMICommunicator
 

Detailed Description

Process communication using Sockets.

This is a concrete implementation of vtkMultiProcessController. It supports one-to-one communication using sockets. Note that process 0 will always correspond to self and process 1 to the remote process. This class is best used with ports.

Bug:
Note that because process 0 will always correspond to self, this class breaks assumptions usually implied when using ad-hoc polymorphism. That is, the vtkSocketController will behave differently than other subclasses of vtkMultiProcessController. If you upcast vtkSocketController to vtkMultiProcessController and send it to a method that does not know that the object is actually a vtkSocketController, the object may not behave as intended. For example, if that oblivious class chose to identify a "root" based on the local process id, then both sides of the controller will think they are the root (and that will probably lead to deadlock). If you plan to upcast to vtkMultiProcessController, you should probably use the CreateCompliantController instead.
See Also
vtkMultiProcessController vtkSocketCommunicator vtkInputPort vtkOutputPort
Tests:
vtkSocketController (Tests)

Definition at line 51 of file vtkSocketController.h.

Member Typedef Documentation

Definition at line 55 of file vtkSocketController.h.

Member Enumeration Documentation

Enumerator
ENDIAN_TAG 
IDTYPESIZE_TAG 
VERSION_TAG 
HASH_TAG 

Definition at line 108 of file vtkSocketController.h.

Constructor & Destructor Documentation

vtkSocketController::vtkSocketController ( )
protected
vtkSocketController::~vtkSocketController ( )
protected

Member Function Documentation

static vtkSocketController* vtkSocketController::New ( )
static
static int vtkSocketController::IsTypeOf ( const char *  type)
static
virtual int vtkSocketController::IsA ( const char *  type)
virtual

Reimplemented from vtkMultiProcessController.

static vtkSocketController* vtkSocketController::SafeDownCast ( vtkObjectBase *  o)
static
virtual vtkObjectBase* vtkSocketController::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkMultiProcessController.

vtkSocketController* vtkSocketController::NewInstance ( ) const
void vtkSocketController::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual void vtkSocketController::Initialize ( int *  argc,
char ***  argv,
int   
)
inlinevirtual

This method is for initialiazing sockets. One of these is REQUIRED for Windows.

Definition at line 61 of file vtkSocketController.h.

virtual void vtkSocketController::Initialize ( int *  argc,
char ***  argv 
)
virtual

This method is for initialiazing sockets. One of these is REQUIRED for Windows.

virtual void vtkSocketController::Initialize ( )
inlinevirtual

This method is for initialiazing sockets. One of these is REQUIRED for Windows.

Definition at line 64 of file vtkSocketController.h.

void vtkSocketController::Finalize ( )
inlinevirtual

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 70 of file vtkSocketController.h.

void vtkSocketController::Finalize ( int  )
inlinevirtual

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 71 of file vtkSocketController.h.

void vtkSocketController::SingleMethodExecute ( )
inlinevirtual

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 75 of file vtkSocketController.h.

void vtkSocketController::MultipleMethodExecute ( )
inlinevirtual

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 78 of file vtkSocketController.h.

void vtkSocketController::CreateOutputWindow ( )
inlinevirtual

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 81 of file vtkSocketController.h.

virtual int vtkSocketController::WaitForConnection ( int  port)
virtual

Wait for connection on a given port, forwarded to the communicator

virtual void vtkSocketController::CloseConnection ( )
virtual

Close a connection, forwarded to the communicator

virtual int vtkSocketController::ConnectTo ( const char *  hostName,
int  port 
)
virtual

Open a connection to a give machine, forwarded to the communicator

int vtkSocketController::GetSwapBytesInReceivedData ( )
void vtkSocketController::SetCommunicator ( vtkSocketCommunicator comm)

Set the communicator used in normal and rmi communications.

vtkMultiProcessController* vtkSocketController::CreateCompliantController ( )

FOOLISH MORTALS! Thou hast forsaken the sacred laws of ad-hoc polymorphism when thou broke a critical assumption of the superclass (namely, each process has thine own id). The time frame to fix thy error has passed. Too much code has come to rely on this abhorrent behavior. Instead, we offer this gift: a method for creating an equivalent communicator with correct process id semantics. The calling code is responsible for deleting this controller.

Member Data Documentation

int vtkSocketController::Initialized
staticprotected

Definition at line 123 of file vtkSocketController.h.


The documentation for this class was generated from the following file: