39 #ifndef __vtkSocketCommunicator_h
40 #define __vtkSocketCommunicator_h
42 #include "vtkParallelCoreModule.h"
45 #include "vtkByteSwap.h"
47 #ifdef VTK_WORDS_BIGENDIAN
48 # define vtkSwap4 vtkByteSwap::Swap4LE
49 # define vtkSwap4Range vtkByteSwap::Swap4LERange
50 # define vtkSwap8 vtkByteSwap::Swap8LE
51 # define vtkSwap8Range vtkByteSwap::Swap8LERange
53 # define vtkSwap4 vtkByteSwap::Swap4BE
54 # define vtkSwap4Range vtkByteSwap::Swap4BERange
55 # define vtkSwap8 vtkByteSwap::Swap8BE
56 # define vtkSwap8Range vtkByteSwap::Swap8BERange
59 class vtkClientSocket;
60 class vtkServerSocket;
67 void PrintSelf(ostream& os, vtkIndent indent);
72 virtual int WaitForConnection(
int port);
73 virtual int WaitForConnection(vtkServerSocket* socket,
74 unsigned long msec = 0);
78 virtual void CloseConnection();
81 virtual int ConnectTo(
const char* hostName,
int port);
85 vtkGetMacro(SwapBytesInReceivedData,
int);
99 virtual int SendVoidArray(
const void *data, vtkIdType length,
int type,
100 int remoteHandle,
int tag);
102 int remoteHandle,
int tag);
116 vtkIdType length,
int type,
int destProcessId);
118 vtkIdType sendLength, vtkIdType *recvLengths,
119 vtkIdType *offsets,
int type,
int destProcessId);
121 vtkIdType length,
int type,
int srcProcessId);
123 vtkIdType *sendLengths, vtkIdType *offsets,
124 vtkIdType recvLength,
int type,
127 vtkIdType length,
int type);
129 vtkIdType sendLength, vtkIdType *recvLengths,
130 vtkIdType *offsets,
int type);
132 vtkIdType length,
int type,
133 int operation,
int destProcessId);
135 vtkIdType length,
int type,
136 Operation *operation,
int destProcessId);
138 vtkIdType length,
int type,
141 vtkIdType length,
int type,
148 vtkSetClampMacro(PerformHandshake,
int, 0, 1);
149 vtkBooleanMacro(PerformHandshake,
int);
150 vtkGetMacro(PerformHandshake,
int);
157 virtual void SetLogStream(ostream* stream);
158 virtual ostream* GetLogStream();
167 virtual int LogToFile(
const char* name);
168 virtual int LogToFile(
const char* name,
int append);
173 vtkSetMacro(ReportErrors,
int);
174 vtkGetMacro(ReportErrors,
int);
179 vtkGetObjectMacro(Socket, vtkClientSocket);
180 void SetSocket(vtkClientSocket*);
189 int ServerSideHandshake();
193 int ClientSideHandshake();
198 vtkGetMacro(IsServer,
int);
203 static int GetVersion();
213 { this->BufferMessage =
true; }
217 bool HasBufferredMessages();
238 int SendTagged(
const void* data,
int wordSize,
int numWords,
int tag,
239 const char* logName);
240 int ReceiveTagged(
void* data,
int wordSize,
int numWords,
int tag,
241 const char* logName);
242 int ReceivePartialTagged(
void* data,
int wordSize,
int numWords,
int tag,
243 const char* logName);
245 int ReceivedTaggedFromBuffer(
246 void* data,
int wordSize,
int numWords,
int tag,
const char* logName);
249 void FixByteOrder(
void* data,
int wordSize,
int numWords);
252 void LogTagged(
const char* name,
const void* data,
int wordSize,
int numWords,
253 int tag,
const char* logName);
254 int CheckForErrorInternal(
int id);
260 int SelectSocket(
int socket,
unsigned long msec);
272 int TagMessageLength;
275 class vtkMessageBuffer;
276 vtkMessageBuffer* ReceivedMessageBuffer;
void BufferCurrentMessage()
virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int type, int destProcessId)
virtual int BroadcastVoidArray(void *data, vtkIdType length, int type, int srcProcessId)
Process communication using Sockets.
virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int type)
virtual int ReceiveVoidArray(void *data, vtkIdType maxlength, int type, int remoteHandle, int tag)=0
virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int operation, int destProcessId)
virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int destProcessId)
virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int type, int srcProcessId)
virtual int SendVoidArray(const void *data, vtkIdType length, int type, int remoteHandle, int tag)=0
virtual void SetNumberOfProcesses(int num)
void PrintSelf(ostream &os, vtkIndent indent)
virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type)
virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int operation)
virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int srcProcessId)
Used to send/receive messages in a multiprocess environment.
int SwapBytesInReceivedData