vtkSMSettings.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
67 #ifndef vtkSMSettings_h
68 #define vtkSMSettings_h
69 
70 #include "vtkObject.h"
71 #include "vtkRemotingServerManagerModule.h" //needed for exports
72 #include <vector> // needed for vector.
73 #include <vtk_jsoncpp_fwd.h> // for forward declarations
74 
75 class vtkSMProperty;
76 class vtkSMProxy;
79 {
80 public:
81  static vtkSMSettings* New();
82  vtkTypeMacro(vtkSMSettings, vtkObject);
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
88  static vtkSMSettings* GetInstance();
89 
98  bool AddCollectionFromString(const std::string& settings, double priority);
99 
105  bool AddCollectionFromFile(const std::string& fileName, double priority);
106 
114  void ClearAllSettings();
115 
119  bool DistributeSettings();
120 
124  bool SaveSettingsToFile(const std::string& filePath);
125 
129  bool HasSetting(const char* settingName);
130 
135  bool HasSetting(const char* settingName, double maxPriority);
136 
140  unsigned int GetSettingNumberOfElements(const char* settingName);
141 
143 
147  int GetSettingAsInt(const char* settingName, int defaultValue);
148  double GetSettingAsDouble(const char* settingName, double defaultValue);
149  std::string GetSettingAsString(const char* settingName, const std::string& defaultValue);
151 
153 
156  int GetSettingAsInt(const char* settingName, unsigned int index, int defaultValue);
157  double GetSettingAsDouble(const char* settingName, unsigned int index, double defaultValue);
158  std::string GetSettingAsString(
159  const char* settingName, unsigned int index, const std::string& defaultValue);
161 
165  bool GetPropertySetting(vtkSMProperty* property);
166 
171  bool GetPropertySetting(vtkSMProperty* property, double maxPriority);
172 
176  bool GetPropertySetting(const char* prefix, vtkSMProperty* property);
177 
182  bool GetPropertySetting(const char* prefix, vtkSMProperty* property, double maxPriority);
183 
187  bool GetProxySettings(vtkSMProxy* proxy);
188 
193  bool GetProxySettings(vtkSMProxy* proxy, double maxPriority);
194 
199  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy);
200 
205  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy, double maxPriority);
206  ;
207 
211  std::string GetSettingDescription(const char* settingName);
212 
214 
218  void SetSetting(const char* settingName, int value);
219  void SetSetting(const char* settingName, double value);
220  void SetSetting(const char* settingName, const std::string& value);
222 
224 
227  void SetSetting(const char* settingName, unsigned int index, int value);
228  void SetSetting(const char* settingName, unsigned int index, double value);
229  void SetSetting(const char* settingName, unsigned int index, const std::string& value);
231 
241  void SetProxySettings(vtkSMProxy* proxy, vtkSMPropertyIterator* propertyIt = nullptr,
242  bool skipPropertiesWithDynamicDomains = true);
243 
253  void SetProxySettings(const char* prefix, vtkSMProxy* proxy,
254  vtkSMPropertyIterator* propertyIt = nullptr, bool skipPropertiesWithDynamicDomains = true);
255 
259  void SetSettingDescription(const char* settingName, const char* description);
260 
265  static Json::Value SerializeAsJSON(vtkSMProxy* proxy, vtkSMPropertyIterator* iter = nullptr);
266 
272  static bool DeserializeFromJSON(vtkSMProxy* proxy, const Json::Value& value);
273 
278  static double GetUserPriority();
279 
284  static double GetApplicationPriority();
285 
286 protected:
287  vtkSMSettings();
288  ~vtkSMSettings() override;
289 
290 private:
291  vtkSMSettings(const vtkSMSettings&) = delete;
292  void operator=(const vtkSMSettings&) = delete;
293 
294  class vtkSMSettingsInternal;
295  vtkSMSettingsInternal* Internal;
296 };
297 
298 #endif
#define VTKREMOTINGSERVERMANAGER_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkSMSettings provides the underlying mechanism for setting default property values in ParaView...
Definition: vtkSMSettings.h:78
superclass for all SM properties
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
static vtkObject * New()
void operator=(const vtkObjectBase &)
iterates over the properties of a proxy