ITK  5.2.0
Insight Toolkit
Classes | Public Types | Public Member Functions | Private Types | List of all members
itk::MapContainer< TElementIdentifier, TElement > Class Template Reference

#include <itkMapContainer.h>

+ Inheritance diagram for itk::MapContainer< TElementIdentifier, TElement >:
+ Collaboration diagram for itk::MapContainer< TElementIdentifier, TElement >:

Classes

class  ConstIterator
 
class  Iterator
 

Public Types

using ConstPointer = SmartPointer< const Self >
 
using Element = TElement
 
using ElementIdentifier = TElementIdentifier
 
using Pointer = SmartPointer< Self >
 
using Self = MapContainer
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual const char * GetNameOfClass () const
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
LightObject::Pointer CreateAnother () const override
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Private Types

using MapConstIterator = typename MapType::const_iterator
 
using MapIterator = typename MapType::iterator
 
using MapKeyCompareType = typename MapType::key_compare
 
using MapType = std::map< ElementIdentifier, Element >
 
using STLContainerType = MapType
 
class Iterator
 
class ConstIterator
 
 MapContainer ()
 
 MapContainer (const MapKeyCompareType &comp)
 
template<typename TInputIterator >
 MapContainer (TInputIterator first, TInputIterator last)
 
template<typename TInputIterator >
 MapContainer (TInputIterator first, TInputIterator last, const MapKeyCompareType &comp)
 
virtual ::itk::LightObject::Pointer CreateAnother () const
 
STLContainerTypeCastToSTLContainer () noexcept
 
const STLContainerTypeCastToSTLConstContainer () const noexcept
 
ElementElementAt (ElementIdentifier)
 
const ElementElementAt (ElementIdentifier) const
 
ElementCreateElementAt (ElementIdentifier)
 
Element GetElement (ElementIdentifier) const
 
void SetElement (ElementIdentifier, Element)
 
void InsertElement (ElementIdentifier, Element)
 
bool IndexExists (ElementIdentifier) const
 
bool GetElementIfIndexExists (ElementIdentifier, Element *) const
 
void CreateIndex (ElementIdentifier)
 
void DeleteIndex (ElementIdentifier)
 
ConstIterator Begin () const
 
ConstIterator End () const
 
Iterator Begin ()
 
Iterator End ()
 
ElementIdentifier Size () const
 
void Reserve (ElementIdentifier)
 
void Squeeze ()
 
void Initialize ()
 
static Pointer New ()
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Detailed Description

template<typename TElementIdentifier, typename TElement>
class itk::MapContainer< TElementIdentifier, TElement >

A wrapper of the STL "map" container.

Define a front-end to the STL "map" container that conforms to the IndexedContainerInterface. This is a full-fleged Object, so there are events, modification time, debug, and reference count information.

Template Parameters
TElementIdentifierA type that shall be used to index the container. It must have a < operator defined for ordering.
TElementThe element type stored in the container.

Definition at line 45 of file itkMapContainer.h.

Member Typedef Documentation

◆ ConstPointer

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::ConstPointer = SmartPointer<const Self>

Definition at line 56 of file itkMapContainer.h.

◆ Element

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::Element = TElement

Definition at line 63 of file itkMapContainer.h.

◆ ElementIdentifier

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::ElementIdentifier = TElementIdentifier

Save the template parameters.

Definition at line 62 of file itkMapContainer.h.

◆ MapConstIterator

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::MapConstIterator = typename MapType::const_iterator
private

Definition at line 69 of file itkMapContainer.h.

◆ MapIterator

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::MapIterator = typename MapType::iterator
private

Definition at line 68 of file itkMapContainer.h.

◆ MapKeyCompareType

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::MapKeyCompareType = typename MapType::key_compare
private

Definition at line 70 of file itkMapContainer.h.

◆ MapType

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::MapType = std::map<ElementIdentifier, Element>
private

Quick access to the STL map type that was inherited.

Definition at line 67 of file itkMapContainer.h.

◆ Pointer

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::Pointer = SmartPointer<Self>

Definition at line 55 of file itkMapContainer.h.

◆ Self

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::Self = MapContainer

Standard class type aliases.

Definition at line 53 of file itkMapContainer.h.

◆ STLContainerType

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::STLContainerType = MapType

This type is provided to adapt this container as an STL container

Definition at line 97 of file itkMapContainer.h.

◆ Superclass

template<typename TElementIdentifier , typename TElement >
using itk::MapContainer< TElementIdentifier, TElement >::Superclass = Object

Definition at line 54 of file itkMapContainer.h.

Constructor & Destructor Documentation

◆ MapContainer() [1/4]

template<typename TElementIdentifier , typename TElement >
itk::MapContainer< TElementIdentifier, TElement >::MapContainer ( )
inline

Provide pass-through constructors corresponding to all the STL map constructors. These are for internal use only since this is also an Object which must be constructed through the "New()" routine.

Definition at line 76 of file itkMapContainer.h.

◆ MapContainer() [2/4]

template<typename TElementIdentifier , typename TElement >
itk::MapContainer< TElementIdentifier, TElement >::MapContainer ( const MapKeyCompareType comp)
inline

This type is provided to adapt this container as an STL container

Definition at line 79 of file itkMapContainer.h.

◆ MapContainer() [3/4]

template<typename TElementIdentifier , typename TElement >
template<typename TInputIterator >
itk::MapContainer< TElementIdentifier, TElement >::MapContainer ( TInputIterator  first,
TInputIterator  last 
)
inline

This type is provided to adapt this container as an STL container

Definition at line 84 of file itkMapContainer.h.

◆ MapContainer() [4/4]

template<typename TElementIdentifier , typename TElement >
template<typename TInputIterator >
itk::MapContainer< TElementIdentifier, TElement >::MapContainer ( TInputIterator  first,
TInputIterator  last,
const MapKeyCompareType comp 
)
inline

This type is provided to adapt this container as an STL container

Definition at line 88 of file itkMapContainer.h.

Member Function Documentation

◆ Begin() [1/2]

template<typename TElementIdentifier , typename TElement >
Iterator itk::MapContainer< TElementIdentifier, TElement >::Begin ( )

Get a begin const iterator for the map.

◆ Begin() [2/2]

template<typename TElementIdentifier , typename TElement >
ConstIterator itk::MapContainer< TElementIdentifier, TElement >::Begin ( ) const

Get a begin const iterator for the map.

◆ CastToSTLConstContainer()

template<typename TElementIdentifier , typename TElement >
const STLContainerType& itk::MapContainer< TElementIdentifier, TElement >::CastToSTLConstContainer ( ) const
inlinenoexcept

Cast the container to a const STL container type

Definition at line 108 of file itkMapContainer.h.

◆ CastToSTLContainer()

template<typename TElementIdentifier , typename TElement >
STLContainerType& itk::MapContainer< TElementIdentifier, TElement >::CastToSTLContainer ( )
inlinenoexcept

Cast the container to a STL container type

Definition at line 101 of file itkMapContainer.h.

◆ CreateAnother()

template<typename TElementIdentifier , typename TElement >
virtual::itk::LightObject::Pointer itk::MapContainer< TElementIdentifier, TElement >::CreateAnother ( ) const
virtual

This type is provided to adapt this container as an STL container

Reimplemented from itk::LightObject.

◆ CreateElementAt()

template<typename TElementIdentifier , typename TElement >
Element& itk::MapContainer< TElementIdentifier, TElement >::CreateElementAt ( ElementIdentifier  )

Get a reference to the element at the given index. If the index does not exist, it is created automatically.

It is assumed that the value of the element is modified through the reference.

◆ CreateIndex()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::CreateIndex ( ElementIdentifier  )

The map will create an entry for a given index through the indexing operator. Whether or not it is created, it will be assigned to the default element.

◆ DeleteIndex()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::DeleteIndex ( ElementIdentifier  )

Delete the entry in the STL map corresponding to the given identifier. If the entry does not exist, nothing happens.

◆ ElementAt() [1/2]

template<typename TElementIdentifier , typename TElement >
Element& itk::MapContainer< TElementIdentifier, TElement >::ElementAt ( ElementIdentifier  )

Get a reference to the element at the given index. If the index does not exist, it is created automatically.

It is assumed that the value of the element is modified through the reference.

◆ ElementAt() [2/2]

template<typename TElementIdentifier , typename TElement >
const Element& itk::MapContainer< TElementIdentifier, TElement >::ElementAt ( ElementIdentifier  ) const

Get a reference to the element at the given index.

◆ End() [1/2]

template<typename TElementIdentifier , typename TElement >
Iterator itk::MapContainer< TElementIdentifier, TElement >::End ( )

Get an end const iterator for the map.

◆ End() [2/2]

template<typename TElementIdentifier , typename TElement >
ConstIterator itk::MapContainer< TElementIdentifier, TElement >::End ( ) const

Get an end const iterator for the map.

◆ GetElement()

template<typename TElementIdentifier , typename TElement >
Element itk::MapContainer< TElementIdentifier, TElement >::GetElement ( ElementIdentifier  ) const

Get the element at the specified index. There is no check for existence performed.

◆ GetElementIfIndexExists()

template<typename TElementIdentifier , typename TElement >
bool itk::MapContainer< TElementIdentifier, TElement >::GetElementIfIndexExists ( ElementIdentifier  ,
Element  
) const

If the given index doesn't exist in the map, return false. Otherwise, set the element through the pointer (if it isn't null), and return true.

◆ GetNameOfClass()

template<typename TElementIdentifier , typename TElement >
virtual const char* itk::MapContainer< TElementIdentifier, TElement >::GetNameOfClass ( ) const
virtual

Standard part of every itk Object.

Reimplemented from itk::Object.

◆ IndexExists()

template<typename TElementIdentifier , typename TElement >
bool itk::MapContainer< TElementIdentifier, TElement >::IndexExists ( ElementIdentifier  ) const

Check if the STL map has an entry corresponding to the given index. The count will be either 1 or 0.

◆ Initialize()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::Initialize ( )

Tell the container to release any memory it may have allocated and return itself to its initial state.

◆ InsertElement()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::InsertElement ( ElementIdentifier  ,
Element   
)

Set the given index value to the given element. If the index doesn't exist, it is automatically created.

◆ New()

template<typename TElementIdentifier , typename TElement >
static Pointer itk::MapContainer< TElementIdentifier, TElement >::New ( )
static

Method for creation through the object factory.

◆ Reserve()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::Reserve ( ElementIdentifier  )

Tell the container to allocate enough memory to allow at least as many elements as the size given to be stored. This is NOT guaranteed to actually allocate any memory, but is useful if the implementation of the container allocates contiguous storage.

◆ SetElement()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::SetElement ( ElementIdentifier  ,
Element   
)

Set the given index value to the given element. If the index doesn't exist, it is automatically created.

◆ Size()

template<typename TElementIdentifier , typename TElement >
ElementIdentifier itk::MapContainer< TElementIdentifier, TElement >::Size ( ) const

Get the number of elements currently stored in the map.

◆ Squeeze()

template<typename TElementIdentifier , typename TElement >
void itk::MapContainer< TElementIdentifier, TElement >::Squeeze ( )

Tell the container to try to minimize its memory usage for storage of the current number of elements. This is NOT guaranteed to decrease memory usage.

Friends And Related Function Documentation

◆ ConstIterator

template<typename TElementIdentifier , typename TElement >
friend class ConstIterator
friend

This type is provided to adapt this container as an STL container

Definition at line 161 of file itkMapContainer.h.

◆ Iterator

template<typename TElementIdentifier , typename TElement >
friend class Iterator
friend

This type is provided to adapt this container as an STL container

Definition at line 159 of file itkMapContainer.h.


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