vtkSMSettings.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
65 #ifndef vtkSMSettings_h
66 #define vtkSMSettings_h
67 
68 #include "vtkObject.h"
69 #include "vtkRemotingServerManagerModule.h" //needed for exports
70 #include <vector> // needed for vector.
71 #include <vtk_jsoncpp_fwd.h> // for forward declarations
72 
73 class vtkSMProperty;
74 class vtkSMProxy;
77 {
78 public:
79  static vtkSMSettings* New();
80  vtkTypeMacro(vtkSMSettings, vtkObject);
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
86  static vtkSMSettings* GetInstance();
87 
95  bool AddCollectionFromString(const std::string& settings, double priority);
96 
101  bool AddCollectionFromFile(const std::string& fileName, double priority);
102 
106  void ClearAllSettings();
107 
111  bool DistributeSettings();
112 
116  bool SaveSettingsToFile(const std::string& filePath);
117 
121  bool HasSetting(const char* settingName);
122 
127  bool HasSetting(const char* settingName, double maxPriority);
128 
132  unsigned int GetSettingNumberOfElements(const char* settingName);
133 
135 
139  int GetSettingAsInt(const char* settingName, int defaultValue);
140  double GetSettingAsDouble(const char* settingName, double defaultValue);
141  std::string GetSettingAsString(const char* settingName, const std::string& defaultValue);
143 
145 
148  int GetSettingAsInt(const char* settingName, unsigned int index, int defaultValue);
149  double GetSettingAsDouble(const char* settingName, unsigned int index, double defaultValue);
150  std::string GetSettingAsString(
151  const char* settingName, unsigned int index, const std::string& defaultValue);
153 
157  bool GetPropertySetting(vtkSMProperty* property);
158 
163  bool GetPropertySetting(vtkSMProperty* property, double maxPriority);
164 
168  bool GetPropertySetting(const char* prefix, vtkSMProperty* property);
169 
174  bool GetPropertySetting(const char* prefix, vtkSMProperty* property, double maxPriority);
175 
179  bool GetProxySettings(vtkSMProxy* proxy);
180 
185  bool GetProxySettings(vtkSMProxy* proxy, double maxPriority);
186 
191  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy);
192 
197  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy, double maxPriority);
198  ;
199 
203  std::string GetSettingDescription(const char* settingName);
204 
206 
210  void SetSetting(const char* settingName, int value);
211  void SetSetting(const char* settingName, double value);
212  void SetSetting(const char* settingName, const std::string& value);
214 
216 
219  void SetSetting(const char* settingName, unsigned int index, int value);
220  void SetSetting(const char* settingName, unsigned int index, double value);
221  void SetSetting(const char* settingName, unsigned int index, const std::string& value);
223 
233  void SetProxySettings(vtkSMProxy* proxy, vtkSMPropertyIterator* propertyIt = nullptr,
234  bool skipPropertiesWithDynamicDomains = true);
235 
245  void SetProxySettings(const char* prefix, vtkSMProxy* proxy,
246  vtkSMPropertyIterator* propertyIt = nullptr, bool skipPropertiesWithDynamicDomains = true);
247 
251  void SetSettingDescription(const char* settingName, const char* description);
252 
257  static Json::Value SerializeAsJSON(vtkSMProxy* proxy, vtkSMPropertyIterator* iter = nullptr);
258 
264  static bool DeserializeFromJSON(vtkSMProxy* proxy, const Json::Value& value);
265 
266 protected:
267  vtkSMSettings();
268  ~vtkSMSettings() override;
269 
270 private:
271  vtkSMSettings(const vtkSMSettings&) = delete;
272  void operator=(const vtkSMSettings&) = delete;
273 
274  class vtkSMSettingsInternal;
275  vtkSMSettingsInternal* Internal;
276 };
277 
278 #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:76
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