vtkSMProxyDefinitionManager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
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 =========================================================================*/
24 #ifndef vtkSMProxyDefinitionManager_h
25 #define vtkSMProxyDefinitionManager_h
26 
27 #include "vtkRemotingServerManagerModule.h" //needed for exports
28 #include "vtkSIProxyDefinitionManager.h" // needed for enums
29 #include "vtkSMMessageMinimal.h" // needed
30 #include "vtkSMRemoteObject.h"
31 #include "vtkWeakPointer.h" // needed for weak pointer.
32 
33 class vtkSMProxyLocator;
35 
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
48  void SynchronizeDefinitions();
49 
55  void SetSession(vtkSMSession*) override;
56 
57  //***************************************************************************
58  // enums re-defined from vtkSIProxyDefinitionManager for convenience.
59  enum Events
60  {
63  };
64 
65  enum
66  {
70  };
71 
72  //***************************************************************************
73  // Methods simply forwarded to the client-side vtkSIProxyDefinitionManager
74  // instance.
75 
77 
82  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name, bool throwError)
83  {
84  return this->ProxyDefinitionManager
85  ? this->ProxyDefinitionManager->GetProxyDefinition(group, name, throwError)
86  : nullptr;
87  }
88  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name)
89  {
90  return this->ProxyDefinitionManager
91  ? this->ProxyDefinitionManager->GetProxyDefinition(group, name)
92  : nullptr;
93  }
95 
102  const char* group, const char* name, const char* subProxyName, bool throwError)
103  {
104  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->GetCollapsedProxyDefinition(
105  group, name, subProxyName, throwError)
106  : nullptr;
107  }
108 
112  bool HasDefinition(const char* groupName, const char* proxyName)
113  {
114  return this->ProxyDefinitionManager
115  ? this->ProxyDefinitionManager->HasDefinition(groupName, proxyName)
116  : false;
117  }
118 
124  {
125  if (this->ProxyDefinitionManager)
126  {
127  this->ProxyDefinitionManager->SaveCustomProxyDefinitions(root);
128  }
129  }
130 
132 
142  {
143  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->NewIterator() : nullptr;
144  }
147  {
148  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->NewIterator(scope)
149  : nullptr;
150  }
152 
154 
161  {
162  return this->ProxyDefinitionManager
163  ? this->ProxyDefinitionManager->NewSingleGroupIterator(groupName)
164  : nullptr;
165  }
166  vtkPVProxyDefinitionIterator* NewSingleGroupIterator(const char* groupName, int scope)
167  {
168  return this->ProxyDefinitionManager
169  ? this->ProxyDefinitionManager->NewSingleGroupIterator(groupName, scope)
170  : nullptr;
171  }
173 
174  //***************************************************************************
175  // Methods that ensure that the command takes effect on all instances of
176  // vtkSIProxyDefinitionManager across all processes.
177 
179 
182  void AddCustomProxyDefinition(const char* group, const char* name, vtkPVXMLElement* top);
183  void RemoveCustomProxyDefinition(const char* group, const char* name);
184  void ClearCustomProxyDefinitions();
186 
188 
191  void LoadCustomProxyDefinitions(vtkPVXMLElement* root);
192  void LoadCustomProxyDefinitionsFromString(const char* xmlContent);
194 
196 
199  bool LoadConfigurationXML(vtkPVXMLElement* root);
200  bool LoadConfigurationXMLFromString(const char* xmlContent);
202 
210  void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator) override;
211 
212 protected:
214  ~vtkSMProxyDefinitionManager() override;
215 
218 
219 private:
221  void operator=(const vtkSMProxyDefinitionManager&) = delete;
222 };
223 
224 #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:35
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