vtkSMRemoteObject.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkSMRemoteObject_h
13 #define vtkSMRemoteObject_h
14 
15 #include "vtkRemotingServerManagerModule.h" //needed for exports
16 #include "vtkSMMessageMinimal.h" // needed for vtkSMMessage
17 #include "vtkSMSessionObject.h"
18 #include "vtkWeakPointer.h" // needed for vtkWeakPointer
19 
21 class vtkSMSession;
22 class vtkSMProxyLocator;
23 class vtkSMLoadStateContext;
24 
26 {
27  // My friends are...
28  friend class vtkSMStateHelper; // To pull state
29  friend class vtkSMStateLoader; // To set GlobalId as the originals
30 
31 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
36 
40  vtkSetMacro(Location, vtkTypeUInt32);
41  vtkGetMacro(Location, vtkTypeUInt32);
43 
48  void SetSession(vtkSMSession*) override;
49 
51 
55  virtual vtkTypeUInt32 GetGlobalID();
56  const char* GetGlobalIDAsString();
58 
63  bool HasGlobalID();
64 
66 
70  vtkBooleanMacro(Prototype, bool);
71  bool IsPrototype() { return this->Prototype; }
72  vtkSetMacro(Prototype, bool);
74 
81  virtual const vtkSMMessage* GetFullState() { return nullptr; }
82 
84 
91  virtual void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator)
92  {
93  (void)msg;
94  (void)locator;
95  }
97 
105  virtual void EnableLocalPushOnly();
106 
111  virtual void DisableLocalPushOnly();
112 
117  virtual bool IsLocalPushOnly() { return this->ClientOnlyLocationFlag; }
118 
119 protected:
124 
128  ~vtkSMRemoteObject() override;
129 
134  void PushState(vtkSMMessage* msg);
135 
141  bool PullState(vtkSMMessage* msg);
142 
146  void SetGlobalID(vtkTypeUInt32 guid);
147 
148  // Global-ID for this vtkSMRemoteObject. This is assigned when needed.
149  // Assigned at :
150  // - First push
151  // - or when the RemoteObject is created by the ProcessModule remotely.
152  // - or when state is loaded from protobuf messages
153  vtkTypeUInt32 GlobalID;
154 
155  // Location flag identify the processes on which the vtkSIObject
156  // corresponding to this vtkSMRemoteObject exist.
157  vtkTypeUInt32 Location;
158 
159  // Allow remote object to be discard for any state management such as
160  // Undo/Redo, Register/UnRegister (in ProxyManager) and so on...
161  bool Prototype;
162 
163  // Field that store the Disable/EnableLocalPushOnly() state information
165 
166  // Convenient method used to return either the local Location or a filtered
167  // version of it based on the ClientOnlyLocationFlag
168  vtkTypeUInt32 GetFilteredLocation();
169 
170 private:
171  vtkSMRemoteObject(const vtkSMRemoteObject&) = delete;
172  void operator=(const vtkSMRemoteObject&) = delete;
173 
174  char* GlobalIDString;
175 };
176 
191 {
192  vtkSMRemoteObject* Reference;
194  vtkClientServerStream& stream, const SIOBJECT& manipulator);
195 
196 public:
198  : Reference(rmobject)
199  {
200  }
201 };
202 
204  vtkClientServerStream& stream, const SIOBJECT& manipulator);
205 
206 #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:22
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)