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 
46 template <class T>
47 class r_Iterator
48 {
49 public:
51  r_Iterator() = default;
53  r_Iterator(const r_Iterator<T> &iter);
55  explicit r_Iterator(r_Collection<T> &source, int removed_objects = 0);
62  ~r_Iterator() = default;
64 
69  int is_equal(const r_Iterator<T> &iter) const;
70 
75 
77  void reset(int removed_objects = 0);
84  bool not_done() const;
87  void advance();
88 
90  T operator*();
92  T get_element() const;
93 
95  bool next(T &element);
96 
98  void replace_element(const T &element);
99 
100 private:
102  bool ndone{false};
104  r_Collection<T> *collection{NULL};
106  typename r_Collection<T>::CNode *ptr{NULL};
107 };
108 
109 class r_GMarray;
110 extern template class r_Iterator<r_GMarray *>;
111 class r_Ref_Any;
112 extern template class r_Iterator<r_Ref_Any>;
113 class r_Object;
114 template <typename T>
115 class r_Ref;
116 extern template class r_Iterator<r_Ref<r_Object>>;
117 extern template class r_Iterator<r_Ref<r_GMarray>>;
118 
119 struct GenRefElement;
120 extern template class r_Iterator<GenRefElement *>;
121 
122 #endif
r_Collection
Basic class of a collection.
Definition: collection.hh:43
r_Iterator::reset
void reset(int removed_objects=0)
re-initialize the iterator to the start of iteration for the same collection
GenRefElement
element type of non r_Object list maintained by the transaction
Definition: genreftype.hh:38
r_Ref_Any
The class r_Ref_Any is defined to support a reference to any type.
Definition: ref.hh:64
r_Iterator::replace_element
void replace_element(const T &element)
replaces the actual element (can only be used with r_List)
r_Iterator::advance
void advance()
advances one element
r_Iterator::operator=
r_Iterator< T > & operator=(const r_Iterator< T > &iter)
assignment operator
r_Ref
References of type r_Ref in many respects behave like C++ pointers but provide an additional mechanis...
Definition: collection.hh:196
r_Iterator::next
bool next(T &element)
gets the actual element, advances one element, and returns whether iteration is complete or not
r_Iterator::not_done
bool not_done() const
Resets the iterator to point to the first element of the element collection.
collection.hh
r_Iterator
The template class r_Iterator defines the generic behavior for iteration.
Definition: collection.hh:30
r_Collection::CNode
Definition: collection.hh:116
r_Iterator::is_equal
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 ...
r_Iterator::operator*
T operator*()
the dereference operator gets the actual element
r_GMarray
The class represents a generic MDD in the sense that it is independent of the cell base type.
Definition: gmarray.hh:65
r_Iterator::~r_Iterator
~r_Iterator()=default
Creates an iterator which points to the first element of the element collection.
r_Iterator::get_element
T get_element() const
gets the actual element
r_Iterator::r_Iterator
r_Iterator()=default
default constructor
r_Iterator::operator++
r_Iterator< T > & operator++()
prefix incrementor
r_Object::r_Object
r_Object(r_Transaction *transaction=NULL)
default constructor