vtkSocketCommunicator Class Reference

#include <vtkSocketCommunicator.h>

Inheritance diagram for vtkSocketCommunicator:

Inheritance graph
[legend]
Collaboration diagram for vtkSocketCommunicator:

Collaboration graph
[legend]

List of all members.


Detailed Description

Process communication using Sockets.

This is a concrete implementation of vtkCommunicator which supports interprocess communication using BSD style sockets. It supports byte swapping for the communication of machines with different endianness.

Warning:
Communication between 32 bit and 64 bit systems is not fully supported. If a type does not have the same length on both systems, this communicator can not be used to transfer data of that type.
See also:
vtkCommunicator vtkSocketController
Events:
vtkCommand::WrongTagEvent
Tests:
vtkSocketCommunicator (Tests)

Definition at line 61 of file vtkSocketCommunicator.h.


Public Types

typedef vtkCommunicator Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual void CloseConnection ()
virtual int ConnectTo (char *hostName, int port)
int GetIsConnected ()
virtual void SetNumberOfProcesses (int num)
virtual void Barrier ()
int Handshake ()
int ServerSideHandshake ()
int ClientSideHandshake ()
virtual int WaitForConnection (int port)
virtual int WaitForConnection (vtkServerSocket *socket, unsigned long msec=0)
virtual int GetSwapBytesInReceivedData ()
virtual int SendVoidArray (const void *data, vtkIdType length, int type, int remoteHandle, int tag)
virtual int ReceiveVoidArray (void *data, vtkIdType length, int type, int remoteHandle, int tag)
virtual int BroadcastVoidArray (void *data, vtkIdType length, int type, int srcProcessId)
virtual int GatherVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int destProcessId)
virtual int GatherVVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int type, int destProcessId)
virtual int ScatterVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int srcProcessId)
virtual int ScatterVVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int type, int srcProcessId)
virtual int AllGatherVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type)
virtual int AllGatherVVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int type)
virtual int ReduceVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int operation, int destProcessId)
virtual int ReduceVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, Operation *operation, int destProcessId)
virtual int AllReduceVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int operation)
virtual int AllReduceVoidArray (const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, Operation *operation)
virtual void SetPerformHandshake (int)
virtual void PerformHandshakeOn ()
virtual void PerformHandshakeOff ()
virtual int GetPerformHandshake ()
virtual void SetLogStream (ostream *stream)
virtual ostream * GetLogStream ()
virtual int LogToFile (const char *name)
virtual int LogToFile (const char *name, int append)
virtual void SetReportErrors (int)
virtual int GetReportErrors ()
virtual vtkClientSocketGetSocket ()
void SetSocket (vtkClientSocket *)
virtual int GetIsServer ()

Static Public Member Functions

static vtkSocketCommunicatorNew ()
static int IsTypeOf (const char *type)
static vtkSocketCommunicatorSafeDownCast (vtkObject *o)
static int GetVersion ()

Protected Member Functions

 vtkSocketCommunicator ()
 ~vtkSocketCommunicator ()
int SendTagged (const void *data, int wordSize, int numWords, int tag, const char *logName)
int ReceiveTagged (void *data, int wordSize, int numWords, int tag, const char *logName)
int ReceivePartialTagged (void *data, int wordSize, int numWords, int tag, const char *logName)
void LogTagged (const char *name, const void *data, int wordSize, int numWords, int tag, const char *logName)
int CheckForErrorInternal (int id)

Protected Attributes

vtkClientSocketSocket
int SwapBytesInReceivedData
int RemoteHas64BitIds
int PerformHandshake
int IsServer
int ReportErrors
ofstream * LogFile
ostream * LogStream

Member Typedef Documentation

Reimplemented from vtkCommunicator.

Definition at line 65 of file vtkSocketCommunicator.h.


Constructor & Destructor Documentation

vtkSocketCommunicator::vtkSocketCommunicator (  )  [protected]

vtkSocketCommunicator::~vtkSocketCommunicator (  )  [protected]


Member Function Documentation

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

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

Reimplemented from vtkObject.

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

Reimplemented from vtkCommunicator.

static int vtkSocketCommunicator::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 vtkCommunicator.

virtual int vtkSocketCommunicator::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 vtkCommunicator.

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

Reimplemented from vtkCommunicator.

void vtkSocketCommunicator::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 vtkCommunicator.

virtual int vtkSocketCommunicator::WaitForConnection ( int  port  )  [virtual]

Wait for connection on a given port. These methods return 1 on success, 0 on error.

virtual int vtkSocketCommunicator::WaitForConnection ( vtkServerSocket socket,
unsigned long  msec = 0 
) [virtual]

Wait for connection on a given port. These methods return 1 on success, 0 on error.

virtual void vtkSocketCommunicator::CloseConnection (  )  [virtual]

Close a connection.

virtual int vtkSocketCommunicator::ConnectTo ( char *  hostName,
int  port 
) [virtual]

Open a connection to host.

virtual int vtkSocketCommunicator::GetSwapBytesInReceivedData (  )  [virtual]

Returns 1 if bytes must be swapped in received ints, floats, etc

int vtkSocketCommunicator::GetIsConnected (  ) 

Is the communicator connected?.

virtual void vtkSocketCommunicator::SetNumberOfProcesses ( int  num  )  [virtual]

Set the number of processes you will be using.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::SendVoidArray ( const void *  data,
vtkIdType  length,
int  type,
int  remoteHandle,
int  tag 
) [virtual]

Performs the actual communication. You will usually use the convenience Send functions defined in the superclass.

Implements vtkCommunicator.

virtual int vtkSocketCommunicator::ReceiveVoidArray ( void *  data,
vtkIdType  length,
int  type,
int  remoteHandle,
int  tag 
) [virtual]

Performs the actual communication. You will usually use the convenience Send functions defined in the superclass.

Implements vtkCommunicator.

virtual void vtkSocketCommunicator::Barrier (  )  [virtual]

This class foolishly breaks the conventions of the superclass, so this overload fixes the method.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::BroadcastVoidArray ( void *  data,
vtkIdType  length,
int  type,
int  srcProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::GatherVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type,
int  destProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::GatherVVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  sendLength,
vtkIdType recvLengths,
vtkIdType offsets,
int  type,
int  destProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::ScatterVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type,
int  srcProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::ScatterVVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType sendLengths,
vtkIdType offsets,
vtkIdType  recvLength,
int  type,
int  srcProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::AllGatherVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::AllGatherVVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  sendLength,
vtkIdType recvLengths,
vtkIdType offsets,
int  type 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::ReduceVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type,
int  operation,
int  destProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::ReduceVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type,
Operation operation,
int  destProcessId 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::AllReduceVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type,
int  operation 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::AllReduceVoidArray ( const void *  sendBuffer,
void *  recvBuffer,
vtkIdType  length,
int  type,
Operation operation 
) [virtual]

This class foolishly breaks the conventions of the superclass, so the default implementations of these methods do not work. These just give errors instead.

Reimplemented from vtkCommunicator.

virtual void vtkSocketCommunicator::SetPerformHandshake ( int   )  [virtual]

Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual void vtkSocketCommunicator::PerformHandshakeOn (  )  [virtual]

Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual void vtkSocketCommunicator::PerformHandshakeOff (  )  [virtual]

Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual int vtkSocketCommunicator::GetPerformHandshake (  )  [virtual]

Set or get the PerformHandshake ivar. If it is on, the communicator will try to perform a handshake when connected. It is on by default.

virtual void vtkSocketCommunicator::SetLogStream ( ostream *  stream  )  [virtual]

Get/Set the output stream to which communications should be logged. This is intended as a debugging feature.

virtual ostream* vtkSocketCommunicator::GetLogStream (  )  [virtual]

Get/Set the output stream to which communications should be logged. This is intended as a debugging feature.

virtual int vtkSocketCommunicator::LogToFile ( const char *  name  )  [virtual]

Log messages to the given file. The file is truncated unless the second argument is non-zero (default is to truncate). If the file name is empty or NULL, logging is disabled. Returns 0 if the file failed to open, and 1 otherwise.

virtual int vtkSocketCommunicator::LogToFile ( const char *  name,
int  append 
) [virtual]

Log messages to the given file. The file is truncated unless the second argument is non-zero (default is to truncate). If the file name is empty or NULL, logging is disabled. Returns 0 if the file failed to open, and 1 otherwise.

virtual void vtkSocketCommunicator::SetReportErrors ( int   )  [virtual]

If ReportErrors if false, all vtkErrorMacros are suppressed.

virtual int vtkSocketCommunicator::GetReportErrors (  )  [virtual]

If ReportErrors if false, all vtkErrorMacros are suppressed.

virtual vtkClientSocket* vtkSocketCommunicator::GetSocket (  )  [virtual]

Get/Set the actual socket used for communication.

void vtkSocketCommunicator::SetSocket ( vtkClientSocket  ) 

Get/Set the actual socket used for communication.

int vtkSocketCommunicator::Handshake (  ) 

Performs handshake. This uses vtkClientSocket::ConnectingSide to decide whether to perform ServerSideHandshake or ClientSideHandshake.

int vtkSocketCommunicator::ServerSideHandshake (  ) 

Performs ServerSide handshake. One should preferably use Handshake() which calls ServerSideHandshake or ClientSideHandshake as required.

int vtkSocketCommunicator::ClientSideHandshake (  ) 

Performs ClientSide handshake. One should preferably use Handshake() which calls ServerSideHandshake or ClientSideHandshake as required.

virtual int vtkSocketCommunicator::GetIsServer (  )  [virtual]

Returns true if this side of the socket is the server. The result is invalid if the socket is not connected.

static int vtkSocketCommunicator::GetVersion (  )  [static]

Uniquely identifies the version of this class. If the versions match, then the socket communicators should be compatible.

int vtkSocketCommunicator::SendTagged ( const void *  data,
int  wordSize,
int  numWords,
int  tag,
const char *  logName 
) [protected]

int vtkSocketCommunicator::ReceiveTagged ( void *  data,
int  wordSize,
int  numWords,
int  tag,
const char *  logName 
) [protected]

int vtkSocketCommunicator::ReceivePartialTagged ( void *  data,
int  wordSize,
int  numWords,
int  tag,
const char *  logName 
) [protected]

void vtkSocketCommunicator::LogTagged ( const char *  name,
const void *  data,
int  wordSize,
int  numWords,
int  tag,
const char *  logName 
) [protected]

int vtkSocketCommunicator::CheckForErrorInternal ( int  id  )  [protected]


Member Data Documentation

Definition at line 206 of file vtkSocketCommunicator.h.

Definition at line 207 of file vtkSocketCommunicator.h.

Definition at line 208 of file vtkSocketCommunicator.h.

Definition at line 209 of file vtkSocketCommunicator.h.

Definition at line 210 of file vtkSocketCommunicator.h.

Definition at line 212 of file vtkSocketCommunicator.h.

ofstream* vtkSocketCommunicator::LogFile [protected]

Definition at line 214 of file vtkSocketCommunicator.h.

ostream* vtkSocketCommunicator::LogStream [protected]

Definition at line 215 of file vtkSocketCommunicator.h.


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

Generated on Wed Jun 3 19:35:00 2009 for VTK by  doxygen 1.5.6