vtkSMRemoteObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMRemoteObject.h
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 =========================================================================*/
24 #ifndef vtkSMRemoteObject_h
25 #define vtkSMRemoteObject_h
26 
27 #include "vtkRemotingServerManagerModule.h" //needed for exports
28 #include "vtkSMMessageMinimal.h" // needed for vtkSMMessage
29 #include "vtkSMSessionObject.h"
30 #include "vtkWeakPointer.h" // needed for vtkWeakPointer
31 
33 class vtkSMSession;
34 class vtkSMProxyLocator;
35 class vtkSMLoadStateContext;
36 
38 {
39  // My friends are...
40  friend class vtkSMStateHelper; // To pull state
41  friend class vtkSMStateLoader; // To set GlobalId as the originals
42 
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
52  vtkSetMacro(Location, vtkTypeUInt32);
53  vtkGetMacro(Location, vtkTypeUInt32);
55 
60  void SetSession(vtkSMSession*) override;
61 
63 
67  virtual vtkTypeUInt32 GetGlobalID();
68  const char* GetGlobalIDAsString();
70 
75  bool HasGlobalID();
76 
78 
82  vtkBooleanMacro(Prototype, bool);
83  bool IsPrototype() { return this->Prototype; }
84  vtkSetMacro(Prototype, bool);
86 
93  virtual const vtkSMMessage* GetFullState() { return nullptr; }
94 
96 
103  virtual void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator)
104  {
105  (void)msg;
106  (void)locator;
107  }
109 
117  virtual void EnableLocalPushOnly();
118 
123  virtual void DisableLocalPushOnly();
124 
129  virtual bool IsLocalPushOnly() { return this->ClientOnlyLocationFlag; }
130 
131 protected:
136 
140  ~vtkSMRemoteObject() override;
141 
146  void PushState(vtkSMMessage* msg);
147 
153  bool PullState(vtkSMMessage* msg);
154 
158  void SetGlobalID(vtkTypeUInt32 guid);
159 
160  // Global-ID for this vtkSMRemoteObject. This is assigned when needed.
161  // Assigned at :
162  // - First push
163  // - or when the RemoteObject is created by the ProcessModule remotely.
164  // - or when state is loaded from protobuf messages
165  vtkTypeUInt32 GlobalID;
166 
167  // Location flag identify the processes on which the vtkSIObject
168  // corresponding to this vtkSMRemoteObject exist.
169  vtkTypeUInt32 Location;
170 
171  // Allow remote object to be discard for any state management such as
172  // Undo/Redo, Register/UnRegister (in ProxyManager) and so on...
173  bool Prototype;
174 
175  // Field that store the Disable/EnableLocalPushOnly() state information
177 
178  // Convenient method used to return either the local Location or a filtered
179  // version of it based on the ClientOnlyLocationFlag
180  vtkTypeUInt32 GetFilteredLocation();
181 
182 private:
183  vtkSMRemoteObject(const vtkSMRemoteObject&) = delete;
184  void operator=(const vtkSMRemoteObject&) = delete;
185 
186  char* GlobalIDString;
187 };
188 
203 {
204  vtkSMRemoteObject* Reference;
206  vtkClientServerStream& stream, const SIOBJECT& manipulator);
207 
208 public:
210  : Reference(rmobject)
211  {
212  }
213 };
214 
216  vtkClientServerStream& stream, const SIOBJECT& manipulator);
217 
218 #endif // #ifndef vtkSMRemoteObject_h
superclass for any server manager classes that are related to a session
virtual void SetSession(vtkSMSession *)
Get/Set the session on wihch this object exists.
bool IsPrototype()
Allow user to set the remote object to be discard for Undo/Redo action.
virtual void LoadState(const vtkSMMessage *msg, vtkSMProxyLocator *locator)
This method is used to initialise the object to the given state If the definitionOnly Flag is set to ...
#define VTKREMOTINGSERVERMANAGER_EXPORT
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:35
Store messages for the interpreter.
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
This defines a manipulator for the vtkClientServerStream that can be used to indicate to the interpre...
SIOBJECT(vtkSMRemoteObject *rmobject)
vtkTypeUInt32 GlobalID
virtual bool IsLocalPushOnly()
Let the session be aware that even if the Location is client only, the message should not be send to ...
virtual const vtkSMMessage * GetFullState()
This method return the full object state that can be used to create that object from scratch...
is used to locate proxies referred to in state xmls while loading state files.
void PrintSelf(ostream &os, vtkIndent indent) override
vtkTypeUInt32 Location
Utility class to load state from XML.
baseclass for all proxy-objects that have counter parts on server as well as client processes...
VTKREMOTINGSERVERMANAGER_EXPORT vtkClientServerStream & operator<<(vtkClientServerStream &stream, const SIOBJECT &manipulator)