rasdaman base DBMS
dbobjectiterator.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 /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 #ifndef _DBOBJECTITERATOR_HH_
24 #define _DBOBJECTITERATOR_HH_
25 
26 template <class T> class DBObjectIterator;
27 template <class T> class DBRef;
28 class ObjectBroker;
29 
30 #include "lists.h"
31 //@ManMemo: Module: {\bf reladminif}.
32 /*@Doc:
33 
34 this object gets a set of oids. when an oid is accessed the iterator returns a DBRef to the oid.
35 
36 */
37 
41 template<class T>
42 class DBObjectIterator
43 {
44 public:
45  DBObjectIterator(const OIdSet& oidlist);
46  /*@Doc:
47  constructs a new Iterator. the OIdSet will be deleted by the DBOBjectIterator.
48  there may be oids of objects with other classes present. you should be carefull
49  when using this feature - as in mddtypes/mddbasetypes/mdddim/domtypes
50  */
51 
53  /*@Doc:
54  */
55 
57  /*@Doc:
58  deletes the OIdSet passed to it in the constructor
59  */
60 
61  void reset();
62  /*@Doc:
63  resets the iterator to the beginning
64  */
65 
66  bool not_done() const;
67  /*@Doc:
68  checks if there are more elements
69  */
70 
71  void advance();
72  /*@Doc:
73  advances the iterator one entry
74  */
75 
76  DBRef<T> get_element() const;
77  /*@Doc:
78  returns an dbref<object>
79  */
80 
81 private:
82  OIdSet::iterator myIter;
83  /*@Doc:
84  internal pointer where the iterator is
85  */
86 
87  OIdSet* mySet;
88  /*@Doc:
89  the actual list which is used to lookup objects by the objectbroker
90  */
91 
92  unsigned int counter;
93  /*@Doc:
94  holds the actual position in set
95  */
96 };
97 
98 #ifdef EARLY_TEMPLATE
99 #ifdef __EXECUTABLE__
100 #include "dbobjectiterator.cc"
101 #endif
102 #endif
103 
104 #endif
105 
106 
DBRef< T > get_element() const
Definition: dbobject.hh:29
Definition: dbobjectiterator.hh:26
Definition: objectbroker.hh:71
DBObjectIterator(const OIdSet &oidlist)
std::set< OId, std::less< double > > OIdSet
Definition: lists.h:38
bool not_done() const