Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLIOProperties.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
18#ifndef __vtkMRMLIOProperties_h
19#define __vtkMRMLIOProperties_h
20
21#include "vtkMRMLLogicExport.h"
22
23#include <vtkObject.h>
24#include <vtkVariant.h>
25
26#include <map>
27#include <string>
28#include <vector>
29
30class vtkVariantArray;
31
36class VTK_MRML_LOGIC_EXPORT vtkMRMLIOProperties : public vtkObject
37{
38public:
40 vtkTypeMacro(vtkMRMLIOProperties, vtkObject);
41 void PrintSelf(ostream& os, vtkIndent indent) override;
42
44 void SetProperty(const std::string& name, const vtkVariant& value);
45 void SetStringProperty(const std::string& name, const std::string& value);
46 void SetIntProperty(const std::string& name, int value);
47 void SetDoubleProperty(const std::string& name, double value);
48 void SetBoolProperty(const std::string& name, bool value);
49
51 void SetStringListProperty(const std::string& name, const std::vector<std::string>& values);
52
55 void SetListProperty(const std::string& name, vtkVariantArray* values);
56
58 void SetMapProperty(const std::string& name, vtkMRMLIOProperties* values);
59
61 void SetObjectProperty(const std::string& name, vtkObject* value);
62
64 vtkVariant GetProperty(const std::string& name) const;
66 std::string GetStringProperty(const std::string& name, const std::string& defaultValue = "") const;
67 int GetIntProperty(const std::string& name, int defaultValue = 0) const;
68 double GetDoubleProperty(const std::string& name, double defaultValue = 0.0) const;
69 bool GetBoolProperty(const std::string& name, bool defaultValue = false) const;
72 std::vector<std::string> GetStringListProperty(const std::string& name) const;
75 bool GetListProperty(const std::string& name, vtkVariantArray* values) const;
78 vtkMRMLIOProperties* GetMapProperty(const std::string& name) const;
80 vtkObject* GetObjectProperty(const std::string& name) const;
81
86 bool IsBoolProperty(const std::string& name) const;
87 bool IsStringListProperty(const std::string& name) const;
88 bool IsListProperty(const std::string& name) const;
89 bool IsMapProperty(const std::string& name) const;
90 bool IsObjectProperty(const std::string& name) const;
91
92 bool HasProperty(const std::string& name) const;
93 void RemoveProperty(const std::string& name);
95
97 std::vector<std::string> GetPropertyNames() const;
98
101
104
105protected:
108
109private:
111 void operator=(const vtkMRMLIOProperties&) = delete;
112
113 std::map<std::string, vtkVariant> Properties;
114 std::vector<std::string> Order;
116 std::vector<std::string> BoolProperties;
117};
118
119#endif
void SetObjectProperty(const std::string &name, vtkObject *value)
Set a property to an object (such as the "screenShot" image of a scene). The object is referenced.
void SetBoolProperty(const std::string &name, bool value)
std::vector< std::string > GetPropertyNames() const
The names of the properties that are set, in the order they were first set.
bool IsMapProperty(const std::string &name) const
bool HasProperty(const std::string &name) const
bool GetBoolProperty(const std::string &name, bool defaultValue=false) const
vtkMRMLIOProperties * GetMapProperty(const std::string &name) const
void SetStringListProperty(const std::string &name, const std::vector< std::string > &values)
Set a property to a list of strings (such as "fileNames").
vtkVariant GetProperty(const std::string &name) const
The value of a property, or an invalid variant if it is not there.
bool IsObjectProperty(const std::string &name) const
bool IsStringListProperty(const std::string &name) const
void SetStringProperty(const std::string &name, const std::string &value)
static vtkMRMLIOProperties * New()
~vtkMRMLIOProperties() override
double GetDoubleProperty(const std::string &name, double defaultValue=0.0) const
void Update(vtkMRMLIOProperties *source)
Add the properties of another set to these, replacing values that are already set.
bool IsBoolProperty(const std::string &name) const
vtkObject * GetObjectProperty(const std::string &name) const
The value of an object property, or nullptr if it is not there or not an object.
std::vector< std::string > GetStringListProperty(const std::string &name) const
void RemoveProperty(const std::string &name)
void SetIntProperty(const std::string &name, int value)
bool GetListProperty(const std::string &name, vtkVariantArray *values) const
void SetDoubleProperty(const std::string &name, double value)
void Copy(vtkMRMLIOProperties *source)
Replace these properties with the properties of another set.
void SetMapProperty(const std::string &name, vtkMRMLIOProperties *values)
Set a property to a nested set of properties (a map). The properties are copied.
void PrintSelf(ostream &os, vtkIndent indent) override
int GetIntProperty(const std::string &name, int defaultValue=0) const
bool IsListProperty(const std::string &name) const
void SetListProperty(const std::string &name, vtkVariantArray *values)
void SetProperty(const std::string &name, const vtkVariant &value)
Set a property. A value that is already there is replaced.
std::string GetStringProperty(const std::string &name, const std::string &defaultValue="") const
The value of a property as a string; defaultValue if it is not there.