ParaView
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 "vtkPVServerManagerCoreModule.h" //needed for exports
81 #include "vtkStdString.h" // needed for vtkStdString.
82 #include <vector> // needed for vector.
83 
84 namespace Json
85 {
86 class Value;
87 }
88 
89 class vtkSMProperty;
90 class vtkSMProxy;
92 class VTKPVSERVERMANAGERCORE_EXPORT vtkSMSettings : public vtkObject
93 {
94 public:
95  static vtkSMSettings* New();
96  vtkTypeMacro(vtkSMSettings, vtkObject);
97  void PrintSelf(ostream& os, vtkIndent indent);
98 
102  static vtkSMSettings* GetInstance();
103 
111  bool AddCollectionFromString(const std::string& settings, double priority);
112 
117  bool AddCollectionFromFile(const std::string& fileName, double priority);
118 
122  void ClearAllSettings();
123 
127  bool DistributeSettings();
128 
132  bool SaveSettingsToFile(const std::string& filePath);
133 
137  bool HasSetting(const char* settingName);
138 
143  bool HasSetting(const char* settingName, double maxPriority);
144 
148  unsigned int GetSettingNumberOfElements(const char* settingName);
149 
151 
155  int GetSettingAsInt(const char* settingName, int defaultValue);
156  double GetSettingAsDouble(const char* settingName, double defaultValue);
157  std::string GetSettingAsString(const char* settingName, const std::string& defaultValue);
159 
161 
164  int GetSettingAsInt(const char* settingName, unsigned int index, int defaultValue);
165  double GetSettingAsDouble(const char* settingName, unsigned int index, double defaultValue);
166  std::string GetSettingAsString(
167  const char* settingName, unsigned int index, const std::string& defaultValue);
169 
173  bool GetPropertySetting(vtkSMProperty* property);
174 
179  bool GetPropertySetting(vtkSMProperty* property, double maxPriority);
180 
184  bool GetPropertySetting(const char* prefix, vtkSMProperty* property);
185 
190  bool GetPropertySetting(const char* prefix, vtkSMProperty* property, double maxPriority);
191 
195  bool GetProxySettings(vtkSMProxy* proxy);
196 
201  bool GetProxySettings(vtkSMProxy* proxy, double maxPriority);
202 
207  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy);
208 
213  bool GetProxySettings(const char* prefix, vtkSMProxy* proxy, double maxPriority);
214  ;
215 
219  std::string GetSettingDescription(const char* settingName);
220 
222 
226  void SetSetting(const char* settingName, int value);
227  void SetSetting(const char* settingName, double value);
228  void SetSetting(const char* settingName, const std::string& value);
230 
232 
235  void SetSetting(const char* settingName, unsigned int index, int value);
236  void SetSetting(const char* settingName, unsigned int index, double value);
237  void SetSetting(const char* settingName, unsigned int index, const std::string& value);
239 
249  void SetProxySettings(vtkSMProxy* proxy, vtkSMPropertyIterator* propertyIt = NULL,
250  bool skipPropertiesWithDynamicDomains = true);
251 
261  void SetProxySettings(const char* prefix, vtkSMProxy* proxy,
262  vtkSMPropertyIterator* propertyIt = NULL, bool skipPropertiesWithDynamicDomains = true);
263 
267  void SetSettingDescription(const char* settingName, const char* description);
268 
273  static Json::Value SerializeAsJSON(vtkSMProxy* proxy, vtkSMPropertyIterator* iter = NULL);
274 
280  static bool DeserializeFromJSON(vtkSMProxy* proxy, const Json::Value& value);
281 
282 protected:
283  vtkSMSettings();
284  virtual ~vtkSMSettings();
285 
286 private:
287  vtkSMSettings(const vtkSMSettings&) VTK_DELETE_FUNCTION;
288  void operator=(const vtkSMSettings&) VTK_DELETE_FUNCTION;
289 
290  class vtkSMSettingsInternal;
291  vtkSMSettingsInternal* Internal;
292 };
293 
294 #endif
vtkSMSettings provides the underlying mechanism for setting default property values in ParaView...
Definition: vtkSMSettings.h:92
superclass for all SM properties
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
iterates over the properties of a proxy