VTK
vtkSocketController.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSocketController.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
41 #ifndef vtkSocketController_h
42 #define vtkSocketController_h
43 
44 #include "vtkParallelCoreModule.h" // For export macro
46 
48 
49 class VTKPARALLELCORE_EXPORT vtkSocketController : public vtkMultiProcessController
50 {
51 public:
52  static vtkSocketController *New();
54  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
55 
60  void Initialize(int* argc, char*** argv, int) VTK_OVERRIDE
61  { this->Initialize(argc,argv); }
62  void Initialize(int* argc, char*** argv) VTK_OVERRIDE;
63  virtual void Initialize()
64  { this->Initialize(0,0); }
65 
69  void Finalize() VTK_OVERRIDE {}
70  void Finalize(int) VTK_OVERRIDE {}
71 
75  void SingleMethodExecute() VTK_OVERRIDE {}
76 
80  void MultipleMethodExecute() VTK_OVERRIDE {}
81 
85  void CreateOutputWindow() VTK_OVERRIDE {}
86 
91  virtual int WaitForConnection(int port);
92 
97  virtual void CloseConnection();
98 
103  virtual int ConnectTo(const char* hostName, int port );
104 
105  int GetSwapBytesInReceivedData();
106 
110  void SetCommunicator(vtkSocketCommunicator* comm);
111 
121  vtkMultiProcessController *CreateCompliantController();
122 
123  enum Consts {
124  ENDIAN_TAG=1010580540, // 0x3c3c3c3c
125  IDTYPESIZE_TAG=1027423549, // 0x3d3d3d3d
126  VERSION_TAG=1044266558, // 0x3e3e3e3e
127  HASH_TAG=0x3f3f3f3f
128  };
129 
130 protected:
131 
133  ~vtkSocketController() VTK_OVERRIDE;
134 
135  // Initialize only once, finialize on destruction.
136  static int Initialized;
137 private:
138  vtkSocketController(const vtkSocketController&) VTK_DELETE_FUNCTION;
139  void operator=(const vtkSocketController&) VTK_DELETE_FUNCTION;
140 };
141 
142 
143 #endif // vtkSocketController_h
Process communication using Sockets.
virtual void Initialize()
Process communication using Sockets.
void Finalize() override
Does not apply to sockets.
void CreateOutputWindow() override
Does not apply to sockets.
void SingleMethodExecute() override
Does not apply to sockets.
virtual void Initialize(int *vtkNotUsed(argc), char ***vtkNotUsed(argv))=0
This method is for setting up the processes.
void Initialize(int *argc, char ***argv, int) override
This method is for initialiazing sockets.
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void MultipleMethodExecute() override
Does not apply to sockets.
void Finalize(int) override
This method is for cleaning up.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Multiprocessing communication superclass.