vtkSMSettings.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
76 #ifndef vtkSMSettings_h
77 #define vtkSMSettings_h
78 
79 #include "vtkObject.h"
80 #include "vtkRemotingServerManagerModule.h" //needed for exports
81 #include <vector> // needed for vector.
82 #include <vtk_jsoncpp_fwd.h> // for forward declarations
83 
84 class vtkSMProperty;
85 class vtkSMProxy;
88 {
89 public:
90  static vtkSMSettings* New();
91  vtkTypeMacro(vtkSMSettings, vtkObject);
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
97  static vtkSMSettings* GetInstance();
98 
106  bool AddCollectionFromString(const std::string& settings, double priority);
107 
112  bool AddCollectionFromFile(const std::string& fileName, double priority);
113 
117  void ClearAllSettings();
118 
122  bool DistributeSettings();
123 
127  bool SaveSettingsToFile(const std::string& filePath);
128 
132  bool HasSetting(const char* settingName);
133 
138  bool HasSetting(const char* settingName, double maxPriority);
139 
143  unsigned int GetSettingNumberOfElements(const char* settingName);
144 
146 
150  int GetSettingAsInt(const char* settingName, int defaultValue);
151  double GetSettingAsDouble(const char* settingName, double defaultValue);
152  std::string GetSettingAsString(const char* settingName, const std::string& defaultValue);
154 
156 
159  int GetSettingAsInt(const char* settingName, unsigned int index, int defaultValue);
160  double GetSettingAsDouble(const char* settingName, unsigned int index, double defaultValue);
161  std::string GetSettingAsString(
162  const char* settingName, unsigned int index, const std::string& defaultValue);
164 
168  bool GetPropertySetting(vtkSMProperty* property);
169 
174  bool GetPropertySetting(vtkSMProperty* property, double maxPriority);
175 
179  bool GetPropertySetting(const char* prefix, vtkSMProperty* property);
180 
185  bool GetPropertySetting(const char* prefix, vtkSMProperty* property, double maxPriority);
186 
190  bool GetProxySettings(vtkSMProxy* proxy);
191 
196  bool GetProxySettings(vtkSMProxy* proxy, double maxPriority);
197 
202  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy);
203 
208  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy, double maxPriority);
209  ;
210 
214  std::string GetSettingDescription(const char* settingName);
215 
217 
221  void SetSetting(const char* settingName, int value);
222  void SetSetting(const char* settingName, double value);
223  void SetSetting(const char* settingName, const std::string& value);
225 
227 
230  void SetSetting(const char* settingName, unsigned int index, int value);
231  void SetSetting(const char* settingName, unsigned int index, double value);
232  void SetSetting(const char* settingName, unsigned int index, const std::string& value);
234 
244  void SetProxySettings(vtkSMProxy* proxy, vtkSMPropertyIterator* propertyIt = nullptr,
245  bool skipPropertiesWithDynamicDomains = true);
246 
256  void SetProxySettings(const char* prefix, vtkSMProxy* proxy,
257  vtkSMPropertyIterator* propertyIt = nullptr, bool skipPropertiesWithDynamicDomains = true);
258 
262  void SetSettingDescription(const char* settingName, const char* description);
263 
268  static Json::Value SerializeAsJSON(vtkSMProxy* proxy, vtkSMPropertyIterator* iter = nullptr);
269 
275  static bool DeserializeFromJSON(vtkSMProxy* proxy, const Json::Value& value);
276 
277 protected:
278  vtkSMSettings();
279  ~vtkSMSettings() override;
280 
281 private:
282  vtkSMSettings(const vtkSMSettings&) = delete;
283  void operator=(const vtkSMSettings&) = delete;
284 
285  class vtkSMSettingsInternal;
286  vtkSMSettingsInternal* Internal;
287 };
288 
289 #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:87
superclass for all SM properties
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
static vtkObject * New()
void operator=(const vtkObjectBase &)
iterates over the properties of a proxy