vtkSMProxyDefinitionManager.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkSMProxyDefinitionManager_h
13 #define vtkSMProxyDefinitionManager_h
14 
15 #include "vtkRemotingServerManagerModule.h" //needed for exports
16 #include "vtkSIProxyDefinitionManager.h" // needed for enums
17 #include "vtkSMMessageMinimal.h" // needed
18 #include "vtkSMRemoteObject.h"
19 #include "vtkWeakPointer.h" // needed for weak pointer.
20 
21 class vtkSMProxyLocator;
23 
25 {
26 public:
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
36  void SynchronizeDefinitions();
37 
43  void SetSession(vtkSMSession*) override;
44 
45  //***************************************************************************
46  // enums re-defined from vtkSIProxyDefinitionManager for convenience.
47  enum Events
48  {
51  };
52 
53  enum
54  {
58  };
59 
60  //***************************************************************************
61  // Methods simply forwarded to the client-side vtkSIProxyDefinitionManager
62  // instance.
63 
65 
70  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name, bool throwError)
71  {
72  return this->ProxyDefinitionManager
73  ? this->ProxyDefinitionManager->GetProxyDefinition(group, name, throwError)
74  : nullptr;
75  }
76  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name)
77  {
78  return this->ProxyDefinitionManager
79  ? this->ProxyDefinitionManager->GetProxyDefinition(group, name)
80  : nullptr;
81  }
83 
90  const char* group, const char* name, const char* subProxyName, bool throwError)
91  {
92  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->GetCollapsedProxyDefinition(
93  group, name, subProxyName, throwError)
94  : nullptr;
95  }
96 
100  bool HasDefinition(const char* groupName, const char* proxyName)
101  {
102  return this->ProxyDefinitionManager
103  ? this->ProxyDefinitionManager->HasDefinition(groupName, proxyName)
104  : false;
105  }
106 
112  {
113  if (this->ProxyDefinitionManager)
114  {
115  this->ProxyDefinitionManager->SaveCustomProxyDefinitions(root);
116  }
117  }
118 
120 
130  {
131  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->NewIterator() : nullptr;
132  }
135  {
136  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->NewIterator(scope)
137  : nullptr;
138  }
140 
142 
149  {
150  return this->ProxyDefinitionManager
151  ? this->ProxyDefinitionManager->NewSingleGroupIterator(groupName)
152  : nullptr;
153  }
154  vtkPVProxyDefinitionIterator* NewSingleGroupIterator(const char* groupName, int scope)
155  {
156  return this->ProxyDefinitionManager
157  ? this->ProxyDefinitionManager->NewSingleGroupIterator(groupName, scope)
158  : nullptr;
159  }
161 
162  //***************************************************************************
163  // Methods that ensure that the command takes effect on all instances of
164  // vtkSIProxyDefinitionManager across all processes.
165 
167 
170  void AddCustomProxyDefinition(const char* group, const char* name, vtkPVXMLElement* top);
171  void RemoveCustomProxyDefinition(const char* group, const char* name);
172  void ClearCustomProxyDefinitions();
174 
176 
179  void LoadCustomProxyDefinitions(vtkPVXMLElement* root);
180  void LoadCustomProxyDefinitionsFromString(const char* xmlContent);
182 
184 
187  bool LoadConfigurationXML(vtkPVXMLElement* root);
188  bool LoadConfigurationXMLFromString(const char* xmlContent);
190 
198  void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator) override;
199 
200 protected:
202  ~vtkSMProxyDefinitionManager() override;
203 
206 
207 private:
209  void operator=(const vtkSMProxyDefinitionManager&) = delete;
210 };
211 
212 #endif
vtkEventForwarderCommand * Forwarder
void SetSession(vtkSMSession *) override
Override the SetSession so if the object already have an ID we automatically register it to the assoc...
vtkSMProxyDefinitionManager is a remote-object that represents the vtkSIProxyDefinitionManager instan...
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
vtkPVProxyDefinitionIterator * NewSingleGroupIterator(const char *groupName, int scope)
Return a new configured iterator for traversing a set of proxy definition for only one GroupName...
bool HasDefinition(const char *groupName, const char *proxyName)
Return true if the XML Definition was found.
vtkPVXMLElement * GetProxyDefinition(const char *group, const char *name, bool throwError)
Returns a registered proxy definition or return a nullptr otherwise.
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:22
name
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
vtkPVXMLElement * GetCollapsedProxyDefinition(const char *group, const char *name, const char *subProxyName, bool throwError)
Returns the same thing as GetProxyDefinition in a flatten manner.
VTK_NEWINSTANCE vtkPVProxyDefinitionIterator * NewIterator()
Return a NEW instance of vtkPVProxyDefinitionIterator configured to get through all the definition av...
iterates over all proxy definitions from which the vtkSMProxyManager can use to create new proxy...
#define VTK_NEWINSTANCE
vtkWeakPointer< vtkSIProxyDefinitionManager > ProxyDefinitionManager
top
is used to locate proxies referred to in state xmls while loading state files.
vtkPVXMLElement * GetProxyDefinition(const char *group, const char *name)
Returns a registered proxy definition or return a nullptr otherwise.
void SaveCustomProxyDefinitions(vtkPVXMLElement *root)
Save registered custom proxy definitions.
VTK_NEWINSTANCE vtkPVProxyDefinitionIterator * NewIterator(int scope)
Return a NEW instance of vtkPVProxyDefinitionIterator configured to get through all the definition av...
baseclass for all proxy-objects that have counter parts on server as well as client processes...
vtkPVProxyDefinitionIterator * NewSingleGroupIterator(const char *groupName)
Return a new configured iterator for traversing a set of proxy definition for only one GroupName...
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
static vtkSMSessionObject * New()
void PrintSelf(ostream &os, vtkIndent indent) override