dox/Parallel/vtkSocketCommunicator.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00036
#ifndef __vtkSocketCommunicator_h
00037
#define __vtkSocketCommunicator_h
00038
00039
#include "vtkCommunicator.h"
00040
00041
#include "vtkByteSwap.h"
00042
00043
#ifdef VTK_WORDS_BIGENDIAN
00044
# define vtkSwap4 vtkByteSwap::Swap4LE
00045
# define vtkSwap4Range vtkByteSwap::Swap4LERange
00046
# define vtkSwap8 vtkByteSwap::Swap8LE
00047
# define vtkSwap8Range vtkByteSwap::Swap8LERange
00048
#else
00049 # define vtkSwap4 vtkByteSwap::Swap4BE
00050 # define vtkSwap4Range vtkByteSwap::Swap4BERange
00051 # define vtkSwap8 vtkByteSwap::Swap8BE
00052 # define vtkSwap8Range vtkByteSwap::Swap8BERange
00053
#endif
00054
00055 class VTK_PARALLEL_EXPORT vtkSocketCommunicator :
public vtkCommunicator
00056 {
00057
public:
00058
static vtkSocketCommunicator *
New();
00059 vtkTypeRevisionMacro(vtkSocketCommunicator,
vtkCommunicator);
00060
void PrintSelf(ostream& os,
vtkIndent indent);
00061
00063
virtual int WaitForConnection(
int port);
00064
00066
virtual void CloseConnection();
00067
00069
virtual int ConnectTo(
char* hostName,
int port);
00070
00072
00073 vtkGetMacro(SwapBytesInReceivedData,
int);
00075
00077
00078 vtkGetMacro(IsConnected,
int);
00080
00081
00082
00084
00086
int Send(
int *data,
int length,
int remoteProcessId,
int tag);
00087
int Send(
unsigned long *data,
int length,
int remoteProcessId,
int tag);
00088
int Send(
char *data,
int length,
int remoteProcessId,
int tag);
00089
int Send(
unsigned char *data,
int length,
int remoteProcessId,
int tag);
00090
int Send(
float *data,
int length,
int remoteProcessId,
int tag);
00091
int Send(
double *data,
int length,
int remoteProcessId,
int tag);
00092
#ifdef VTK_USE_64BIT_IDS
00093
int Send(
vtkIdType *data,
int length,
int remoteProcessId,
int tag);
00095
#endif
00096 int Send(
vtkDataObject *data,
int remoteId,
int tag)
00097 {
return this->
vtkCommunicator::Send(data,remoteId,tag);}
00098 int Send(
vtkDataArray *data,
int remoteId,
int tag)
00099 {
return this->
vtkCommunicator::Send(data,remoteId,tag);}
00100
00102
00105
int Receive(
int *data,
int length,
int remoteProcessId,
int tag);
00106
int Receive(
unsigned long *data,
int length,
int remoteProcessId,
int tag);
00107
int Receive(
char *data,
int length,
int remoteProcessId,
int tag);
00108
int Receive(
unsigned char *data,
int length,
int remoteProcessId,
int tag);
00109
int Receive(
float *data,
int length,
int remoteProcessId,
int tag);
00110
int Receive(
double *data,
int length,
int remoteProcessId,
int tag);
00111
#ifdef VTK_USE_64BIT_IDS
00112
int Receive(
vtkIdType *data,
int length,
int remoteProcessId,
int tag);
00114
#endif
00115 int Receive(
vtkDataObject *data,
int remoteId,
int tag)
00116 {
return this->
vtkCommunicator::Receive(data, remoteId, tag);}
00117 int Receive(
vtkDataArray *data,
int remoteId,
int tag)
00118 {
return this->
vtkCommunicator::Receive(data, remoteId, tag);}
00119
00121
00123 vtkSetClampMacro(PerformHandshake,
int, 0, 1);
00124 vtkBooleanMacro(PerformHandshake,
int);
00125 vtkGetMacro(PerformHandshake,
int);
00127
00128
00130
00132
virtual void SetLogStream(ostream* stream);
00133
virtual ostream* GetLogStream();
00134
00136
00138
00142
virtual int LogToFile(
const char* name);
00143
virtual int LogToFile(
const char* name,
int append);
00145
00146
protected:
00147
00148 int Socket;
00149 int IsConnected;
00150 int NumberOfProcesses;
00151 int SwapBytesInReceivedData;
00152 int PerformHandshake;
00153
00154 ofstream* LogFile;
00155 ostream* LogStream;
00156
00157 vtkSocketCommunicator();
00158 ~vtkSocketCommunicator();
00159
00160
00161
00162
int SendInternal(
int socket,
void* data,
int length);
00163
int ReceiveInternal(
int socket,
void* data,
int length);
00164
int SendTagged(
void* data,
int wordSize,
int numWords,
int tag,
00165
const char* logName);
00166
int ReceiveTagged(
void* data,
int wordSize,
int numWords,
int tag,
00167
const char* logName);
00168
00169
00170
void LogTagged(
const char* name,
void* data,
int wordSize,
int numWords,
00171
int tag,
const char* logName);
00172
int CheckForErrorInternal(
int id);
00173
private:
00174 vtkSocketCommunicator(
const vtkSocketCommunicator&);
00175
void operator=(
const vtkSocketCommunicator&);
00176 };
00177
00178
#endif