Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkConfigurationHolder.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef mitkConfigurationHolder_h
15 #define mitkConfigurationHolder_h
16 
17 #include <MitkCLCoreExports.h>
18 
19 //#include <mitkBaseData.h>
20 
21 // STD Includes
22 #include <string>
23 #include <map>
24 #include <vector>
25 
26 namespace mitk
27 {
42  class MITKCLCORE_EXPORT ConfigurationHolder // : public BaseData
43  {
44  public:
48  enum ValueType
49  {
56  DT_GROUP
57  };
58 
61 
66  void SetBool(bool value);
67 
72  void SetUnsignedInt(unsigned int value);
73 
78  void SetInt(int value);
79 
84  void SetDouble(double value);
85 
90  void SetString(std::string value);
91 
95  void ClearGroup();
96 
105  void AddToGroup(std::string id, const ConfigurationHolder &value);
106 
112  bool AsBool();
113 
119  unsigned int AsUnsignedInt();
120 
126  int AsInt();
127 
133  double AsDouble();
134 
140  std::string AsString();
141 
147  bool AsBool(bool value);
148 
154  unsigned int AsUnsignedInt(unsigned int value);
155 
161  int AsInt(int value);
162 
168  double AsDouble(double value);
169 
175  std::string AsString(std::string value);
176 
185  std::vector<std::string> AsStringVector();
186 
195  ConfigurationHolder& At(std::string id);
196 
197  private:
198  bool m_BoolValue;
199  unsigned int m_UIntValue;
200  int m_IntValue;
201  double m_DoubleValue;
202  std::string m_StringValue;
203 
204  std::map<std::string, ConfigurationHolder> m_GroupValue;
205 
206  ValueType m_ValueType;
207  };
208 }
209 
210 #endif
#define MITKCLCORE_EXPORT
A variant-like container for storing typed configuration values.
std::string AsString(std::string value)
Convert the stored value to string, returning a default on failure.
int AsInt(int value)
Convert the stored value to int, returning a default on failure.
unsigned int AsUnsignedInt()
Convert the stored value to unsigned int.
ConfigurationHolder()
Construct an uninitialized ConfigurationHolder.
void SetInt(int value)
Store a signed integer value.
bool AsBool()
Convert the stored value to bool.
int AsInt()
Convert the stored value to int.
void ClearGroup()
Clear all children from the group and set the type to DT_GROUP.
unsigned int AsUnsignedInt(unsigned int value)
Convert the stored value to unsigned int, returning a default on failure.
double AsDouble(double value)
Convert the stored value to double, returning a default on failure.
ValueType
Enumerates the data types that a ConfigurationHolder can store.
@ DT_DOUBLE
Double-precision floating-point value.
@ DT_UNINIZIALIZED
No value has been set yet.
@ DT_UINT
Unsigned integer value.
@ DT_INT
Signed integer value.
void SetDouble(double value)
Store a double-precision floating-point value.
void AddToGroup(std::string id, const ConfigurationHolder &value)
Add a named child to the group.
void SetBool(bool value)
Store a boolean value.
std::vector< std::string > AsStringVector()
Convert group children to a vector of strings.
bool AsBool(bool value)
Convert the stored value to bool, returning a default on failure.
double AsDouble()
Convert the stored value to double.
void SetString(std::string value)
Store a string value.
void SetUnsignedInt(unsigned int value)
Store an unsigned integer value.
std::string AsString()
Convert the stored value to string.
ConfigurationHolder & At(std::string id)
Access a child ConfigurationHolder by identifier.
Find image slices visible on a given plane.