ParaView
vtkSMSessionClient.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
23 #ifndef vtkSMSessionClient_h
24 #define vtkSMSessionClient_h
25 
26 #include "vtkPVServerManagerCoreModule.h" //needed for exports
27 #include "vtkSMSession.h"
28 
29 class vtkMultiProcessController;
32 class vtkSMProxyLocator;
33 class vtkSMProxyManager;
34 
35 class VTKPVSERVERMANAGERCORE_EXPORT vtkSMSessionClient : public vtkSMSession
36 {
37 public:
38  static vtkSMSessionClient* New();
40  void PrintSelf(ostream& os, vtkIndent indent);
41 
45  virtual const char* GetURI() { return this->URI; };
46 
60  virtual bool Connect(const char* url);
61 
65  virtual bool GetIsAlive();
66 
73  virtual ServerFlags GetProcessRoles() { return CLIENT; }
74 
79  virtual vtkMultiProcessController* GetController(ServerFlags processType);
80 
89  virtual vtkPVServerInformation* GetServerInformation() { return this->ServerInformation; }
90 
96  virtual void Initialize();
97 
99 
102  virtual void PushState(vtkSMMessage* msg);
103  virtual void PullState(vtkSMMessage* message);
104  virtual void ExecuteStream(
105  vtkTypeUInt32 location, const vtkClientServerStream& stream, bool ignore_errors = false);
106  virtual const vtkClientServerStream& GetLastResult(vtkTypeUInt32 location);
108 
110 
116  vtkSetMacro(AbortConnect, bool);
118 
122  void CloseSession();
123 
130  virtual bool GatherInformation(
131  vtkTypeUInt32 location, vtkPVInformation* information, vtkTypeUInt32 globalid);
132 
139  virtual int GetNumberOfProcesses(vtkTypeUInt32 servers);
140 
146  virtual bool IsMPIInitialized(vtkTypeUInt32 servers);
147 
148  //---------------------------------------------------------------------------
149  // API for Collaboration management
150  //---------------------------------------------------------------------------
151 
152  // Called before application quit or session disconnection
153  // Used to prevent quiting client to delete proxy of a running session.
154  virtual void PreDisconnection();
155 
159  virtual bool IsNotBusy();
165  virtual void StartBusyWork();
171  virtual void EndBusyWork();
172 
178 
179  //---------------------------------------------------------------------------
180  // API for GlobalId management
181  //---------------------------------------------------------------------------
182 
189  virtual vtkTypeUInt32 GetNextGlobalUniqueIdentifier();
190 
197  virtual vtkTypeUInt32 GetNextChunkGlobalUniqueIdentifier(vtkTypeUInt32 chunkSize);
198 
199  void OnServerNotificationMessageRMI(void* message, int message_length);
200 
201 protected:
204 
205  void SetRenderServerController(vtkMultiProcessController*);
206  void SetDataServerController(vtkMultiProcessController*);
207 
208  void SetupDataServerRenderServerConnection();
209 
213  virtual void UnRegisterSIObject(vtkSMMessage* msg);
214 
218  virtual void RegisterSIObject(vtkSMMessage* msg);
219 
224  vtkTypeUInt32 GetRealLocation(vtkTypeUInt32);
225 
226  // Both maybe the same when connected to pvserver.
227  vtkMultiProcessController* RenderServerController;
228  vtkMultiProcessController* DataServerController;
229 
234 
235  vtkSetStringMacro(URI);
236 
237  bool AbortConnect;
238  char* URI;
239 
240  // This flag allow us to disable remote Object deletion in a collaboration
241  // context when a client is leaving a visalization session.
242  // Typically we don't want this client to broadcast to the other to delete all
243  // the proxy because it does not need them anymore as it is leaving...
245 
246  // Field used to communicate with other clients
248 
253  virtual bool OnWrongTagEvent(vtkObject* caller, unsigned long eventid, void* calldata);
254 
258  virtual void OnConnectionLost(vtkObject* caller, unsigned long eventid, void* calldata);
259 
260 private:
261  vtkSMSessionClient(const vtkSMSessionClient&) VTK_DELETE_FUNCTION;
262  void operator=(const vtkSMSessionClient&) VTK_DELETE_FUNCTION;
263 
264  int NotBusy;
265  vtkTypeUInt32 LastGlobalID;
266  vtkTypeUInt32 LastGlobalIDAvailable;
267 };
268 
269 #endif
vtkPVServerInformation * RenderServerInformation
vtkPVServerInformation * ServerInformation
vtkPVServerInformation * DataServerInformation
virtual bool GetIsAlive()
Builtin session is always alive.
Definition: vtkSMSession.h:131
virtual vtkSMCollaborationManager * GetCollaborationManager()
Return the instance of vtkSMCollaborationManager that will be lazy created at the first call...
Definition: vtkSMSession.h:53
virtual const vtkClientServerStream & GetLastResult(vtkTypeUInt32 location)
Returns the response of the ExecuteStream() call from the location.
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:35
Gets features of the server.
vtkMultiProcessController * RenderServerController
virtual const char * GetURI()
Return the url used to connect the current session to a server.
virtual bool GatherInformation(vtkTypeUInt32 location, vtkPVInformation *information, vtkTypeUInt32 globalid)
Gather information about an object referred by the globalid.
Class used to broadcast message from one client to the others.
Store messages for the interpreter.
singleton/facade to vtkSMSessionProxyManager
virtual void PreDisconnection()
Definition: vtkSMSession.h:163
virtual bool IsMPIInitialized(vtkTypeUInt32 servers)
Returns whether or not MPI is initialized on the specified server/s.
vtkSMSessionClient is a remote-session that connects to a remote server.
vtkMultiProcessController * DataServerController
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
virtual vtkTypeUInt32 GetNextGlobalUniqueIdentifier()
Provides the next available identifier.
virtual void Initialize()
Initialize various internal classes after the session has been setup correctly.
static vtkSMSession * New()
virtual void PushState(vtkSMMessage *msg)
Push the state message.
virtual vtkPVServerInformation * GetServerInformation()
vtkPVServerInformation is an information-object that provides information about the server processes...
virtual void UnRegisterSIObject(vtkSMMessage *msg)
Unregister server side object.
virtual void RegisterSIObject(vtkSMMessage *msg)
Register server side object.
is used to locate proxies referred to in state xmls while loading state files.
virtual int GetNumberOfProcesses(vtkTypeUInt32 servers)
Returns the number of processes on the given server/s.
virtual vtkTypeUInt32 GetNextChunkGlobalUniqueIdentifier(vtkTypeUInt32 chunkSize)
Return the first Id of the requested chunk.
vtkClientServerStream * ServerLastInvokeResult
virtual void PullState(vtkSMMessage *msg)
Pull the state message.
void PrintSelf(ostream &os, vtkIndent indent)
vtkSMCollaborationManager * CollaborationCommunicator
virtual ServerFlags GetProcessRoles()
Returns a ServerFlags indicate the nature of the current processes.
virtual bool OnWrongTagEvent(vtkObject *caller, unsigned long eventid, void *calldata)
Callback when any vtkMultiProcessController subclass fires a WrongTagEvent.
virtual vtkMultiProcessController * GetController(ServerFlags processType)
Returns the controller used to communicate with the process.
virtual void ExecuteStream(vtkTypeUInt32 location, const vtkClientServerStream &stream, bool ignore_errors=false)
Execute a command on the given processes.
Superclass for information objects.