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 
40 class VTKREMOTINGSERVERMANAGER_EXPORT vtkSIProxyDefinitionManager : public vtkSIObject
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 
239  void AttachShowInMenuHintsToProxy(vtkPVXMLElement* proxy);
240 
246  void AttachShowInMenuHintsToProxyFromProxyGroups(vtkPVXMLElement* root);
247 
249 
257  bool LoadConfigurationXML(vtkPVXMLElement* root, bool attachShowInMenuHints);
258  bool LoadConfigurationXMLFromString(const char* xmlContent, bool attachShowInMenuHints);
260 
262 
265  void OnPluginLoaded(vtkObject* caller, unsigned long event, void* calldata);
266  void HandlePlugin(vtkPVPlugin*);
268 
273  void AddElement(const char* groupName, const char* proxyName, vtkPVXMLElement* element);
274 
278  bool AddCustomProxyDefinitionInternal(const char* group, const char* name, vtkPVXMLElement* top);
279 
285  void MergeProxyDefinition(vtkPVXMLElement* element, vtkPVXMLElement* elementToFill);
286 
293  void InvalidateCollapsedDefinition();
294 
299  vtkPVXMLElement* GetProxyElement(const char* groupName, const char* proxyName);
300 
305  vtkPVXMLElement* ExtractSubProxy(vtkPVXMLElement* proxyDefinition, const char* subProxyName);
306 
310  void InvokeCustomDefitionsUpdated();
311 
312 private:
314  void operator=(const vtkSIProxyDefinitionManager&) = delete;
315 
316  class vtkInternals;
317  vtkInternals* Internals;
318  vtkInternals* InternalsFlatten;
319 };
320 
321 #endif
vtkSIObject::Push
virtual void Push(vtkSMMessage *msg)
Push a new state to the underneath implementation The provided implementation just store the message ...
vtkSIObject
Definition: vtkSIObject.h:21
vtkPVPlugin
defines the core interface for any ParaView plugin.
Definition: vtkPVPlugin.h:39
vtkSIObject::New
static vtkSIObject * New()
vtkObject
vtkSIProxyDefinitionManager::RegisteredDefinitionInformation
Information object used in Event notification.
Definition: vtkSIProxyDefinitionManager.h:215
vtkSIProxyDefinitionManager::RegisteredDefinitionInformation::CustomDefinition
bool CustomDefinition
Definition: vtkSIProxyDefinitionManager.h:219
vtkSIProxyDefinitionManager::GetCollapsedProxyDefinition
vtkPVXMLElement * GetCollapsedProxyDefinition(const char *group, const char *name, const char *subProxyName)
Returns the same thing as GetProxyDefinition in a flatten manner.
Definition: vtkSIProxyDefinitionManager.h:87
vtkSIProxyDefinitionManager::GetProxyDefinition
vtkPVXMLElement * GetProxyDefinition(const char *group, const char *name)
Returns a registered proxy definition or return a nullptr otherwise.
Definition: vtkSIProxyDefinitionManager.h:67
vtkSIProxyDefinitionManager
object responsible for managing XML proxies definitions
Definition: vtkSIProxyDefinitionManager.h:40
vtkSIProxyDefinitionManager::RegisteredDefinitionInformation::ProxyName
const char * ProxyName
Definition: vtkSIProxyDefinitionManager.h:218
vtkSIProxyDefinitionManager::RegisteredDefinitionInformation::GroupName
const char * GroupName
Definition: vtkSIProxyDefinitionManager.h:217
vtkIndent
vtkSIProxyDefinitionManager::Events
Events
Definition: vtkSIProxyDefinitionManager.h:148
vtkSMMessage
name
name
vtkSIProxyDefinitionManager::RegisteredDefinitionInformation::RegisteredDefinitionInformation
RegisteredDefinitionInformation(const char *groupName, const char *proxyName, bool isCustom=false)
Definition: vtkSIProxyDefinitionManager.h:220
vtkSIObject::Pull
virtual void Pull(vtkSMMessage *msg)
Pull the current state of the underneath implementation The provided implementation update the given ...
vtkPVXMLElement
Definition: vtkPVXMLElement.h:23
vtkPVProxyDefinitionIterator
iterates over all proxy definitions from which the vtkSMProxyManager can use to create new proxy....
Definition: vtkPVProxyDefinitionIterator.h:26
vtkSIObject.h
VTK_NEWINSTANCE
#define VTK_NEWINSTANCE
vtkSIObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override