pqProxy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
11 #ifndef pqProxy_h
12 #define pqProxy_h
13 
15 #include <QPointer>
16 
17 class pqProxyInternal;
18 class pqServer;
19 class vtkPVXMLElement;
20 class vtkSMProxy;
22 
28 class PQCORE_EXPORT pqProxy : public pqServerManagerModelItem
29 {
30  Q_OBJECT
31 public:
36  {
39  UNMODIFIED
40  };
41 
42  pqProxy(const QString& group, const QString& name, vtkSMProxy* proxy, pqServer* server,
43  QObject* parent = nullptr);
44  ~pqProxy() override;
45 
49  pqServer* getServer() const;
50 
57  void rename(const QString& newname);
58 
64  const QString& getSMName();
65  const QString& getSMGroup();
66 
72  vtkSMProxy* getProxy() const;
73 
80  ModifiedState modifiedState() const { return this->Modified; }
81 
87  void setModifiedState(ModifiedState modified);
88 
93  vtkPVXMLElement* getHints() const;
94 
98  QList<vtkSMProxy*> getHelperProxies() const;
99 
103  QList<vtkSMProxy*> getHelperProxies(const QString& key) const;
104 
108  QList<QString> getHelperKeys() const;
109 
120  virtual void addHelperProxy(const QString& key, vtkSMProxy*);
121  void removeHelperProxy(const QString& key, vtkSMProxy*);
122 
128  void updateHelperProxies() const;
129 
133  vtkSMSessionProxyManager* proxyManager() const;
134 
140  static pqProxy* findProxyWithHelper(vtkSMProxy* aproxy, QString& key);
141 
146  static pqProxy* findProxy(vtkSMProxy* aproxy);
147 
157  bool userModifiedSMName() { return this->UserModifiedSMName; }
158 
159 Q_SIGNALS:
163  void nameChanged(pqServerManagerModelItem*);
164 
168  void modifiedStateChanged(pqServerManagerModelItem*);
169 
170 protected:
171  friend class pqServerManagerModel;
172 
182  void setSMName(const QString& new_name);
183 
184  // Use this method to initialize the pqObject state using the
185  // underlying vtkSMProxy. This needs to be done only once,
186  // after the object has been created.
187  virtual void initialize();
188 
189  // Method used to update the internal structure without affecting
190  // the ProxyManager proxy registration
191  virtual void addInternalHelperProxy(const QString& key, vtkSMProxy*) const;
192  virtual void removeInternalHelperProxy(const QString& key, vtkSMProxy*) const;
193 
194 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
195  // Used to monitor helper proxy registration when created on other clients
196  void onProxyRegistered(const QString&, const QString&, vtkSMProxy*);
197  void onProxyUnRegistered(const QString&, const QString&, vtkSMProxy*);
198 
199 private:
200  QPointer<pqServer> Server;
201  QString SMName;
202  QString SMGroup;
203  pqProxyInternal* Internal;
204  ModifiedState Modified;
205  bool UserModifiedSMName;
206 };
207 
208 #endif
bool userModifiedSMName()
Return whether or not the user has modified the GUI name of the source.
Definition: pqProxy.h:157
ModifiedState
The modification state of this proxy.
Definition: pqProxy.h:35
pqServerManagerModelItem is a element maintained by pqServerManagerModel.
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:28
pqServerManagerModel is the model for the Server Manager.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
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:80
key
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:37