rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
iterator.hh
Go to the documentation of this file.
1/*
2* This file is part of rasdaman community.
3*
4* Rasdaman community is free software: you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation, either version 3 of the License, or
7* (at your option) any later version.
8*
9* Rasdaman community is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16*
17* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / rasdaman GmbH.
18*
19* For more information please see <http://www.rasdaman.org>
20* or contact Peter Baumann via <baumann@rasdaman.com>.
21*/
22
23#ifndef _D_ITERATOR_
24#define _D_ITERATOR_
25
26#include "rasodmg/collection.hh"
27
28//@ManMemo: Module: {\bf rasodmg}
29
46template <class T>
48{
49public:
51 r_Iterator() = default;
55 explicit r_Iterator(r_Collection<T> &source, int removed_objects = 0);
63 ~r_Iterator() = default;
64
69 int is_equal(const r_Iterator<T> &iter) const;
70
75
77 void reset(int removed_objects = 0);
85 bool not_done() const;
87 void advance();
88
92 T get_element() const;
93
95 bool next(T &element);
96
98 void replace_element(const T &element);
99
100private:
102 bool ndone{false};
104 r_Collection<T> *collection{NULL};
106 typename r_Collection<T>::CNode *ptr{NULL};
107};
108
109class r_GMarray;
110extern template class r_Iterator<r_GMarray *>;
111class r_Ref_Any;
112extern template class r_Iterator<r_Ref_Any>;
113class r_Object;
114template <typename T>
115class r_Ref;
116extern template class r_Iterator<r_Ref<r_Object>>;
117extern template class r_Iterator<r_Ref<r_GMarray>>;
118
119struct GenRefElement;
120extern template class r_Iterator<GenRefElement *>;
121
122#endif
Basic class of a collection.
Definition collection.hh:44
The class represents a generic MDD in the sense that it is independent of the cell base type.
Definition gmarray.hh:66
The template class r_Iterator defines the generic behavior for iteration.
Definition iterator.hh:48
r_Iterator< T > operator++(int)
postfix incrementor
void reset(int removed_objects=0)
re-initialize the iterator to the start of iteration for the same collection
r_Iterator(const r_Iterator< T > &iter)
copy constructor
bool not_done() const
Resets the iterator to point to the first element of the element collection.
r_Iterator< T > & operator++()
prefix incrementor
void replace_element(const T &element)
replaces the actual element (can only be used with r_List)
bool next(T &element)
gets the actual element, advances one element, and returns whether iteration is complete or not
r_Iterator< T > & operator=(const r_Iterator< T > &iter)
assignment operator
r_Iterator(r_Collection< T > &source, int removed_objects=0)
constructor getting the collection on which to iterate (used for r_Collection::create_iterator())
r_Iterator()=default
default constructor
void advance()
advances one element
int is_equal(const r_Iterator< T > &iter) const
comparisons: equal if they point to the same element in the same collection, not equal if they point ...
T operator*()
the dereference operator gets the actual element
~r_Iterator()=default
Creates an iterator which points to the first element of the element collection.
T get_element() const
gets the actual element
Through inheritance of this class, the type definer specifies that the subclass is capable of having ...
Definition object.hh:62
The class r_Ref_Any is defined to support a reference to any type.
Definition ref.hh:65
References of type r_Ref in many respects behave like C++ pointers but provide an additional mechanis...
Definition ref.hh:198
element type of non r_Object list maintained by the transaction
Definition genreftype.hh:39
Definition collection.hh:117