VTK  9.0.20201021
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 
45 #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) override;
55 
60  void Initialize(int* argc, char*** argv, int) override { this->Initialize(argc, argv); }
61  void Initialize(int* argc, char*** argv) override;
62  virtual void Initialize() { this->Initialize(nullptr, nullptr); }
63 
67  void Finalize() override {}
68  void Finalize(int) override {}
69 
73  void SingleMethodExecute() override {}
74 
78  void MultipleMethodExecute() override {}
79 
83  void CreateOutputWindow() override {}
84 
89  virtual int WaitForConnection(int port);
90 
95  virtual void CloseConnection();
96 
101  virtual int ConnectTo(const char* hostName, int port);
102 
103  int GetSwapBytesInReceivedData();
104 
108  void SetCommunicator(vtkSocketCommunicator* comm);
109 
119  vtkMultiProcessController* CreateCompliantController();
120 
121  enum Consts
122  {
123  ENDIAN_TAG = 1010580540, // 0x3c3c3c3c
124  IDTYPESIZE_TAG = 1027423549, // 0x3d3d3d3d
125  VERSION_TAG = 1044266558, // 0x3e3e3e3e
126  HASH_TAG = 0x3f3f3f3f
127  };
128 
129 protected:
131  ~vtkSocketController() override;
132 
133  // Initialize only once, finialize on destruction.
134  static int Initialized;
135 
136 private:
137  vtkSocketController(const vtkSocketController&) = delete;
138  void operator=(const vtkSocketController&) = delete;
139 };
140 
141 #endif // vtkSocketController_h
vtkSocketController::Initialize
virtual void Initialize()
Definition: vtkSocketController.h:62
vtkSocketController::Finalize
void Finalize(int) override
This method is for cleaning up.
Definition: vtkSocketController.h:68
vtkMultiProcessController::Consts
Consts
Definition: vtkMultiProcessController.h:365
vtkSocketCommunicator
Process communication using Sockets.
Definition: vtkSocketCommunicator.h:64
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkMultiProcessController.h
vtkSocketController::Initialize
void Initialize(int *argc, char ***argv, int) override
This method is for initialiazing sockets.
Definition: vtkSocketController.h:60
vtkSocketController::CreateOutputWindow
void CreateOutputWindow() override
Does not apply to sockets.
Definition: vtkSocketController.h:83
vtkSocketController::Initialized
static int Initialized
Definition: vtkSocketController.h:134
vtkMultiProcessController::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::port
Definition: vtkX3D.h:453
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:76
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSocketController::SingleMethodExecute
void SingleMethodExecute() override
Does not apply to sockets.
Definition: vtkSocketController.h:73
vtkMultiProcessController::Initialize
virtual void Initialize(int *vtkNotUsed(argc), char ***vtkNotUsed(argv))=0
This method is for setting up the processes.
vtkSocketController::MultipleMethodExecute
void MultipleMethodExecute() override
Does not apply to sockets.
Definition: vtkSocketController.h:78
vtkSocketController::Finalize
void Finalize() override
Does not apply to sockets.
Definition: vtkSocketController.h:67
vtkSocketController
Process communication using Sockets.
Definition: vtkSocketController.h:49