vtkSIProxyDefinitionManager.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
30 #ifndef vtkSIProxyDefinitionManager_h
31 #define vtkSIProxyDefinitionManager_h
32 
33 #include "vtkRemotingServerManagerModule.h" //needed for exports
34 #include "vtkSIObject.h"
35 
36 class vtkPVPlugin;
38 class vtkPVXMLElement;
39 
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  static vtkTypeUInt32 GetReservedGlobalID();
51 
58  static void PatchXMLProperty(vtkPVXMLElement* propElement);
59 
61 
66  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name, bool throwError);
67  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name)
68  {
69  // We do throw an error by default
70  return this->GetProxyDefinition(group, name, true);
71  }
73 
77  bool HasDefinition(const char* groupName, const char* proxyName);
78 
80 
85  vtkPVXMLElement* GetCollapsedProxyDefinition(
86  const char* group, const char* name, const char* subProxyName, bool throwError);
88  const char* group, const char* name, const char* subProxyName)
89  {
90  return this->GetCollapsedProxyDefinition(group, name, subProxyName, true);
91  }
93 
95 
105  void AddCustomProxyDefinition(const char* group, const char* name, vtkPVXMLElement* top);
106  void AddCustomProxyDefinition(
107  const char* groupName, const char* proxyName, const char* xmlcontents);
109 
116  void RemoveCustomProxyDefinition(const char* group, const char* name);
117 
124  void ClearCustomProxyDefinitions();
125 
127 
130  void LoadCustomProxyDefinitions(vtkPVXMLElement* root);
131  void LoadCustomProxyDefinitionsFromString(const char* xmlContent);
133 
138  void SaveCustomProxyDefinitions(vtkPVXMLElement* root);
139 
141 
144  bool LoadConfigurationXML(vtkPVXMLElement* root);
145  bool LoadConfigurationXMLFromString(const char* xmlContent);
147 
148  enum Events
149  {
150  ProxyDefinitionsUpdated = 2000,
151  CompoundProxyDefinitionsUpdated = 2001
152  };
153 
163  enum
164  {
165  ALL_DEFINITIONS = 0,
166  CORE_DEFINITIONS = 1,
167  CUSTOM_DEFINITIONS = 2
168  };
169 
179  vtkPVProxyDefinitionIterator* NewIterator(int scope = ALL_DEFINITIONS);
180 
187  vtkPVProxyDefinitionIterator* NewSingleGroupIterator(
188  const char* groupName, int scope = ALL_DEFINITIONS);
189 
195  void EnableXMLProxyDefnitionUpdate(bool);
196 
202  void Push(vtkSMMessage* msg) override;
203 
209  void Pull(vtkSMMessage* msg) override;
210 
212 
216  {
217  const char* GroupName;
218  const char* ProxyName;
221  const char* groupName, const char* proxyName, bool isCustom = false)
222  {
223  this->GroupName = groupName;
224  this->ProxyName = proxyName;
225  this->CustomDefinition = isCustom;
226  }
227  };
229 
230 protected:
232  ~vtkSIProxyDefinitionManager() override;
233 
238  void AttachEnsurePluginLoadedToProxies(
239  vtkPVXMLElement* proxy, const std::string& ensurePluginLoaded);
240 
246  void AttachShowInMenuHintsToProxy(vtkPVXMLElement* proxy);
247 
253  void AttachShowInMenuHintsToProxyFromProxyGroups(vtkPVXMLElement* root);
254 
256 
267  bool LoadConfigurationXML(vtkPVXMLElement* root, bool attachShowInMenuHints, bool invoke = true,
268  const std::string& ensurePluginLoaded = "");
269  bool LoadConfigurationXMLFromString(const char* xmlContent, bool attachShowInMenuHints,
270  bool invoke = true, const std::string& ensurePluginLoaded = "");
272 
274 
277  void OnPluginLoaded(vtkObject* caller, unsigned long event, void* calldata);
278  void HandlePlugin(vtkPVPlugin*);
280 
285  void AddElement(const char* groupName, const char* proxyName, vtkPVXMLElement* element);
286 
290  bool AddCustomProxyDefinitionInternal(const char* group, const char* name, vtkPVXMLElement* top);
291 
297  void MergeProxyDefinition(vtkPVXMLElement* element, vtkPVXMLElement* elementToFill);
298 
305  void InvalidateCollapsedDefinition();
306 
311  vtkPVXMLElement* GetProxyElement(const char* groupName, const char* proxyName);
312 
317  vtkPVXMLElement* ExtractSubProxy(vtkPVXMLElement* proxyDefinition, const char* subProxyName);
318 
322  void InvokeCustomDefitionsUpdated();
323 
324 private:
326  void operator=(const vtkSIProxyDefinitionManager&) = delete;
327 
328  class vtkInternals;
329  vtkInternals* Internals;
330  vtkInternals* InternalsFlatten;
331 };
332 
333 #endif
virtual void Push(vtkSMMessage *msg)
Push a new state to the underneath implementation The provided implementation just store the message ...
#define VTKREMOTINGSERVERMANAGER_EXPORT
defines the core interface for any ParaView plugin.
Definition: vtkPVPlugin.h:38
static vtkSIObject * New()
name
RegisteredDefinitionInformation(const char *groupName, const char *proxyName, bool isCustom=false)
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
vtkPVXMLElement * GetProxyDefinition(const char *group, const char *name)
Returns a registered proxy definition or return a nullptr otherwise.
virtual void Pull(vtkSMMessage *msg)
Pull the current state of the underneath implementation The provided implementation update the given ...
iterates over all proxy definitions from which the vtkSMProxyManager can use to create new proxy...
Object that is managed by vtkPVSessionCore which wrap concrete class such as the vtk ones...
Definition: vtkSIObject.h:21
#define VTK_NEWINSTANCE
top
object responsible for managing XML proxies definitions
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
vtkPVXMLElement * GetCollapsedProxyDefinition(const char *group, const char *name, const char *subProxyName)
Returns the same thing as GetProxyDefinition in a flatten manner.
void PrintSelf(ostream &os, vtkIndent indent) override