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 
126  bool SaveSettingsToFile(const std::string& filePath);
127 
136  bool SaveSettingsToFile(const std::string& filePath, double priority);
137 
141  bool HasSetting(const char* settingName);
142 
147  bool HasSetting(const char* settingName, double maxPriority);
148 
152  unsigned int GetSettingNumberOfElements(const char* settingName);
153 
155 
159  int GetSettingAsInt(const char* settingName, int defaultValue);
160  double GetSettingAsDouble(const char* settingName, double defaultValue);
161  std::string GetSettingAsString(const char* settingName, const std::string& defaultValue);
163 
165 
168  int GetSettingAsInt(const char* settingName, unsigned int index, int defaultValue);
169  double GetSettingAsDouble(const char* settingName, unsigned int index, double defaultValue);
170  std::string GetSettingAsString(
171  const char* settingName, unsigned int index, const std::string& defaultValue);
173 
177  bool GetPropertySetting(vtkSMProperty* property);
178 
183  bool GetPropertySetting(vtkSMProperty* property, double maxPriority);
184 
188  bool GetPropertySetting(const char* prefix, vtkSMProperty* property);
189 
194  bool GetPropertySetting(const char* prefix, vtkSMProperty* property, double maxPriority);
195 
199  bool GetProxySettings(vtkSMProxy* proxy);
200 
205  bool GetProxySettings(vtkSMProxy* proxy, double maxPriority);
206 
211  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy);
212 
217  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy, double maxPriority);
218  ;
219 
223  std::string GetSettingDescription(const char* settingName);
224 
226 
230  void SetSetting(const char* settingName, int value);
231  void SetSetting(const char* settingName, double value);
232  void SetSetting(const char* settingName, const std::string& value);
234 
236 
239  void SetSetting(const char* settingName, unsigned int index, int value);
240  void SetSetting(const char* settingName, unsigned int index, double value);
241  void SetSetting(const char* settingName, unsigned int index, const std::string& value);
243 
253  void SetProxySettings(vtkSMProxy* proxy, vtkSMPropertyIterator* propertyIt = nullptr,
254  bool skipPropertiesWithDynamicDomains = true);
255 
265  void SetProxySettings(const char* prefix, vtkSMProxy* proxy,
266  vtkSMPropertyIterator* propertyIt = nullptr, bool skipPropertiesWithDynamicDomains = true);
267 
271  void SetSettingDescription(const char* settingName, const char* description);
272 
277  static Json::Value SerializeAsJSON(vtkSMProxy* proxy, vtkSMPropertyIterator* iter = nullptr);
278 
284  static bool DeserializeFromJSON(vtkSMProxy* proxy, const Json::Value& value);
285 
290  static double GetUserPriority();
291 
296  static double GetApplicationPriority();
297 
298 protected:
299  vtkSMSettings();
300  ~vtkSMSettings() override;
301 
302 private:
303  vtkSMSettings(const vtkSMSettings&) = delete;
304  void operator=(const vtkSMSettings&) = delete;
305 
306  class vtkSMSettingsInternal;
307  vtkSMSettingsInternal* Internal;
308 };
309 
310 #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