Template class for generating lookup-tables. More...
#include <mitkGenericLookupTable.h>
Public Types | |
typedef unsigned int | IdentifierType |
typedef T | ValueType |
typedef std::map < IdentifierType, ValueType > | LookupTableType |
typedef GenericLookupTable | Self |
Public Member Functions | |
GenericLookupTable () | |
virtual | ~GenericLookupTable () |
virtual const char * | GetNameOfClass () const |
void | SetTableValue (IdentifierType id, ValueType value) |
bool | ValueExists (IdentifierType id) const |
ValueType | GetTableValue (IdentifierType id) const |
const LookupTableType & | GetLookupTable () const |
bool | operator== (const Self &lookupTable) const |
bool | operator!= (const Self &lookupTable) const |
virtual Self & | operator= (const Self &other) |
Protected Attributes | |
LookupTableType | m_LookupTable |
Template class for generating lookup-tables.
This class template can be instantiated for all classes/internal types that fulfills these requirements:
The main purpose of this class is to be used in conjunction with GenericLookupTableProperty. This enables passing of arbitrary lookup tables to mappers to configure the rendering process.
Definition at line 48 of file mitkGenericLookupTable.h.
typedef unsigned int mitk::GenericLookupTable< T >::IdentifierType |
Definition at line 51 of file mitkGenericLookupTable.h.
typedef std::map< IdentifierType, ValueType > mitk::GenericLookupTable< T >::LookupTableType |
Definition at line 53 of file mitkGenericLookupTable.h.
typedef GenericLookupTable mitk::GenericLookupTable< T >::Self |
Reimplemented in mitk::BoolLookupTable, mitk::FloatLookupTable, mitk::IntLookupTable, and mitk::StringLookupTable.
Definition at line 55 of file mitkGenericLookupTable.h.
typedef T mitk::GenericLookupTable< T >::ValueType |
Definition at line 52 of file mitkGenericLookupTable.h.
mitk::GenericLookupTable< T >::GenericLookupTable | ( | ) | [inline] |
Definition at line 57 of file mitkGenericLookupTable.h.
{}
virtual mitk::GenericLookupTable< T >::~GenericLookupTable | ( | ) | [inline, virtual] |
Definition at line 58 of file mitkGenericLookupTable.h.
{ }
const LookupTableType& mitk::GenericLookupTable< T >::GetLookupTable | ( | ) | const [inline] |
Definition at line 87 of file mitkGenericLookupTable.h.
Referenced by mitk::StringLookupTablePropertySerializer::Serialize(), mitk::IntLookupTablePropertySerializer::Serialize(), mitk::FloatLookupTablePropertySerializer::Serialize(), and mitk::BoolLookupTablePropertySerializer::Serialize().
{ return m_LookupTable; }
virtual const char* mitk::GenericLookupTable< T >::GetNameOfClass | ( | ) | const [inline, virtual] |
Reimplemented in mitk::BoolLookupTable, mitk::FloatLookupTable, mitk::IntLookupTable, and mitk::StringLookupTable.
Definition at line 62 of file mitkGenericLookupTable.h.
{ return "GenericLookupTable"; }
ValueType mitk::GenericLookupTable< T >::GetTableValue | ( | IdentifierType | id ) | const [inline] |
Definition at line 78 of file mitkGenericLookupTable.h.
Referenced by mitk::EnhancedPointSetVtkMapper3D::ApplyProperties(), and mitkPropertyListTest().
{ typename LookupTableType::const_iterator it = m_LookupTable.find(id); if (it != m_LookupTable.end()) return it->second; else throw std::range_error("id does not exist in the lookup table"); }
bool mitk::GenericLookupTable< T >::operator!= | ( | const Self & | lookupTable ) | const [inline] |
Definition at line 96 of file mitkGenericLookupTable.h.
{ return !(m_LookupTable == lookupTable.m_LookupTable); }
virtual Self& mitk::GenericLookupTable< T >::operator= | ( | const Self & | other ) | [inline, virtual] |
Definition at line 101 of file mitkGenericLookupTable.h.
: this needs to be unit tested! { if ( this == &other ) { return *this; } else { m_LookupTable.clear(); m_LookupTable = other.m_LookupTable; return *this; } }
bool mitk::GenericLookupTable< T >::operator== | ( | const Self & | lookupTable ) | const [inline] |
Definition at line 92 of file mitkGenericLookupTable.h.
{ return (m_LookupTable == lookupTable.m_LookupTable); }
void mitk::GenericLookupTable< T >::SetTableValue | ( | IdentifierType | id, |
ValueType | value | ||
) | [inline] |
Definition at line 67 of file mitkGenericLookupTable.h.
Referenced by mitk::StringLookupTablePropertyDeserializer::Deserialize(), mitk::IntLookupTablePropertyDeserializer::Deserialize(), mitk::FloatLookupTablePropertyDeserializer::Deserialize(), mitk::BoolLookupTablePropertyDeserializer::Deserialize(), mitkPropertyListTest(), and mitkPropertySerializationTest().
{ m_LookupTable[id] = value; }
bool mitk::GenericLookupTable< T >::ValueExists | ( | IdentifierType | id ) | const [inline] |
Definition at line 72 of file mitkGenericLookupTable.h.
{ typename LookupTableType::const_iterator it = m_LookupTable.find(id); return (it != m_LookupTable.end()); }
LookupTableType mitk::GenericLookupTable< T >::m_LookupTable [protected] |
Definition at line 115 of file mitkGenericLookupTable.h.
Referenced by mitk::GenericLookupTable< bool >::GetLookupTable(), mitk::GenericLookupTable< bool >::GetTableValue(), mitk::GenericLookupTable< bool >::operator!=(), mitk::GenericLookupTable< bool >::operator=(), mitk::GenericLookupTable< bool >::operator==(), mitk::GenericLookupTable< bool >::SetTableValue(), and mitk::GenericLookupTable< bool >::ValueExists().