VTK  9.3.1
vtkSocketController.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
32 #ifndef vtkSocketController_h
33 #define vtkSocketController_h
34 
36 #include "vtkParallelCoreModule.h" // For export macro
37 
38 VTK_ABI_NAMESPACE_BEGIN
40 
41 class VTKPARALLELCORE_EXPORT vtkSocketController : public vtkMultiProcessController
42 {
43 public:
44  static vtkSocketController* New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
52  void Initialize(int* argc, char*** argv, int) override { this->Initialize(argc, argv); }
53  void Initialize(int* argc, char*** argv) override;
54  virtual void Initialize() { this->Initialize(nullptr, nullptr); }
55 
59  void Finalize() override {}
60  void Finalize(int) override {}
61 
65  void SingleMethodExecute() override {}
66 
70  void MultipleMethodExecute() override {}
71 
75  void CreateOutputWindow() override {}
76 
81  virtual int WaitForConnection(int port);
82 
87  virtual void CloseConnection();
88 
93  virtual int ConnectTo(const char* hostName, int port);
94 
95  int GetSwapBytesInReceivedData();
96 
100  void SetCommunicator(vtkSocketCommunicator* comm);
101 
111  vtkMultiProcessController* CreateCompliantController();
112 
113  enum Consts
114  {
115  ENDIAN_TAG = 1010580540, // 0x3c3c3c3c
116  IDTYPESIZE_TAG = 1027423549, // 0x3d3d3d3d
117  VERSION_TAG = 1044266558, // 0x3e3e3e3e
118  HASH_TAG = 0x3f3f3f3f
119  };
120 
121 protected:
123  ~vtkSocketController() override;
124 
125  // Initialize only once, finalize on destruction.
126  static int Initialized;
127 
128 private:
129  vtkSocketController(const vtkSocketController&) = delete;
130  void operator=(const vtkSocketController&) = delete;
131 };
132 
133 VTK_ABI_NAMESPACE_END
134 #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:28
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.