pqProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqProxy.h
5 
6  Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 =========================================================================*/
32 
39 #ifndef pqProxy_h
40 #define pqProxy_h
41 
43 #include <QPointer>
44 
45 class pqProxyInternal;
46 class pqServer;
47 class vtkPVXMLElement;
48 class vtkSMProxy;
50 
57 {
58  Q_OBJECT
59 public:
64  {
67  UNMODIFIED
68  };
69 
70  pqProxy(const QString& group, const QString& name, vtkSMProxy* proxy, pqServer* server,
71  QObject* parent = nullptr);
72  ~pqProxy() override;
73 
77  pqServer* getServer() const;
78 
85  void rename(const QString& newname);
86 
92  const QString& getSMName();
93  const QString& getSMGroup();
94 
100  vtkSMProxy* getProxy() const;
101 
108  ModifiedState modifiedState() const { return this->Modified; }
109 
115  void setModifiedState(ModifiedState modified);
116 
121  vtkPVXMLElement* getHints() const;
122 
126  QList<vtkSMProxy*> getHelperProxies() const;
127 
131  QList<vtkSMProxy*> getHelperProxies(const QString& key) const;
132 
136  QList<QString> getHelperKeys() const;
137 
139 
142  static std::string rstToHtml(const char* rstStr);
143  static QString rstToHtml(const QString& rstStr);
145 
156  virtual void addHelperProxy(const QString& key, vtkSMProxy*);
157  void removeHelperProxy(const QString& key, vtkSMProxy*);
158 
164  void updateHelperProxies() const;
165 
169  vtkSMSessionProxyManager* proxyManager() const;
170 
176  static pqProxy* findProxyWithHelper(vtkSMProxy* aproxy, QString& key);
177 
187  bool userModifiedSMName() { return this->UserModifiedSMName; }
188 
189 Q_SIGNALS:
193  void nameChanged(pqServerManagerModelItem*);
194 
198  void modifiedStateChanged(pqServerManagerModelItem*);
199 
200 protected:
201  friend class pqServerManagerModel;
202 
212  void setSMName(const QString& new_name);
213 
214  // Use this method to initialize the pqObject state using the
215  // underlying vtkSMProxy. This needs to be done only once,
216  // after the object has been created.
217  virtual void initialize();
218 
219  // Method used to update the internal structure without affecting
220  // the ProxyManager proxy registration
221  virtual void addInternalHelperProxy(const QString& key, vtkSMProxy*) const;
222  virtual void removeInternalHelperProxy(const QString& key, vtkSMProxy*) const;
223 
224 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
225  // Used to monitor helper proxy registration when created on other clients
226  void onProxyRegistered(const QString&, const QString&, vtkSMProxy*);
227  void onProxyUnRegistered(const QString&, const QString&, vtkSMProxy*);
228 
229 private:
230  QPointer<pqServer> Server;
231  QString SMName;
232  QString SMGroup;
233  pqProxyInternal* Internal;
234  ModifiedState Modified;
235  bool UserModifiedSMName;
236 };
237 
238 #endif
bool userModifiedSMName()
Return whether or not the user has modified the GUI name of the source.
Definition: pqProxy.h:187
ModifiedState
The modification state of this proxy.
Definition: pqProxy.h:63
pqServerManagerModelItem is a element maintained by pqServerManagerModel.
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
virtual void onProxyUnRegistered(const QString &group, const QString &name, vtkSMProxy *proxy)
Called when a proxy is unregistered.
This class represents any registered Server Manager proxy.
Definition: pqProxy.h:56
pqServerManagerModel is the model for the Server Manager.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
virtual void onProxyRegistered(const QString &group, const QString &name, vtkSMProxy *proxy)
Called when a proxy is registered.
ModifiedState modifiedState() const
Gets whether or not the source has been modified.
Definition: pqProxy.h:108
key
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:63