Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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 58 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 int OpenSocket (int port, const char *network=0)
virtual int GetPort (int sock)
virtual int WaitForConnectionOnSocket (int socket, unsigned long timeout=0)
virtual int WaitForConnection (int port)
virtual void CloseConnection ()
virtual int ConnectTo (char *hostName, int port)
virtual int GetSwapBytesInReceivedData ()
virtual int GetIsConnected ()
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 (unsigned char *data, int length, int remoteProcessId, int tag)
int Send (float *data, int length, int remoteProcessId, int tag)
int Send (double *data, int length, int remoteProcessId, int tag)
int Send (vtkDataObject *data, int remoteId, int tag)
int Send (vtkDataArray *data, int remoteId, 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 (unsigned char *data, int length, int remoteProcessId, int tag)
int Receive (float *data, int length, int remoteProcessId, int tag)
int Receive (double *data, int length, int remoteProcessId, int tag)
int Receive (vtkDataObject *data, int remoteId, int tag)
int Receive (vtkDataArray *data, int remoteId, int tag)
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 ()

Static Public Member Functions

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

Protected Member Functions

 vtkSocketCommunicator ()
 ~vtkSocketCommunicator ()
int SendInternal (int socket, void *data, int length)
int ReceiveInternal (int socket, void *data, int length)
int SendTagged (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, void *data, int wordSize, int numWords, int tag, const char *logName)
int CheckForErrorInternal (int id)

Protected Attributes

int Socket
int IsConnected
int NumberOfProcesses
int SwapBytesInReceivedData
int PerformHandshake
int ReportErrors
ofstream * LogFile
ostream * LogStream


Member Typedef Documentation

typedef vtkCommunicator vtkSocketCommunicator::Superclass
 

Reimplemented from vtkCommunicator.

Definition at line 62 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 *  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 vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkCommunicator.

virtual int vtkSocketCommunicator::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 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::OpenSocket int  port,
const char *  network = 0
[virtual]
 

Create a socket on the given port, if port is 0, then create a random port. If network is specified, then use the given network. The socket number is returned.

virtual int vtkSocketCommunicator::GetPort int  sock  )  [virtual]
 

Return the port used by an open socket.

virtual int vtkSocketCommunicator::WaitForConnectionOnSocket int  socket,
unsigned long  timeout = 0
[virtual]
 

Wait for a connection on an already bound port created by a call to BindPort. If the timeout is specified, then the call will fail after timeout expiers with resulting code of -1.

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

Wait for connection on a given port.

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

virtual int vtkSocketCommunicator::GetIsConnected  )  [virtual]
 

Is the communicator connected?.

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

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Implements vtkCommunicator.

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

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Implements vtkCommunicator.

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

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Implements vtkCommunicator.

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

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Implements vtkCommunicator.

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

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Implements vtkCommunicator.

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

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Implements vtkCommunicator.

int vtkSocketCommunicator::Send vtkDataObject data,
int  remoteId,
int  tag
[inline, virtual]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Reimplemented from vtkCommunicator.

Definition at line 112 of file vtkSocketCommunicator.h.

References vtkCommunicator::Send().

int vtkSocketCommunicator::Send vtkDataArray data,
int  remoteId,
int  tag
[inline, virtual]
 

This method sends a data array to a destination. Tag eliminates ambiguity and is used to match sends to receives.

Reimplemented from vtkCommunicator.

Definition at line 114 of file vtkSocketCommunicator.h.

References vtkCommunicator::Send().

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

This method receives data from a corresponding send. It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Implements vtkCommunicator.

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

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

Implements vtkCommunicator.

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

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

Implements vtkCommunicator.

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

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

Implements vtkCommunicator.

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

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

Implements vtkCommunicator.

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

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

Implements vtkCommunicator.

int vtkSocketCommunicator::Receive vtkDataObject data,
int  remoteId,
int  tag
[inline, virtual]
 

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

Reimplemented from vtkCommunicator.

Definition at line 131 of file vtkSocketCommunicator.h.

References vtkCommunicator::Receive().

int vtkSocketCommunicator::Receive vtkDataArray data,
int  remoteId,
int  tag
[inline, virtual]
 

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

Reimplemented from vtkCommunicator.

Definition at line 133 of file vtkSocketCommunicator.h.

References vtkCommunicator::Receive().

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]
 

virtual void vtkSocketCommunicator::PerformHandshakeOff  )  [virtual]
 

virtual int vtkSocketCommunicator::GetPerformHandshake  )  [virtual]
 

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.

int vtkSocketCommunicator::SendInternal int  socket,
void *  data,
int  length
[protected]
 

int vtkSocketCommunicator::ReceiveInternal int  socket,
void *  data,
int  length
[protected]
 

int vtkSocketCommunicator::SendTagged 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,
void *  data,
int  wordSize,
int  numWords,
int  tag,
const char *  logName
[protected]
 

int vtkSocketCommunicator::CheckForErrorInternal int  id  )  [protected]
 


Member Data Documentation

int vtkSocketCommunicator::Socket [protected]
 

Definition at line 165 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::IsConnected [protected]
 

Definition at line 171 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::NumberOfProcesses [protected]
 

Definition at line 172 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::SwapBytesInReceivedData [protected]
 

Definition at line 173 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::PerformHandshake [protected]
 

Definition at line 174 of file vtkSocketCommunicator.h.

int vtkSocketCommunicator::ReportErrors [protected]
 

Definition at line 176 of file vtkSocketCommunicator.h.

ofstream* vtkSocketCommunicator::LogFile [protected]
 

Definition at line 178 of file vtkSocketCommunicator.h.

ostream* vtkSocketCommunicator::LogStream [protected]
 

Definition at line 179 of file vtkSocketCommunicator.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 22 00:17:12 2008 for VTK by  doxygen 1.4.3-20050530