|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
A variant-like container for storing typed configuration values. More...
#include <mitkConfigurationHolder.h>
Public Types | |
| enum | ValueType { DT_UNINIZIALIZED , DT_BOOL , DT_UINT , DT_INT , DT_DOUBLE , DT_STRING , DT_GROUP } |
| Enumerates the data types that a ConfigurationHolder can store. More... | |
Public Member Functions | |
| ConfigurationHolder () | |
| Construct an uninitialized ConfigurationHolder. More... | |
| void | SetBool (bool value) |
| Store a boolean value. More... | |
| void | SetUnsignedInt (unsigned int value) |
| Store an unsigned integer value. More... | |
| void | SetInt (int value) |
| Store a signed integer value. More... | |
| void | SetDouble (double value) |
| Store a double-precision floating-point value. More... | |
| void | SetString (std::string value) |
| Store a string value. More... | |
| void | ClearGroup () |
| Clear all children from the group and set the type to DT_GROUP. More... | |
| void | AddToGroup (std::string id, const ConfigurationHolder &value) |
| Add a named child to the group. More... | |
| bool | AsBool () |
| Convert the stored value to bool. More... | |
| unsigned int | AsUnsignedInt () |
| Convert the stored value to unsigned int. More... | |
| int | AsInt () |
| Convert the stored value to int. More... | |
| double | AsDouble () |
| Convert the stored value to double. More... | |
| std::string | AsString () |
| Convert the stored value to string. More... | |
| bool | AsBool (bool value) |
| Convert the stored value to bool, returning a default on failure. More... | |
| unsigned int | AsUnsignedInt (unsigned int value) |
| Convert the stored value to unsigned int, returning a default on failure. More... | |
| int | AsInt (int value) |
| Convert the stored value to int, returning a default on failure. More... | |
| double | AsDouble (double value) |
| Convert the stored value to double, returning a default on failure. More... | |
| std::string | AsString (std::string value) |
| Convert the stored value to string, returning a default on failure. More... | |
| std::vector< std::string > | AsStringVector () |
| Convert group children to a vector of strings. More... | |
| ConfigurationHolder & | At (std::string id) |
| Access a child ConfigurationHolder by identifier. More... | |
A variant-like container for storing typed configuration values.
ConfigurationHolder stores a single value of one of several supported types (bool, unsigned int, int, double, string) or a named group of child ConfigurationHolder objects. The stored type is tracked internally, and accessor methods attempt automatic type conversion when possible.
When a value has not been set (DT_UNINIZIALIZED) or when a group value cannot be converted, the accessor methods throw a mitk::Exception.
Definition at line 42 of file mitkConfigurationHolder.h.
Enumerates the data types that a ConfigurationHolder can store.
| Enumerator | |
|---|---|
| DT_UNINIZIALIZED | No value has been set yet. |
| DT_BOOL | Boolean value. |
| DT_UINT | Unsigned integer value. |
| DT_INT | Signed integer value. |
| DT_DOUBLE | Double-precision floating-point value. |
| DT_STRING | String value. |
| DT_GROUP | Group of named ConfigurationHolder children. |
Definition at line 48 of file mitkConfigurationHolder.h.
| mitk::ConfigurationHolder::ConfigurationHolder | ( | ) |
Construct an uninitialized ConfigurationHolder.
| void mitk::ConfigurationHolder::AddToGroup | ( | std::string | id, |
| const ConfigurationHolder & | value | ||
| ) |
Add a named child to the group.
Sets the value type to DT_GROUP.
| [in] | id | The identifier for the child entry. |
| [in] | value | The ConfigurationHolder to add as a child. |
| bool mitk::ConfigurationHolder::AsBool | ( | ) |
Convert the stored value to bool.
| mitk::Exception | If the value is uninitialized or is group data. |
| bool mitk::ConfigurationHolder::AsBool | ( | bool | value | ) |
Convert the stored value to bool, returning a default on failure.
| [in] | value | Default value returned if conversion fails. |
| double mitk::ConfigurationHolder::AsDouble | ( | ) |
Convert the stored value to double.
| mitk::Exception | If the value is uninitialized or is group data. |
| double mitk::ConfigurationHolder::AsDouble | ( | double | value | ) |
Convert the stored value to double, returning a default on failure.
| [in] | value | Default value returned if conversion fails. |
| int mitk::ConfigurationHolder::AsInt | ( | ) |
Convert the stored value to int.
| mitk::Exception | If the value is uninitialized or is group data. |
| int mitk::ConfigurationHolder::AsInt | ( | int | value | ) |
Convert the stored value to int, returning a default on failure.
| [in] | value | Default value returned if conversion fails. |
| std::string mitk::ConfigurationHolder::AsString | ( | ) |
Convert the stored value to string.
| mitk::Exception | If the value is uninitialized or is group data. |
| std::string mitk::ConfigurationHolder::AsString | ( | std::string | value | ) |
Convert the stored value to string, returning a default on failure.
| [in] | value | Default value returned if conversion fails. |
| std::vector<std::string> mitk::ConfigurationHolder::AsStringVector | ( | ) |
Convert group children to a vector of strings.
Each child's value is converted to string via AsString().
| mitk::Exception | If the value type is not DT_GROUP. |
| unsigned int mitk::ConfigurationHolder::AsUnsignedInt | ( | ) |
Convert the stored value to unsigned int.
| mitk::Exception | If the value is uninitialized or is group data. |
| unsigned int mitk::ConfigurationHolder::AsUnsignedInt | ( | unsigned int | value | ) |
Convert the stored value to unsigned int, returning a default on failure.
| [in] | value | Default value returned if conversion fails. |
| ConfigurationHolder& mitk::ConfigurationHolder::At | ( | std::string | id | ) |
Access a child ConfigurationHolder by identifier.
If no child with the given id exists, a default-constructed entry is created.
| [in] | id | The identifier of the child to access. |
| void mitk::ConfigurationHolder::ClearGroup | ( | ) |
Clear all children from the group and set the type to DT_GROUP.
| void mitk::ConfigurationHolder::SetBool | ( | bool | value | ) |
Store a boolean value.
| [in] | value | The boolean value to store. |
| void mitk::ConfigurationHolder::SetDouble | ( | double | value | ) |
Store a double-precision floating-point value.
| [in] | value | The double value to store. |
| void mitk::ConfigurationHolder::SetInt | ( | int | value | ) |
Store a signed integer value.
| [in] | value | The signed integer value to store. |
| void mitk::ConfigurationHolder::SetString | ( | std::string | value | ) |
Store a string value.
| [in] | value | The string value to store. |
| void mitk::ConfigurationHolder::SetUnsignedInt | ( | unsigned int | value | ) |
Store an unsigned integer value.
| [in] | value | The unsigned integer value to store. |