vtkSIProxyDefinitionManager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSIProxyDefinitionManager.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 =========================================================================*/
42 #ifndef vtkSIProxyDefinitionManager_h
43 #define vtkSIProxyDefinitionManager_h
44 
45 #include "vtkRemotingServerManagerModule.h" //needed for exports
46 #include "vtkSIObject.h"
47 
48 class vtkPVPlugin;
50 class vtkPVXMLElement;
51 
53 {
54 public:
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  static vtkTypeUInt32 GetReservedGlobalID();
63 
70  static void PatchXMLProperty(vtkPVXMLElement* propElement);
71 
73 
78  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name, bool throwError);
79  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name)
80  {
81  // We do throw an error by default
82  return this->GetProxyDefinition(group, name, true);
83  }
85 
89  bool HasDefinition(const char* groupName, const char* proxyName);
90 
92 
97  vtkPVXMLElement* GetCollapsedProxyDefinition(
98  const char* group, const char* name, const char* subProxyName, bool throwError);
100  const char* group, const char* name, const char* subProxyName)
101  {
102  return this->GetCollapsedProxyDefinition(group, name, subProxyName, true);
103  }
105 
107 
117  void AddCustomProxyDefinition(const char* group, const char* name, vtkPVXMLElement* top);
118  void AddCustomProxyDefinition(
119  const char* groupName, const char* proxyName, const char* xmlcontents);
121 
128  void RemoveCustomProxyDefinition(const char* group, const char* name);
129 
136  void ClearCustomProxyDefinitions();
137 
139 
142  void LoadCustomProxyDefinitions(vtkPVXMLElement* root);
143  void LoadCustomProxyDefinitionsFromString(const char* xmlContent);
145 
150  void SaveCustomProxyDefinitions(vtkPVXMLElement* root);
151 
153 
156  bool LoadConfigurationXML(vtkPVXMLElement* root);
157  bool LoadConfigurationXMLFromString(const char* xmlContent);
159 
160  enum Events
161  {
162  ProxyDefinitionsUpdated = 2000,
163  CompoundProxyDefinitionsUpdated = 2001
164  };
165 
175  enum
176  {
177  ALL_DEFINITIONS = 0,
178  CORE_DEFINITIONS = 1,
179  CUSTOM_DEFINITIONS = 2
180  };
181 
191  vtkPVProxyDefinitionIterator* NewIterator(int scope = ALL_DEFINITIONS);
192 
199  vtkPVProxyDefinitionIterator* NewSingleGroupIterator(
200  const char* groupName, int scope = ALL_DEFINITIONS);
201 
207  void EnableXMLProxyDefnitionUpdate(bool);
208 
214  void Push(vtkSMMessage* msg) override;
215 
221  void Pull(vtkSMMessage* msg) override;
222 
224 
228  {
229  const char* GroupName;
230  const char* ProxyName;
233  const char* groupName, const char* proxyName, bool isCustom = false)
234  {
235  this->GroupName = groupName;
236  this->ProxyName = proxyName;
237  this->CustomDefinition = isCustom;
238  }
239  };
241 
242 protected:
244  ~vtkSIProxyDefinitionManager() override;
245 
251  void AttachShowInMenuHintsToProxy(vtkPVXMLElement* proxy);
252 
258  void AttachShowInMenuHintsToProxyFromProxyGroups(vtkPVXMLElement* root);
259 
261 
269  bool LoadConfigurationXML(vtkPVXMLElement* root, bool attachShowInMenuHints);
270  bool LoadConfigurationXMLFromString(const char* xmlContent, bool attachShowInMenuHints);
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:52
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 NULL 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:33
#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