Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
Medical Imaging Interaction Toolkit
mitk::EnumerationProperty Class Reference

#include <mitkEnumerationProperty.h>

Inheritance diagram for mitk::EnumerationProperty:
Collaboration diagram for mitk::EnumerationProperty:

Public Types

typedef EnumerationProperty Self
 
typedef BaseProperty Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef unsigned int IdType
 
typedef std::map< IdType, std::string > EnumIdsContainerType
 
typedef std::map< std::string, IdTypeEnumStringsContainerType
 
typedef EnumIdsContainerType::const_iterator EnumConstIterator
 
- 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 bool AddEnum (const std::string &name, const IdType &id)
 
virtual bool SetValue (const std::string &name)
 
virtual bool SetValue (const IdType &id)
 
virtual IdType GetValueAsId () const
 
std::string GetValueAsString () const override
 
virtual void Clear ()
 
virtual EnumIdsContainerType::size_type Size () const
 
virtual EnumConstIterator Begin () const
 
virtual EnumConstIterator End () const
 
virtual std::string GetEnumString (const IdType &id) const
 
virtual IdType GetEnumId (const std::string &name) const
 
virtual bool IsValidEnumerationValue (const IdType &id) const
 
virtual bool IsValidEnumerationValue (const std::string &name) const
 
const EnumIdsContainerTypeGetEnumIds () const
 
const EnumStringsContainerTypeGetEnumStrings () const
 
EnumIdsContainerTypeGetEnumIds ()
 
EnumStringsContainerTypeGetEnumStrings ()
 
EnumerationPropertyoperator= (const EnumerationProperty &)=delete
 
- 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 ()
 
- Static Public Member Functions inherited from mitk::BaseProperty
static const char * GetStaticNameOfClass ()
 

Protected Member Functions

 EnumerationProperty ()
 
 EnumerationProperty (const EnumerationProperty &)
 
bool IsEqual (const BaseProperty &property) const override
 
bool Assign (const BaseProperty &property) override
 
virtual itk::LightObject::Pointer InternalClone () const override
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

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

This class may be used to store properties similar to enumeration values. Each enumeration value is identified by an id and a name. Note that both name and id must be unique. Add enumeration values before you use the Get/SetValue methods.

To use this class, create a subclass that adds the possible enumeration values in its constructor. You should override AddEnum() as protected so that the user isn't able to add invalid enumeration values.

As example see mitk::VtkRepresentationProperty or mitk::VtkInterpolationProperty.

Definition at line 43 of file mitkEnumerationProperty.h.

Member Typedef Documentation

◆ ConstPointer

◆ EnumConstIterator

typedef EnumIdsContainerType::const_iterator mitk::EnumerationProperty::EnumConstIterator

Type used for iterators over all defined enumeration values.

Definition at line 68 of file mitkEnumerationProperty.h.

◆ EnumIdsContainerType

Type used to store a mapping from enumeration id to enumeration name.

Definition at line 58 of file mitkEnumerationProperty.h.

◆ EnumStringsContainerType

Type used to store a mapping from enumeration name to enumeration id.

Definition at line 63 of file mitkEnumerationProperty.h.

◆ IdType

typedef unsigned int mitk::EnumerationProperty::IdType

Represents the unique id which is assigned to each enumeration name.

Definition at line 48 of file mitkEnumerationProperty.h.

◆ Pointer

◆ Self

◆ Superclass

Constructor & Destructor Documentation

◆ EnumerationProperty() [1/2]

mitk::EnumerationProperty::EnumerationProperty ( )
protected

Default constructor. The current value of the enumeration is undefined.

Definition at line 16 of file mitkEnumerationProperty.cpp.

◆ EnumerationProperty() [2/2]

mitk::EnumerationProperty::EnumerationProperty ( const EnumerationProperty other)
protected

Definition at line 21 of file mitkEnumerationProperty.cpp.

Member Function Documentation

◆ AddEnum()

bool mitk::EnumerationProperty::AddEnum ( const std::string &  name,
const IdType id 
)
virtual

Adds an enumeration value into the enumeration. The name and id provided must be unique. This is checked while adding the new enumeration value. If it is not unique, false is returned. If addition was successful, true is returned.

Parameters
nameThe unique name of the enumeration value
idThe unique id of the enumeration value
Returns
True, if the name/id combination was successfully added to the enumeration values. Otherwise false.

Reimplemented in mitk::RenderingModeProperty, mitk::PlaneOrientationProperty, mitk::PointSetShapeProperty, mitk::GridRepresentationProperty, mitk::VtkInterpolationProperty, mitk::VtkRepresentationProperty, mitk::VtkScalarModeProperty, mitk::VtkResliceInterpolationProperty, mitk::GridVolumeMapperProperty, mitk::VtkVolumeRenderingProperty, mitk::RegEvalStyleProperty, mitk::RegEvalWipeStyleProperty, mitk::RegVisColorStyleProperty, mitk::RegVisDirectionProperty, mitk::RegVisStyleProperty, and mitk::PlanarFigureControlPointStyleProperty.

Definition at line 29 of file mitkEnumerationProperty.cpp.

References GetEnumIds(), GetEnumStrings(), and IsValidEnumerationValue().

Referenced by mitk::VtkVolumeRenderingProperty::AddEnum(), mitk::VtkResliceInterpolationProperty::AddEnum(), mitk::VtkScalarModeProperty::AddEnum(), mitk::VtkInterpolationProperty::AddEnum(), mitk::VtkRepresentationProperty::AddEnum(), mitk::PointSetShapeProperty::AddEnum(), mitk::PlaneOrientationProperty::AddEnum(), mitk::RenderingModeProperty::AddEnum(), mitk::ModalityProperty::AddEnumerationTypes(), and mitk::ResliceMethodProperty::AddThickSlicesTypes().

◆ Assign()

bool mitk::EnumerationProperty::Assign ( const BaseProperty )
overrideprotectedvirtual

Override this method in subclasses to implement a meaningful assignment. The property argument is guaranteed to be castable to the type of the implementing subclass.

Warning
This is not yet exception aware/safe and if this method returns false, this property's state might be undefined.
Returns
True if the argument could be assigned to this property.

Implements mitk::BaseProperty.

Definition at line 126 of file mitkEnumerationProperty.cpp.

References GetEnumIds(), and GetEnumStrings().

◆ Begin()

mitk::EnumerationProperty::EnumConstIterator mitk::EnumerationProperty::Begin ( ) const
virtual

Provides access to the set of enumeration values. The name can be accessed with iterator->second, the id via iterator->first.

Returns
An iterator over all enumeration values.

Definition at line 92 of file mitkEnumerationProperty.cpp.

References GetEnumIds().

Referenced by QmitkDataNodeSurfaceRepresentationAction::InitializeAction(), and IsEqual().

◆ Clear()

void mitk::EnumerationProperty::Clear ( )
virtual

Clears all enumerations including the current one.

Definition at line 79 of file mitkEnumerationProperty.cpp.

References GetEnumIds(), and GetEnumStrings().

◆ Clone()

Pointer mitk::EnumerationProperty::Clone ( ) const

◆ End()

mitk::EnumerationProperty::EnumConstIterator mitk::EnumerationProperty::End ( ) const
virtual

Specifies the end of the range of enumeration values.

Returns
An iterator pointing past the last enumeration values.

Definition at line 97 of file mitkEnumerationProperty.cpp.

References GetEnumIds().

Referenced by QmitkDataNodeSurfaceRepresentationAction::InitializeAction(), and IsEqual().

◆ GetClassHierarchy()

◆ GetClassName()

◆ GetEnumId()

mitk::EnumerationProperty::IdType mitk::EnumerationProperty::GetEnumId ( const std::string &  name) const
virtual

Returns the id for the given name.

Parameters
nameThe enumeration name for which the id should be determined. If the name is invalid, the return value is unspecified.
Returns
The id of the determined enumeration value.

Definition at line 109 of file mitkEnumerationProperty.cpp.

References GetEnumStrings(), and IsValidEnumerationValue().

Referenced by SetValue().

◆ GetEnumIds() [1/2]

const mitk::EnumerationProperty::EnumIdsContainerType & mitk::EnumerationProperty::GetEnumIds ( ) const

◆ GetEnumIds() [2/2]

mitk::EnumerationProperty::EnumIdsContainerType & mitk::EnumerationProperty::GetEnumIds ( )

Definition at line 148 of file mitkEnumerationProperty.cpp.

◆ GetEnumString()

std::string mitk::EnumerationProperty::GetEnumString ( const IdType id) const
virtual

Returns the name for the given id.

Parameters
idThe id for which the name should be determined. If the id is invalid, the return value is unspecified.
Returns
The name of the determined enumeration value.

Definition at line 102 of file mitkEnumerationProperty.cpp.

References GetEnumIds(), and IsValidEnumerationValue().

Referenced by GetValueAsString().

◆ GetEnumStrings() [1/2]

◆ GetEnumStrings() [2/2]

mitk::EnumerationProperty::EnumStringsContainerType & mitk::EnumerationProperty::GetEnumStrings ( )

Definition at line 158 of file mitkEnumerationProperty.cpp.

◆ GetStaticNameOfClass()

static const char* mitk::EnumerationProperty::GetStaticNameOfClass ( )
inlinestatic

Definition at line 46 of file mitkEnumerationProperty.h.

◆ GetValueAsId()

◆ GetValueAsString()

std::string mitk::EnumerationProperty::GetValueAsString ( ) const
overridevirtual

Returns the name of the current enumeration value. If it was not set so far, the return value is unspecified.

Reimplemented from mitk::BaseProperty.

Definition at line 74 of file mitkEnumerationProperty.cpp.

References GetEnumString().

Referenced by QmitkDataNodeSurfaceRepresentationAction::InitializeAction().

◆ InternalClone()

virtual itk::LightObject::Pointer mitk::EnumerationProperty::InternalClone ( ) const
inlineoverrideprotectedvirtual

Definition at line 181 of file mitkEnumerationProperty.h.

◆ IsEqual()

bool mitk::EnumerationProperty::IsEqual ( const BaseProperty property) const
overrideprotectedvirtual

Override this method in subclasses to implement a meaningful comparison. The property argument is guaranteed to be castable to the type of the implementing subclass.

Implements mitk::BaseProperty.

Definition at line 116 of file mitkEnumerationProperty.cpp.

References Begin(), End(), GetValueAsId(), and Size().

◆ IsValidEnumerationValue() [1/2]

bool mitk::EnumerationProperty::IsValidEnumerationValue ( const IdType id) const
virtual

◆ IsValidEnumerationValue() [2/2]

bool mitk::EnumerationProperty::IsValidEnumerationValue ( const std::string &  name) const
virtual

Determines if a given name is valid.

Parameters
nameThe name to check
Returns
True if the given name is valid. Otherwise false.

Definition at line 143 of file mitkEnumerationProperty.cpp.

References GetEnumStrings().

◆ New()

static Pointer mitk::EnumerationProperty::New ( )
static

◆ operator=()

EnumerationProperty& mitk::EnumerationProperty::operator= ( const EnumerationProperty )
delete

◆ SetValue() [1/2]

bool mitk::EnumerationProperty::SetValue ( const std::string &  name)
virtual

Sets the current value of the enumeration.

Parameters
nameThe name of the enumeration value to set
Returns
True if the value was successfully set. Otherwise false.

Definition at line 43 of file mitkEnumerationProperty.cpp.

References GetEnumId(), and IsValidEnumerationValue().

Referenced by mitk::GridRepresentationProperty::GridRepresentationProperty(), mitk::GridVolumeMapperProperty::GridVolumeMapperProperty(), QmitkDataNodeSurfaceRepresentationAction::InitializeAction(), mitkPointSetVtkMapper2DGlyphTypeTest(), mitk::ModalityProperty::ModalityProperty(), mitk::PlanarFigureControlPointStyleProperty::PlanarFigureControlPointStyleProperty(), mitk::PlaneOrientationProperty::PlaneOrientationProperty(), mitk::PointSetShapeProperty::PointSetShapeProperty(), mitk::RegEvalStyleProperty::RegEvalStyleProperty(), mitk::RegEvalWipeStyleProperty::RegEvalWipeStyleProperty(), mitk::RegVisColorStyleProperty::RegVisColorStyleProperty(), mitk::RegVisDirectionProperty::RegVisDirectionProperty(), mitk::RegVisStyleProperty::RegVisStyleProperty(), mitk::RenderingModeProperty::RenderingModeProperty(), mitk::ResliceMethodProperty::ResliceMethodProperty(), mitk::VtkResliceInterpolationProperty::SetInterpolationToCubic(), mitk::VtkInterpolationProperty::SetInterpolationToFlat(), mitk::VtkInterpolationProperty::SetInterpolationToGouraud(), mitk::VtkResliceInterpolationProperty::SetInterpolationToLinear(), mitk::VtkResliceInterpolationProperty::SetInterpolationToNearest(), mitk::VtkInterpolationProperty::SetInterpolationToPhong(), mitk::PlaneOrientationProperty::SetPlaneDecorationToNegativeOrientation(), mitk::PlaneOrientationProperty::SetPlaneDecorationToNone(), mitk::PlaneOrientationProperty::SetPlaneDecorationToPositiveOrientation(), mitk::VtkVolumeRenderingProperty::SetRenderingTypeToComposite(), mitk::VtkVolumeRenderingProperty::SetRenderingTypeToMIP(), mitk::VtkRepresentationProperty::SetRepresentationToPoints(), mitk::GridRepresentationProperty::SetRepresentationToPoints(), mitk::VtkRepresentationProperty::SetRepresentationToSurface(), mitk::GridRepresentationProperty::SetRepresentationToSurface(), mitk::VtkRepresentationProperty::SetRepresentationToWireframe(), mitk::GridRepresentationProperty::SetRepresentationToWireframe(), mitk::VtkScalarModeProperty::SetScalarModeToCellData(), mitk::VtkScalarModeProperty::SetScalarModeToCellFieldData(), mitk::VtkScalarModeProperty::SetScalarModeToDefault(), mitk::VtkScalarModeProperty::SetScalarModeToPointData(), mitk::VtkScalarModeProperty::SetScalarModeToPointFieldData(), mitk::PlanarFigureControlPointStyleProperty::SetShape(), mitk::GridVolumeMapperProperty::SetVolumeMapperToPT(), mitk::GridVolumeMapperProperty::SetVolumeMapperToRayCast(), mitk::GridVolumeMapperProperty::SetVolumeMapperToZSweep(), mitk::VtkInterpolationProperty::VtkInterpolationProperty(), mitk::VtkRepresentationProperty::VtkRepresentationProperty(), mitk::VtkResliceInterpolationProperty::VtkResliceInterpolationProperty(), mitk::VtkScalarModeProperty::VtkScalarModeProperty(), and mitk::VtkVolumeRenderingProperty::VtkVolumeRenderingProperty().

◆ SetValue() [2/2]

bool mitk::EnumerationProperty::SetValue ( const IdType id)
virtual

Sets the current value of the enumeration.

Parameters
idThe id of the enumeration value to set
Returns
True, if the value was successfully set. Otherwise false.

Definition at line 56 of file mitkEnumerationProperty.cpp.

References IsValidEnumerationValue().

◆ Size()

mitk::EnumerationProperty::EnumIdsContainerType::size_type mitk::EnumerationProperty::Size ( ) const
virtual

Determines the number of enumeration values.

Definition at line 87 of file mitkEnumerationProperty.cpp.

References GetEnumIds().

Referenced by mitk::ModalityProperty::AddEnumerationTypes(), and IsEqual().


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