Develop Biology
The language of life
SmartIterator.cpp
Go to the documentation of this file.
1/*
2 * This file is a part of the Biology project by eons LLC.
3 * Biology (aka Develop Biology) is a framework for approaching software
4 * development from a natural sciences perspective.
5 *
6 * Copyright (C) 2022 Séon O'Shannon & eons LLC
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
25
26namespace bio {
27
29 :
30 m_implementation(container->ConstructClassIterator(container->GetEndIndex()))
31{
32
33}
34
36 const Container* container,
37 Index index
38)
39 :
40 m_implementation(container->ConstructClassIterator(index))
41{
42
43}
44
46{
47 delete m_implementation;
48}
49
51{
52 return m_implementation;
53}
54
56{
57 return m_implementation;
58}
59
61{
62 return m_implementation->GetIndex();
63}
64
66{
67 return m_implementation->MoveTo(index);
68}
69
71{
73}
74
76{
77 return m_implementation->IsAtEnd();
78}
79
81{
82 return **m_implementation;
83}
84
86{
87 return **m_implementation;
88}
89
91{
93 return *const_cast< SmartIterator* >(this);
94}
95
97{
98 SmartIterator ret = *this;
100 return ret;
101}
102
104{
106 return *const_cast< SmartIterator* >(this);
107}
108
110{
111 SmartIterator ret = *this;
113 return ret;
114}
115
116} //bio namespace
bool MoveTo(const Index index)
Definition: Iterator.cpp:48
virtual bool IsAtBeginning() const
Definition: Iterator.cpp:58
virtual Iterator * Increment()
Definition: Iterator.cpp:68
Index GetIndex() const
Definition: Iterator.cpp:43
virtual bool IsAtEnd() const
Definition: Iterator.cpp:63
virtual Iterator * Decrement()
Definition: Iterator.cpp:82
bool MoveTo(Index index) const
SmartIterator(const Container *container)
SmartIterator & operator--() const
Index GetIndex() const
SmartIterator & operator++() const
Iterator * m_implementation
bool IsAtBeginning() const
bool IsAtEnd() const
virtual ByteStream operator*()
Iterator * GetImplementation()
Definition: Cell.h:31
uint32_t Index
Definition: Types.h:57