OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkSocketController.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkSocketController.h,v $
5   Language:  C++
6   Date:      $Date: 2002/06/06 14:57:55 $
7   Version:   $Revision: 1.20 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
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.
16
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.
24
25 // .SECTION see also
26 // vtkMultiProcessController vtkSocketCommunicator vtkInputPort vtkOutputPort
27
28 #ifndef __vtkSocketController_h
29 #define __vtkSocketController_h
30
31 #include "vtkMultiProcessController.h"
32
33 class vtkSocketCommunicator;
34
35 class VTK_PARALLEL_EXPORT vtkSocketController : public vtkMultiProcessController
36 {
37 public:
38   static vtkSocketController *New();
39   vtkTypeRevisionMacro(vtkSocketController,vtkMultiProcessController);
40   void PrintSelf(ostream& os, vtkIndent indent);
41
42   // Description:
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); }
50
51   // Description:
52   // Does not apply to sockets. Does nothing.
53   void Finalize() {};
54   void Finalize(int) {};
55
56   // Description:
57   //  Does not apply to sockets. Does nothing.
58   void SingleMethodExecute() {};
59   
60   // Description:
61   //  Does not apply to sockets.  Does nothing.
62   void MultipleMethodExecute() {};
63
64   // Description:
65   //  Does not apply to sockets. Does nothing.
66   void CreateOutputWindow() {};
67
68   // Description:
69   //  Does not apply to sockets. Does nothing.
70   void Barrier() {};
71
72   // Description:
73   // Set the number of processes you will be using.
74   virtual void SetNumberOfProcesses(int num);
75
76   // Description:
77   // Wait for connection on a given port, forwarded
78   // to the communicator
79   virtual int WaitForConnection(int port);
80
81   // Description:
82   // Close a connection, forwarded
83   // to the communicator
84   virtual void CloseConnection();
85
86   // Description:
87   // Open a connection to a give machine, forwarded
88   // to the communicator
89   virtual int ConnectTo( char* hostName, int port );
90
91   int GetSwapBytesInReceivedData();
92
93   // Description:
94   // Set the communicator used in normal and rmi communications.
95   void SetCommunicator(vtkSocketCommunicator* comm);
96
97 //BTX
98
99   enum Consts {
100     ENDIAN_TAG=1010580540 // 0x3c3c3c3c
101   };
102
103 //ETX
104
105 protected:
106
107   vtkSocketController();
108   ~vtkSocketController();
109
110   // Initialize only once, finialize on destruction.
111   static int Initialized;
112 private:
113   vtkSocketController(const vtkSocketController&);  // Not implemented.
114   void operator=(const vtkSocketController&);  // Not implemented.
115 };
116
117
118 #endif // __vtkSocketController_h