vtkSocketController Class Reference

#include <vtkSocketController.h>

Inheritance diagram for vtkSocketController:

Inheritance graph
[legend]
Collaboration diagram for vtkSocketController:

Collaboration graph
[legend]

List of all members.


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 50 of file vtkSocketController.h.


Public Types

enum  Consts { ENDIAN_TAG = 1010580540, IDTYPESIZE_TAG = 1027423549, VERSION_TAG = 1044266558 }
typedef vtkMultiProcessController Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
void SingleMethodExecute ()
void MultipleMethodExecute ()
void CreateOutputWindow ()
virtual int WaitForConnection (int port)
virtual void CloseConnection ()
virtual int ConnectTo (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)

Static Public Member Functions

static vtkSocketControllerNew ()
static int IsTypeOf (const char *type)
static vtkSocketControllerSafeDownCast (vtkObject *o)

Protected Member Functions

 vtkSocketController ()
 ~vtkSocketController ()

Static Protected Attributes

static int Initialized

Member Typedef Documentation

Reimplemented from vtkMultiProcessController.

Definition at line 54 of file vtkSocketController.h.


Member Enumeration Documentation

Enumerator:
ENDIAN_TAG 
IDTYPESIZE_TAG 
VERSION_TAG 

Reimplemented from vtkMultiProcessController.

Definition at line 107 of file vtkSocketController.h.


Constructor & Destructor Documentation

vtkSocketController::vtkSocketController (  )  [protected]

vtkSocketController::~vtkSocketController (  )  [protected]


Member Function Documentation

static vtkSocketController* vtkSocketController::New (  )  [static]

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

Reimplemented from vtkObject.

virtual const char* vtkSocketController::GetClassName (  )  [virtual]

Reimplemented from vtkMultiProcessController.

static int vtkSocketController::IsTypeOf ( const char *  name  )  [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 vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

virtual int vtkSocketController::IsA ( const char *  name  )  [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 vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

static vtkSocketController* vtkSocketController::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkMultiProcessController.

void vtkSocketController::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.

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

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

Definition at line 60 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 (  )  [inline, virtual]

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

Definition at line 63 of file vtkSocketController.h.

void vtkSocketController::Finalize (  )  [inline, virtual]

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 69 of file vtkSocketController.h.

void vtkSocketController::Finalize ( int   )  [inline, virtual]

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 70 of file vtkSocketController.h.

void vtkSocketController::SingleMethodExecute (  )  [inline, virtual]

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 74 of file vtkSocketController.h.

void vtkSocketController::MultipleMethodExecute (  )  [inline, virtual]

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 77 of file vtkSocketController.h.

void vtkSocketController::CreateOutputWindow (  )  [inline, virtual]

Does not apply to sockets. Does nothing.

Implements vtkMultiProcessController.

Definition at line 80 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 ( 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 [static, protected]

Definition at line 121 of file vtkSocketController.h.


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

Generated on Sat Dec 27 13:50:17 2008 for VTK by  doxygen 1.5.6