ITK  6.0.0
Insight Toolkit
itkRingBuffer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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#ifndef itkRingBuffer_h
19#define itkRingBuffer_h
20
21#include "itkObject.h"
22#include "itkObjectFactory.h"
23#include "itkIntTypes.h"
24
25namespace itk
26{
39template <typename TElement>
40class ITK_TEMPLATE_EXPORT RingBuffer : public Object
41{
42public:
43 ITK_DISALLOW_COPY_AND_MOVE(RingBuffer);
44
52
54 using ElementType = TElement;
56
59
61 itkNewMacro(Self);
62
64 itkOverrideGetNameOfClassMacro(RingBuffer);
65
69 void
71
75
77 void
79
81 void
83 void
88 bool
90
94 {
95 return this->m_HeadIndex;
96 }
97
101
103 void
105
106protected:
109 ~RingBuffer() override = default;
110 void
111 PrintSelf(std::ostream & os, Indent indent) const override;
117
121 SizeValueType m_HeadIndex{ 0 };
122
124 std::vector<ElementPointer> m_PointerVector{};
125}; // end RingBuffer class
126
127} // end namespace itk
128
129#ifndef ITK_MANUAL_INSTANTIATION
130# include "itkRingBuffer.hxx"
131#endif
132
133#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
Templated ring buffer for holding anything.
Definition: itkRingBuffer.h:41
void MoveHead(OffsetValueType offset)
bool BufferIsFull(OffsetValueType offset)
void PrintSelf(std::ostream &os, Indent indent) const override
void SetBufferContents(OffsetValueType offset, ElementPointer element)
typename ElementType::Pointer ElementPointer
Definition: itkRingBuffer.h:55
SizeValueType GetNumberOfBuffers()
SizeValueType GetHeadIndex()
Definition: itkRingBuffer.h:93
void SetNumberOfBuffers(SizeValueType n)
TElement ElementType
Definition: itkRingBuffer.h:54
ElementType::Pointer GetBufferContents(OffsetValueType offset)
void MoveHeadForward()
~RingBuffer() override=default
itk::SizeValueType SizeValueType
Definition: itkRingBuffer.h:57
void MoveHeadBackward()
itk::OffsetValueType OffsetValueType
Definition: itkRingBuffer.h:58
OffsetValueType GetOffsetBufferIndex(OffsetValueType offset)
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86
long OffsetValueType
Definition: itkIntTypes.h:97