Medical Imaging Interaction Toolkit  2016.11.0
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
 
virtual 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 &val) const
 
virtual bool IsValidEnumerationValue (const std::string &val) const
 
const EnumIdsContainerTypeGetEnumIds () const
 
const EnumStringsContainerTypeGetEnumStrings () const
 
EnumIdsContainerTypeGetEnumIds ()
 
EnumStringsContainerTypeGetEnumStrings ()
 
- 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 &)
 
virtual bool IsEqual (const BaseProperty &property) const override
 
virtual bool Assign (const BaseProperty &property) override
 
itk::LightObject::Pointer InternalClone () const override
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
virtual ~BaseProperty ()
 

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 via a string representation and a id. Note, that both string representation and id MUST be unique. This is checked when inserting a new enumeration value. Please note that you have to add valid enumeration values before you may use the Get/SetValue methods.

To use the class enumeration property you have 2 choices:

  1. Directly use the class and add your possible enumeration values via AddEnum(name, id). NOte that the ids do not have to be in any order, they just have to be unique. The current value is set via SetValue(...) and retrieved via GetValueAsId() or GetValueAsString().
  2. Create a subclass, which adds the possible enumeration values in its constructor and maybe adds some additional convenience functions to set/get the value. NOte that you should override AddEnum(...) as protected so that the user may not add additional invalid enumeration values. As example see mitk::VtkRepresentationProperty or mitk::VtkInterpolationProperty

Definition at line 52 of file mitkEnumerationProperty.h.

Member Typedef Documentation

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

Type used for iterators over all defined enumeration values.

Definition at line 79 of file mitkEnumerationProperty.h.

Type used to store a mapping from enumeration id to enumeration string/ description

Definition at line 68 of file mitkEnumerationProperty.h.

Type used to store a mapping from enumeration string/description to enumeration id

Definition at line 74 of file mitkEnumerationProperty.h.

typedef unsigned int mitk::EnumerationProperty::IdType

Represents the unique id which is asigned to each enumeration value

Definition at line 62 of file mitkEnumerationProperty.h.

Constructor & Destructor Documentation

mitk::EnumerationProperty::EnumerationProperty ( )
protected

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

Definition at line 25 of file mitkEnumerationProperty.cpp.

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

Definition at line 30 of file mitkEnumerationProperty.cpp.

Member Function Documentation

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 string representation of the enumeration value
idthe unique integer representation of the enumeration value
Returns
true, if the name/id combination was successfully added to the enumeration values or true otherwise

Reimplemented in mitk::RenderingModeProperty, mitk::PlaneOrientationProperty, mitk::PointSetShapeProperty, mitk::GridRepresentationProperty, mitk::OdfNormalizationMethodProperty, mitk::VtkInterpolationProperty, mitk::VtkRepresentationProperty, mitk::VtkScalarModeProperty, mitk::VtkResliceInterpolationProperty, mitk::ShaderProperty, mitk::GridVolumeMapperProperty, mitk::VtkVolumeRenderingProperty, mitk::OdfScaleByProperty, mitk::RegEvalStyleProperty, mitk::RegEvalWipeStyleProperty, mitk::RegVisColorStyleProperty, mitk::RegVisDirectionProperty, mitk::RegVisStyleProperty, mitk::ConnectomicsRenderingEdgeColorParameterProperty, mitk::ConnectomicsRenderingEdgeFilteringProperty, mitk::ConnectomicsRenderingEdgeRadiusParameterProperty, mitk::ConnectomicsRenderingEdgeThresholdParameterProperty, mitk::ConnectomicsRenderingNodeColorParameterProperty, mitk::ConnectomicsRenderingNodeFilteringProperty, mitk::ConnectomicsRenderingNodeRadiusParameterProperty, mitk::ConnectomicsRenderingNodeThresholdParameterProperty, mitk::ConnectomicsRenderingSchemeProperty, and mitk::PlanarFigureControlPointStyleProperty.

Definition at line 35 of file mitkEnumerationProperty.cpp.

Referenced by mitk::PlaneOrientationProperty::AddEnum().

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 140 of file mitkEnumerationProperty.cpp.

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

Provides access to the set of known enumeration values. The string representation may be accessed via iterator->second, the id may be access via iterator->first

Returns
an iterator over all enumeration values.

Definition at line 99 of file mitkEnumerationProperty.cpp.

Referenced by QmitkDataManagerView::SurfaceRepresentationMenuAboutToShow().

void mitk::EnumerationProperty::Clear ( )
virtual

Clears all possible enumeration values and the current enumeration value.

Definition at line 87 of file mitkEnumerationProperty.cpp.

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

Specifies the end of the range of the known enumeration values.

Returns
an iterator pointing past the last known element of the possible enumeration values.

Definition at line 104 of file mitkEnumerationProperty.cpp.

Referenced by QmitkDataManagerView::SurfaceRepresentationMenuAboutToShow().

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

Returns the integer representation for the given string.

Parameters
namethe enumeration name for which the integer representation should be determined if the name is invalid, the return value is unspecified.
Returns
the integer representation of the given enumeration value

Definition at line 121 of file mitkEnumerationProperty.cpp.

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

Definition at line 167 of file mitkEnumerationProperty.cpp.

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

Definition at line 161 of file mitkEnumerationProperty.cpp.

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

Returns the string representation for the given id.

Parameters
idthe id for which the string representation should be determined if id is invalid, the return value is unspecified.
Returns
the string representation of the given enumeration value

Definition at line 109 of file mitkEnumerationProperty.cpp.

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

Definition at line 173 of file mitkEnumerationProperty.cpp.

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

Definition at line 55 of file mitkEnumerationProperty.h.

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

Returns the string representation of the current enumeration value. If it was not yet set, the return value is unspecified

Reimplemented from mitk::BaseProperty.

Definition at line 82 of file mitkEnumerationProperty.cpp.

Referenced by mitk::ConnectomicsNetworkMapper3D::PropertiesChanged(), QmitkDataManagerView::SurfaceRepresentationActionToggled(), QmitkDataManagerView::SurfaceRepresentationMenuAboutToShow(), and mitk::VtkShaderRepository::UpdateShaderProgram().

itk::LightObject::Pointer mitk::EnumerationProperty::InternalClone ( ) const
overrideprotected

Definition at line 185 of file mitkEnumerationProperty.cpp.

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 133 of file mitkEnumerationProperty.cpp.

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

Determines if a given integer representation of an enumeration value is valid or not

Parameters
valthe integer value to check
Returns
true if the given value is valid or false otherwise

Definition at line 151 of file mitkEnumerationProperty.cpp.

Referenced by mitk::PlaneOrientationProperty::PlaneOrientationProperty(), and QmitkDataManagerView::SurfaceRepresentationActionToggled().

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

Determines if a given string representation of an enumeration value is valid or not

Parameters
valthe string to check
Returns
true if the given value is valid or false otherwise

Definition at line 156 of file mitkEnumerationProperty.cpp.

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

Sets the current value of the enumeration

Parameters
namethe string representation of the enumeration value to set
Returns
true if the value was successfully set (i.e. it was valid), or false, if the name provided is incalid.

Definition at line 49 of file mitkEnumerationProperty.cpp.

Referenced by mitk::ConnectomicsRenderingEdgeColorParameterProperty::ConnectomicsRenderingEdgeColorParameterProperty(), mitk::ConnectomicsRenderingEdgeFilteringProperty::ConnectomicsRenderingEdgeFilteringProperty(), mitk::ConnectomicsRenderingEdgeRadiusParameterProperty::ConnectomicsRenderingEdgeRadiusParameterProperty(), mitk::ConnectomicsRenderingEdgeThresholdParameterProperty::ConnectomicsRenderingEdgeThresholdParameterProperty(), mitk::ConnectomicsRenderingNodeColorParameterProperty::ConnectomicsRenderingNodeColorParameterProperty(), mitk::ConnectomicsRenderingNodeFilteringProperty::ConnectomicsRenderingNodeFilteringProperty(), mitk::ConnectomicsRenderingNodeRadiusParameterProperty::ConnectomicsRenderingNodeRadiusParameterProperty(), mitk::ConnectomicsRenderingNodeThresholdParameterProperty::ConnectomicsRenderingNodeThresholdParameterProperty(), mitk::ConnectomicsRenderingSchemeProperty::ConnectomicsRenderingSchemeProperty(), mitk::GridRepresentationProperty::GridRepresentationProperty(), mitk::GridVolumeMapperProperty::GridVolumeMapperProperty(), mitkPointSetVtkMapper2DGlyphTypeTest(), mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty(), mitk::OdfScaleByProperty::OdfScaleByProperty(), 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::PlaneOrientationProperty::SetPlaneDecorationToNegativeOrientation(), mitk::PlaneOrientationProperty::SetPlaneDecorationToNone(), mitk::PlaneOrientationProperty::SetPlaneDecorationToPositiveOrientation(), QmitkDataManagerView::SurfaceRepresentationActionToggled(), mitk::VtkInterpolationProperty::VtkInterpolationProperty(), mitk::VtkRepresentationProperty::VtkRepresentationProperty(), mitk::VtkResliceInterpolationProperty::VtkResliceInterpolationProperty(), and mitk::VtkVolumeRenderingProperty::VtkVolumeRenderingProperty().

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

Sets the current value of the enumeration

Parameters
idthe integer representation of the enumeration value to set
Returns
true if the value was successfully set (i.e. it was valid), or false, if the id provided is invalid.

Definition at line 63 of file mitkEnumerationProperty.cpp.

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

Determines the number of enumeration values which have been added via AddEnum(...).

Returns
the number of enumeration values associated with this Enumeration Property

Definition at line 94 of file mitkEnumerationProperty.cpp.

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


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