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 
111 
114  static std::string rstToHtml(const char* rstStr);
115  static QString rstToHtml(const QString& rstStr);
117 
128  virtual void addHelperProxy(const QString& key, vtkSMProxy*);
129  void removeHelperProxy(const QString& key, vtkSMProxy*);
130 
136  void updateHelperProxies() const;
137 
141  vtkSMSessionProxyManager* proxyManager() const;
142 
148  static pqProxy* findProxyWithHelper(vtkSMProxy* aproxy, QString& key);
149 
154  static pqProxy* findProxy(vtkSMProxy* aproxy);
155 
165  bool userModifiedSMName() { return this->UserModifiedSMName; }
166 
167 Q_SIGNALS:
171  void nameChanged(pqServerManagerModelItem*);
172 
176  void modifiedStateChanged(pqServerManagerModelItem*);
177 
178 protected:
179  friend class pqServerManagerModel;
180 
190  void setSMName(const QString& new_name);
191 
192  // Use this method to initialize the pqObject state using the
193  // underlying vtkSMProxy. This needs to be done only once,
194  // after the object has been created.
195  virtual void initialize();
196 
197  // Method used to update the internal structure without affecting
198  // the ProxyManager proxy registration
199  virtual void addInternalHelperProxy(const QString& key, vtkSMProxy*) const;
200  virtual void removeInternalHelperProxy(const QString& key, vtkSMProxy*) const;
201 
202 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
203  // Used to monitor helper proxy registration when created on other clients
204  void onProxyRegistered(const QString&, const QString&, vtkSMProxy*);
205  void onProxyUnRegistered(const QString&, const QString&, vtkSMProxy*);
206 
207 private:
208  QPointer<pqServer> Server;
209  QString SMName;
210  QString SMGroup;
211  pqProxyInternal* Internal;
212  ModifiedState Modified;
213  bool UserModifiedSMName;
214 };
215 
216 #endif
bool userModifiedSMName()
Return whether or not the user has modified the GUI name of the source.
Definition: pqProxy.h:165
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