ITK  6.0.0
Insight Toolkit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Friends | List of all members
itk::detail::VectorContainer< TElementIdentifier, TElement > Class Template Reference

#include <itkVectorContainer.h>

Detailed Description

template<typename TElementIdentifier, typename TElement>
class itk::detail::VectorContainer< TElementIdentifier, TElement >

Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.

This is a full-fledged Object, so there is modification time, debug, and reference count information.

Template Parameters
TElementIdentifierAn INTEGRAL type for use in indexing the vector.
TElementThe element type stored in the container.
ITK Sphinx Examples:
Examples
Examples/Numerics/FourierDescriptors1.cxx, and SphinxExamples/src/Core/Common/IterateOnAVectorContainer/Code.cxx.

Definition at line 51 of file itkVectorContainer.h.

+ Inheritance diagram for itk::detail::VectorContainer< TElementIdentifier, TElement >:
+ Collaboration diagram for itk::detail::VectorContainer< 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 = VectorContainer
 
using STLContainerType = VectorType
 
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
 
const STLContainerTypeCastToSTLConstContainer () const noexcept
 
STLContainerTypeCastToSTLContainer () noexcept
 
reference CreateElementAt (ElementIdentifier)
 
void CreateIndex (ElementIdentifier)
 
void DeleteIndex (ElementIdentifier)
 
reference ElementAt (ElementIdentifier)
 
const_reference ElementAt (ElementIdentifier) const
 
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 *cmd) 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) const
 
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
 

Static Public Member Functions

static Pointer New ()
 
- 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

 VectorContainer ()=default
 
 VectorContainer (size_type n)
 
 VectorContainer (size_type n, const Element &x)
 
 VectorContainer (const Self &r)
 
template<typename TInputIterator >
 VectorContainer (TInputIterator first, TInputIterator last)
 
- 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 ()
 

Private Types

using VectorConstIterator = typename VectorType::const_iterator
 
using VectorIterator = typename VectorType::iterator
 
using VectorType = std::vector< Element >
 

Friends

class ConstIterator
 
class Iterator
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}
 

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 60 of file itkVectorContainer.h.

◆ Element

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

Definition at line 64 of file itkVectorContainer.h.

◆ ElementIdentifier

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

Save the template parameters.

Definition at line 63 of file itkVectorContainer.h.

◆ Pointer

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

Definition at line 59 of file itkVectorContainer.h.

◆ Self

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

Standard class type aliases.

Definition at line 57 of file itkVectorContainer.h.

◆ STLContainerType

template<typename TElementIdentifier , typename TElement >
using itk::detail::VectorContainer< TElementIdentifier, TElement >::STLContainerType = VectorType

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

Definition at line 74 of file itkVectorContainer.h.

◆ Superclass

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

Definition at line 58 of file itkVectorContainer.h.

◆ VectorConstIterator

template<typename TElementIdentifier , typename TElement >
using itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorConstIterator = typename VectorType::const_iterator
private

Definition at line 70 of file itkVectorContainer.h.

◆ VectorIterator

template<typename TElementIdentifier , typename TElement >
using itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorIterator = typename VectorType::iterator
private

Definition at line 69 of file itkVectorContainer.h.

◆ VectorType

template<typename TElementIdentifier , typename TElement >
using itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorType = std::vector<Element>
private

Quick access to the STL vector type that was inherited.

Definition at line 68 of file itkVectorContainer.h.

Constructor & Destructor Documentation

◆ VectorContainer() [1/5]

template<typename TElementIdentifier , typename TElement >
itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorContainer ( )
protecteddefault

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

◆ VectorContainer() [2/5]

template<typename TElementIdentifier , typename TElement >
itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorContainer ( size_type  n)
inlineprotected

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

Definition at line 550 of file itkVectorContainer.h.

◆ VectorContainer() [3/5]

template<typename TElementIdentifier , typename TElement >
itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorContainer ( size_type  n,
const Element x 
)
inlineprotected

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

Definition at line 554 of file itkVectorContainer.h.

◆ VectorContainer() [4/5]

template<typename TElementIdentifier , typename TElement >
itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorContainer ( const Self r)
inlineprotected

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

Definition at line 558 of file itkVectorContainer.h.

◆ VectorContainer() [5/5]

template<typename TElementIdentifier , typename TElement >
template<typename TInputIterator >
itk::detail::VectorContainer< TElementIdentifier, TElement >::VectorContainer ( TInputIterator  first,
TInputIterator  last 
)
inlineprotected

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

Definition at line 563 of file itkVectorContainer.h.

Member Function Documentation

◆ Begin() [1/2]

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

Get a begin iterator for the vector.

◆ Begin() [2/2]

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

Get a begin const iterator for the vector.

◆ CastToSTLConstContainer()

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

Cast the container to a const STL container type

Definition at line 95 of file itkVectorContainer.h.

◆ CastToSTLContainer()

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

Cast the container to a STL container type

Definition at line 88 of file itkVectorContainer.h.

◆ CreateElementAt()

template<typename TElementIdentifier , typename TElement >
reference itk::detail::VectorContainer< TElementIdentifier, TElement >::CreateElementAt ( ElementIdentifier  )

Get a reference to the element at the given index. If the element location does not exist, it will be created with a default element value.

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

◆ CreateIndex()

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

Make sure that the index range of the vector is large enough to allow the given index, expanding it if necessary. The index will contain the default element regardless of whether expansion occurred.

◆ DeleteIndex()

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

Delete the element defined by the index identifier. In practice, it doesn't make sense to delete a vector index; overwrite the index with the default element instead.

◆ ElementAt() [1/2]

template<typename TElementIdentifier , typename TElement >
reference itk::detail::VectorContainer< TElementIdentifier, TElement >::ElementAt ( ElementIdentifier  )

Get a reference to the element at the given index. It is assumed that the index exists, and it will not automatically be created.

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

◆ ElementAt() [2/2]

template<typename TElementIdentifier , typename TElement >
const_reference itk::detail::VectorContainer< TElementIdentifier, TElement >::ElementAt ( ElementIdentifier  ) const

Get a reference to the element at the given index. It is assumed that the index exists, and it will not automatically be created.

◆ End() [1/2]

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

Get an end iterator for the vector.

◆ End() [2/2]

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

Get an end const iterator for the vector.

◆ GetElement()

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

Read the element from the given index. It is assumed that the index exists.

◆ GetElementIfIndexExists()

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

Check if the given index is in range of the vector. If it is not, return false. Otherwise, set the element through the pointer (if it isn't nullptr), and return true.

◆ GetNameOfClass()

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

Reimplemented from itk::Object.

◆ IndexExists()

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

Check if the index range of the vector is large enough to allow the given index without expansion.

◆ Initialize()

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

Clear the elements. The final size will be zero.

◆ InsertElement()

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

Set the element value at the given index. If the element location does not exist, it will be created with a default element value.

◆ New()

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

Method for creation through the object factory.

Referenced by itk::MakeVectorContainer().

◆ Reserve()

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

Allocate memory for at the requested number of elements.

Tell the container to allocate enough memory to allow at least as many elements as the size given to be stored. In the generic case of ITK containers this is NOT guaranteed to actually allocate any memory, but it is useful if the implementation of the container allocates contiguous storage. In the particular implementation of this VectorContainer the call to this method actually allocates memory for the number of elements defined by ElementIdentifier.

◆ SetElement()

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

Set the element value at the given index. It is assumed that the index exists.

◆ Size()

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

Get the number of elements currently stored in the vector.

◆ Squeeze()

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

Try to compact the internal representation of the memory.

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. This method is included here mainly for providing a unified API with other containers in the toolkit.

Friends And Related Function Documentation

◆ ConstIterator

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

Definition at line 147 of file itkVectorContainer.h.

◆ Iterator

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

Friends to this class.

Definition at line 146 of file itkVectorContainer.h.


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