1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkSocketController.h,v $
6 Date: $Date: 2002/06/06 14:57:55 $
7 Version: $Revision: 1.20 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkSocketController - Process communication using Sockets
19 // .SECTION Description
20 // This is a concrete implementation of vtkMultiProcessController.
21 // It supports one-to-one communication using sockets. Note that
22 // process 0 will always correspond to self and process 1 to the
23 // remote process. This class is best used with ports.
26 // vtkMultiProcessController vtkSocketCommunicator vtkInputPort vtkOutputPort
28 #ifndef __vtkSocketController_h
29 #define __vtkSocketController_h
31 #include "vtkMultiProcessController.h"
33 class vtkSocketCommunicator;
35 class VTK_PARALLEL_EXPORT vtkSocketController : public vtkMultiProcessController
38 static vtkSocketController *New();
39 vtkTypeRevisionMacro(vtkSocketController,vtkMultiProcessController);
40 void PrintSelf(ostream& os, vtkIndent indent);
43 // This method is for initialiazing sockets.
44 // One of these is REQUIRED for Windows.
45 virtual void Initialize(int* argc, char*** argv, int)
46 { this->Initialize(argc,argv); }
47 virtual void Initialize(int* argc, char*** argv);
48 virtual void Initialize()
49 { this->Initialize(0,0); }
52 // Does not apply to sockets. Does nothing.
54 void Finalize(int) {};
57 // Does not apply to sockets. Does nothing.
58 void SingleMethodExecute() {};
61 // Does not apply to sockets. Does nothing.
62 void MultipleMethodExecute() {};
65 // Does not apply to sockets. Does nothing.
66 void CreateOutputWindow() {};
69 // Does not apply to sockets. Does nothing.
73 // Set the number of processes you will be using.
74 virtual void SetNumberOfProcesses(int num);
77 // Wait for connection on a given port, forwarded
78 // to the communicator
79 virtual int WaitForConnection(int port);
82 // Close a connection, forwarded
83 // to the communicator
84 virtual void CloseConnection();
87 // Open a connection to a give machine, forwarded
88 // to the communicator
89 virtual int ConnectTo( char* hostName, int port );
91 int GetSwapBytesInReceivedData();
94 // Set the communicator used in normal and rmi communications.
95 void SetCommunicator(vtkSocketCommunicator* comm);
100 ENDIAN_TAG=1010580540 // 0x3c3c3c3c
107 vtkSocketController();
108 ~vtkSocketController();
110 // Initialize only once, finialize on destruction.
111 static int Initialized;
113 vtkSocketController(const vtkSocketController&); // Not implemented.
114 void operator=(const vtkSocketController&); // Not implemented.
118 #endif // __vtkSocketController_h