go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkVectorDataContainer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
22/*=========================================================================
23
24 Program: Insight Segmentation & Registration Toolkit
25 Module: $RCSfile$
26 Date: $Date: 2008-04-15 19:54:41 +0200 (Tue, 15 Apr 2008) $
27 Version: $Revision: 1573 $
28
29 Copyright (c) Insight Software Consortium. All rights reserved.
30 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
31
32 This software is distributed WITHOUT ANY WARRANTY; without even
33 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
34 PURPOSE. See the above copyright notices for more information.
35
36=========================================================================*/
37#ifndef itkVectorDataContainer_h
38#define itkVectorDataContainer_h
39
40#include "itkDataObject.h"
41#include "itkObjectFactory.h"
42#include "itkVectorContainer.h"
43
44#include <utility>
45#include <vector>
46
47namespace itk
48{
49
72template <typename TElementIdentifier, typename TElement>
73class ITK_TEMPLATE_EXPORT VectorDataContainer
74 : public DataObject
75 , private std::vector<TElement>
76{
77public:
80 using Superclass = DataObject;
81 using Pointer = SmartPointer<Self>;
82 using ConstPointer = SmartPointer<const Self>;
83
85 using ElementIdentifier = TElementIdentifier;
86 using Element = TElement;
87
88private:
90 using VectorType = std::vector<Element>;
91 using size_type = typename VectorType::size_type;
92 using VectorIterator = typename VectorType::iterator;
93 using VectorConstIterator = typename VectorType::const_iterator;
94
95protected:
100 : DataObject()
101 , VectorType()
102 {}
104 : DataObject()
105 , VectorType(n)
106 {}
108 : DataObject()
109 , VectorType(n, x)
110 {}
112 : DataObject()
113 , VectorType(r)
114 {}
115 template <typename InputIterator>
116 VectorDataContainer(InputIterator first, InputIterator last)
117 : DataObject()
118 , VectorType(first, last)
119 {}
120
121public:
124
126 itkNewMacro(Self);
127
129 itkTypeMacro(VectorDataContainer, DataObject);
130
134 {
135 return *this;
136 }
137
138
140 const STLContainerType &
142 {
143 return *this;
144 }
145
146 using STLContainerType::begin;
147 using STLContainerType::end;
148 using STLContainerType::rbegin;
149 using STLContainerType::rend;
150 using STLContainerType::cbegin;
151 using STLContainerType::cend;
152 using STLContainerType::crbegin;
153 using STLContainerType::crend;
154
155 using STLContainerType::size;
156 using STLContainerType::max_size;
157 using STLContainerType::resize;
158 using STLContainerType::capacity;
159 using STLContainerType::empty;
160 using STLContainerType::reserve;
161 using STLContainerType::shrink_to_fit;
162
163 using STLContainerType::operator[];
164 using STLContainerType::at;
165 using STLContainerType::front;
166 using STLContainerType::back;
167
168 using STLContainerType::assign;
169 using STLContainerType::push_back;
170 using STLContainerType::pop_back;
171 using STLContainerType::insert;
172 using STLContainerType::erase;
173 using STLContainerType::swap;
174 using STLContainerType::clear;
175
176 using STLContainerType::get_allocator;
177
178 using typename STLContainerType::reference;
179 using typename STLContainerType::const_reference;
180 using typename STLContainerType::iterator;
181 using typename STLContainerType::const_iterator;
182 // already declared before
183 // using STLContainerType::size_type;
184 using typename STLContainerType::difference_type;
185 using typename STLContainerType::value_type;
186 using typename STLContainerType::allocator_type;
187 using typename STLContainerType::pointer;
188 using typename STLContainerType::const_pointer;
189 using typename STLContainerType::reverse_iterator;
190 using typename STLContainerType::const_reverse_iterator;
191
192 using Iterator = typename VectorContainer<TElementIdentifier, TElement>::Iterator;
193 using ConstIterator = typename VectorContainer<TElementIdentifier, TElement>::ConstIterator;
194
195 /* Declare the public interface routines. */
196
206
214
224
230
236
243
249
255 bool
257
264
271
276 Begin() const;
277
282 End() const;
283
289
295
299 unsigned long
300 Size() const;
301
312
319 void
321
325 void
326 Initialize() override;
327};
328
329} // end namespace itk
330
331#ifndef ITK_MANUAL_INSTANTIATION
332# include "itkVectorDataContainer.hxx"
333#endif
334
335#endif // end itkVectorDataContainer_h
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
void Initialize() override
void InsertElement(ElementIdentifier, Element)
void CreateIndex(ElementIdentifier)
unsigned long Size() const
typename VectorType::size_type size_type
void DeleteIndex(ElementIdentifier)
typename VectorType::iterator VectorIterator
TElementIdentifier ElementIdentifier
ConstIterator End() const
Element GetElement(ElementIdentifier) const
typename VectorContainer< TElementIdentifier, TElement >::ConstIterator ConstIterator
VectorDataContainer(size_type n, const Element &x)
VectorDataContainer(InputIterator first, InputIterator last)
const Element & ElementAt(ElementIdentifier) const
ConstIterator Begin() const
SmartPointer< const Self > ConstPointer
Element & CreateElementAt(ElementIdentifier)
void Reserve(ElementIdentifier)
STLContainerType & CastToSTLContainer()
bool GetElementIfIndexExists(ElementIdentifier, Element *) const
bool IndexExists(ElementIdentifier) const
typename VectorType::const_iterator VectorConstIterator
Element & ElementAt(ElementIdentifier)
void SetElement(ElementIdentifier, Element)
typename VectorContainer< TElementIdentifier, TElement >::Iterator Iterator
const STLContainerType & CastToSTLConstContainer() const
std::vector< Element > VectorType


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo