Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitk::GenericProperty< T > Class Template Reference

#include <mitkGenericProperty.h>

Inheritance diagram for mitk::GenericProperty< T >:
Collaboration diagram for mitk::GenericProperty< T >:

Public Types

typedef GenericProperty Self
 
typedef BaseProperty Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef T ValueType
 
- Public Types inherited from mitk::BaseProperty
typedef BaseProperty Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const override
 
virtual const char * GetClassName () const
 
Pointer Clone () const
 
virtual void SetValue (T _arg)
 
virtual T GetValue () const
 
std::string GetValueAsString () const override
 
bool ToJSON (nlohmann::json &) const override
 Serialize property value(s) to JSON. More...
 
bool FromJSON (const nlohmann::json &) override
 Deserialize property value(s) from JSON. More...
 
BasePropertyoperator= (const BaseProperty &property)
 Assigns property to this BaseProperty instance. More...
 
- Public Member Functions inherited from mitk::BaseProperty
Pointer Clone () const
 
bool operator== (const BaseProperty &property) const
 Subclasses must implement IsEqual(const BaseProperty&) to support comparison. More...
 
BasePropertyoperator= (const BaseProperty &property)
 Assigns property to this BaseProperty instance. More...
 
bool AssignProperty (const BaseProperty &property)
 Assigns property to this BaseProperty instance. More...
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New (T _arg)
 
- Static Public Member Functions inherited from mitk::BaseProperty
static const char * GetStaticNameOfClass ()
 

Protected Member Functions

 GenericProperty ()
 
 GenericProperty (T x)
 
 GenericProperty (const GenericProperty &other)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

Protected Attributes

m_Value
 

Additional Inherited Members

- Static Public Attributes inherited from mitk::BaseProperty
static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING
 Default return value if a property which can not be returned as string. More...
 

Detailed Description

template<typename T>
class mitk::GenericProperty< T >

@ brief Template class for generating properties for int, float, bool, etc.

This class template can be instantiated for all classes/internal types that fulfills these requirements:

  • an operator<< so that the properties value can be put into a std::stringstream
  • an operator== so that two properties can be checked for equality

Note: you must use the macros mitkDeclareGenericProperty and mitkDefineGenericProperty to provide specializations for concrete types (e.g. BoolProperty). See mitkProperties.h for examples. If you don't use these macros, GetNameOfClass() will return "GenericProperty", which will mess up serialization for example.

Definition at line 46 of file mitkGenericProperty.h.

Member Typedef Documentation

◆ ConstPointer

template<typename T >
typedef itk::SmartPointer<const Self> mitk::GenericProperty< T >::ConstPointer

Definition at line 49 of file mitkGenericProperty.h.

◆ Pointer

template<typename T >
typedef itk::SmartPointer<Self> mitk::GenericProperty< T >::Pointer

Definition at line 49 of file mitkGenericProperty.h.

◆ Self

template<typename T >
typedef GenericProperty mitk::GenericProperty< T >::Self

Definition at line 49 of file mitkGenericProperty.h.

◆ Superclass

template<typename T >
typedef BaseProperty mitk::GenericProperty< T >::Superclass

Definition at line 49 of file mitkGenericProperty.h.

◆ ValueType

template<typename T >
typedef T mitk::GenericProperty< T >::ValueType

Definition at line 51 of file mitkGenericProperty.h.

Constructor & Destructor Documentation

◆ GenericProperty() [1/3]

template<typename T >
mitk::GenericProperty< T >::GenericProperty ( )
inlineprotected

Definition at line 78 of file mitkGenericProperty.h.

◆ GenericProperty() [2/3]

template<typename T >
mitk::GenericProperty< T >::GenericProperty ( x)
inlineprotected

Definition at line 79 of file mitkGenericProperty.h.

◆ GenericProperty() [3/3]

template<typename T >
mitk::GenericProperty< T >::GenericProperty ( const GenericProperty< T > &  other)
inlineprotected

Definition at line 80 of file mitkGenericProperty.h.

Member Function Documentation

◆ Clone()

template<typename T >
Pointer mitk::GenericProperty< T >::Clone ( ) const

◆ FromJSON()

template<typename T >
bool mitk::GenericProperty< T >::FromJSON ( const nlohmann::json j)
inlineoverridevirtual

Deserialize property value(s) from JSON.

Rely on exceptions for error handling when implementing deserialization.

Returns
False if not deserializable by design, true otherwise.

Implements mitk::BaseProperty.

Definition at line 70 of file mitkGenericProperty.h.

◆ GetClassHierarchy()

template<typename T >
virtual std::vector<std::string> mitk::GenericProperty< T >::GetClassHierarchy ( ) const
inlineoverridevirtual

Reimplemented from mitk::BaseProperty.

Definition at line 49 of file mitkGenericProperty.h.

◆ GetClassName()

template<typename T >
virtual const char* mitk::GenericProperty< T >::GetClassName ( ) const
virtual

Reimplemented from mitk::BaseProperty.

◆ GetStaticNameOfClass()

template<typename T >
static const char* mitk::GenericProperty< T >::GetStaticNameOfClass ( )
inlinestatic

Definition at line 49 of file mitkGenericProperty.h.

◆ GetValue()

◆ GetValueAsString()

template<typename T >
std::string mitk::GenericProperty< T >::GetValueAsString ( ) const
inlineoverridevirtual

Reimplemented from mitk::BaseProperty.

Definition at line 58 of file mitkGenericProperty.h.

◆ New()

template<typename T >
static Pointer mitk::GenericProperty< T >::New ( _arg)
inlinestatic

Definition at line 50 of file mitkGenericProperty.h.

◆ operator=()

template<typename T >
BaseProperty& mitk::BaseProperty::operator=

Assigns property to this BaseProperty instance.

Subclasses must implement Assign(const BaseProperty&) and call the superclass Assign method for proper handling of polymorphic assignments. The assignment operator of the subclass should be disabled and the baseclass operator should be made visible using "using" statements.

◆ SetValue()

template<typename T >
virtual void mitk::GenericProperty< T >::SetValue ( _arg)
virtual

◆ ToJSON()

template<typename T >
bool mitk::GenericProperty< T >::ToJSON ( nlohmann::json j) const
inlineoverridevirtual

Serialize property value(s) to JSON.

Rely on exceptions for error handling when implementing serialization.

Returns
False if not serializable by design, true otherwise.

Implements mitk::BaseProperty.

Definition at line 65 of file mitkGenericProperty.h.

Member Data Documentation

◆ m_Value

template<typename T >
T mitk::GenericProperty< T >::m_Value
protected

Definition at line 81 of file mitkGenericProperty.h.


The documentation for this class was generated from the following file: