ParaView
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 "vtkPVServerManagerCoreModule.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;
34 class vtkEventForwarderCommand;
35 
36 class VTKPVSERVERMANAGERCORE_EXPORT vtkSMProxyDefinitionManager : public vtkSMRemoteObject
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
48  void SynchronizeDefinitions();
49 
55  virtual void SetSession(vtkSMSession*);
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  : NULL;
87  }
88  vtkPVXMLElement* GetProxyDefinition(const char* group, const char* name)
89  {
90  return this->ProxyDefinitionManager
91  ? this->ProxyDefinitionManager->GetProxyDefinition(group, name)
92  : NULL;
93  }
95 
102  const char* group, const char* name, const char* subProxyName, bool throwError)
103  {
104  return this->ProxyDefinitionManager
105  ? this->ProxyDefinitionManager->GetCollapsedProxyDefinition(
106  group, name, subProxyName, throwError)
107  : NULL;
108  }
109 
113  bool HasDefinition(const char* groupName, const char* proxyName)
114  {
115  return this->ProxyDefinitionManager
116  ? this->ProxyDefinitionManager->HasDefinition(groupName, proxyName)
117  : false;
118  }
119 
125  {
126  if (this->ProxyDefinitionManager)
127  {
128  this->ProxyDefinitionManager->SaveCustomProxyDefinitions(root);
129  }
130  }
131 
133 
141  VTK_NEWINSTANCE
143  {
144  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->NewIterator() : NULL;
145  }
146  VTK_NEWINSTANCE
148  {
149  return this->ProxyDefinitionManager ? this->ProxyDefinitionManager->NewIterator(scope) : NULL;
150  }
152 
154 
161  {
162  return this->ProxyDefinitionManager
163  ? this->ProxyDefinitionManager->NewSingleGroupIterator(groupName)
164  : NULL;
165  }
166  vtkPVProxyDefinitionIterator* NewSingleGroupIterator(const char* groupName, int scope)
167  {
168  return this->ProxyDefinitionManager
169  ? this->ProxyDefinitionManager->NewSingleGroupIterator(groupName, scope)
170  : NULL;
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  virtual void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator);
211 
212 protected:
215 
216  vtkEventForwarderCommand* Forwarder;
217  vtkWeakPointer<vtkSIProxyDefinitionManager> ProxyDefinitionManager;
218 
219 private:
220  vtkSMProxyDefinitionManager(const vtkSMProxyDefinitionManager&) VTK_DELETE_FUNCTION;
221  void operator=(const vtkSMProxyDefinitionManager&) VTK_DELETE_FUNCTION;
222 };
223 
224 #endif
vtkEventForwarderCommand * Forwarder
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 ...
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 NULL otherwise.
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:35
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...
virtual void SetSession(vtkSMSession *)
Override the SetSession so if the object already have an ID we automatically register it to the assoc...
iterates over all proxy definitions from which the vtkSMProxyManager can use to create new proxy...
vtkWeakPointer< vtkSIProxyDefinitionManager > ProxyDefinitionManager
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 NULL 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...
void PrintSelf(ostream &os, vtkIndent indent)
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()