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

#include <itkIndexedContainerInterface.h>

Detailed Description

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

This should only be used for reference when writing containers conforming to this interface. This should only be used for reference when writing containers conforming to this interface. ITK uses generic programming to allow container type substitution, so polymorphism is not needed to use containers through this interface. This means that a container conforming to this interface need not be derived from it, and that their methods should not be virtual. However, the container must derive from Object in order to support the reference counting, modification time, and debug information required by this interface.

Note that many comments refer to a "default element" or "default element value". This value is equal to the default constructor of the Element type. Also note that all non-const methods assume that the container was modified, and update the modification time.

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 53 of file itkIndexedContainerInterface.h.

+ Inheritance diagram for itk::IndexedContainerInterface< TElementIdentifier, TElement >:
+ Collaboration diagram for itk::IndexedContainerInterface< 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 = IndexedContainerInterface
 
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

Iterator Begin ()
 
ConstIterator Begin () const
 
ElementCreateElementAt (ElementIdentifier)
 
void CreateIndex (ElementIdentifier)
 
void DeleteIndex (ElementIdentifier)
 
ElementElementAt (ElementIdentifier)
 
Iterator End ()
 
ConstIterator End () const
 
Element GetElement (ElementIdentifier) const
 
bool GetElementIfIndexExists (ElementIdentifier, Element *) const
 
const char * GetNameOfClass () const override
 
bool IndexExists (ElementIdentifier) const
 
void Initialize ()
 
void InsertElement (ElementIdentifier, Element)
 
void Reserve (ElementIdentifier)
 
void SetElement (ElementIdentifier, Element)
 
ElementIdentifier Size () const
 
void Squeeze ()
 
- 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
 
const char * GetNameOfClass () const override
 
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
 

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 ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
 ~Object () override
 
- 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 {}
 

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 60 of file itkIndexedContainerInterface.h.

◆ Element

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

Definition at line 67 of file itkIndexedContainerInterface.h.

◆ ElementIdentifier

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

Save the template parameters.

Definition at line 66 of file itkIndexedContainerInterface.h.

◆ Pointer

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

Definition at line 59 of file itkIndexedContainerInterface.h.

◆ Self

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

Standard class type aliases.

Definition at line 57 of file itkIndexedContainerInterface.h.

◆ Superclass

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

Definition at line 58 of file itkIndexedContainerInterface.h.

Member Function Documentation

◆ Begin() [1/2]

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

Get a begin iterator for the container.

◆ Begin() [2/2]

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

Get a begin const iterator for the container.

◆ CreateElementAt()

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

Get a reference to an existing element. It is guaranteed that the element will be inserted with a default value if it does not exist.

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

◆ CreateIndex()

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

Create an entry in the container corresponding to the given index. The entry will be initialized with the default element. If an entry already exists, its value will be overwritten with the default element.

◆ DeleteIndex()

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

Delete the entry in the container corresponding to the given identifier.

It is NOT guaranteed that IndexExists(id) will return false if called right after DeleteIndex(id). This behavior is implementation-defined. If the identifier's location is left behind, though, it will have the value of the default element.

◆ ElementAt()

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

Get a reference to an existing element. It is NOT guaranteed that the element will or will not be created if it doesn't exist. This behavior is implementation-specific.

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

◆ End() [1/2]

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

Get an end iterator for the container.

◆ End() [2/2]

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

Get an end const iterator for the container.

◆ GetElement()

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

Get a copy of an element without range checking.

◆ GetElementIfIndexExists()

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

Combine the GetElement and IndexExists into one method. If false is returned, then no element with the given identifier was found. If true is returned, then the identifier was found. In this case, if the element pointer given as input is not null, the element is filled in with the value of the element found.

◆ GetNameOfClass()

template<typename TElementIdentifier , typename TElement >
const char* itk::IndexedContainerInterface< TElementIdentifier, TElement >::GetNameOfClass ( ) const
overridevirtual
See also
LightObject::GetNameOfClass()

Reimplemented from itk::LightObject.

◆ IndexExists()

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

Test if there is an entry in the container corresponding to the given index.

◆ Initialize()

template<typename TElementIdentifier , typename TElement >
void itk::IndexedContainerInterface< 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::IndexedContainerInterface< TElementIdentifier, TElement >::InsertElement ( ElementIdentifier  ,
Element   
)

Set the value of an element. It is guaranteed that a spot for the element will be created if it doesn't exist.

◆ Reserve()

template<typename TElementIdentifier , typename TElement >
void itk::IndexedContainerInterface< 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::IndexedContainerInterface< TElementIdentifier, TElement >::SetElement ( ElementIdentifier  ,
Element   
)

Set the value of an element. It is NOT guaranteed whether a spot for the element will be created automatically. This is implementation-defined.

◆ Size()

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

Get the number of elements currently stored in the container.

◆ Squeeze()

template<typename TElementIdentifier , typename TElement >
void itk::IndexedContainerInterface< 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.


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