rasdaman complete source
dbobjectiditerator.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 /*
24  * 2007-may-10 CJ fixed compilation errors (gcc 4.1)
25 */
26 
27 #ifndef _DBOBJECtIdIterATOR_HH_
28 #define _DBOBJECtIdIterATOR_HH_
29 
30 template <class T> class DBObjectIdIterator;
31 template <class T> class DBRef;
32 class ObjectBroker;
33 
34 #include "lists.h"
35 //@ManMemo: Module: {\bf reladminif}.
36 /*@Doc:
37 
38 this object gets a set of oids. when an oid is accessed the iterator returns a DBRef to the oid.
39 
40 */
41 
45 template<class T>
47 {
48 public:
49  DBObjectIdIterator(const std::set<DBRef<T>, std::less<DBRef<T> > >& oidlist);
50  /*@Doc:
51  constructs a new Iterator. the OIdSet will be deleted by the DBOBjectIdIterator.
52  there may be oids of objects with other classes present. you should be carefull
53  when using this feature - as in mddtypes/mddbasetypes/mdddim/domtypes
54  */
55 
57  /*@Doc:
58  */
59 
61  /*@Doc:
62  deletes the OIdSet passed to it in the constructor
63  */
64 
65  void reset();
66  /*@Doc:
67  resets the iterator to the beginning
68  */
69 
70  bool not_done() const;
71  /*@Doc:
72  checks if there are more elements
73  */
74 
75  void advance();
76  /*@Doc:
77  advances the iterator one entry
78  */
79 
80  DBRef<T> get_element() const;
81  /*@Doc:
82  returns an dbref<object>
83  */
84 
85 private:
86  typename std::set<DBRef<T>, std::less<DBRef<T> > >::iterator myIter;
87  /*@Doc:
88  internal pointer where the iterator is
89  */
90 
91  std::set<DBRef<T>, std::less<DBRef<T> > >* mySet;
92  /*@Doc:
93  the actual list which is used to lookup objects by the objectbroker
94  */
95 
96  unsigned int counter;
97  /*@Doc:
98  holds the actual position in set
99  */
100 };
101 
102 #ifdef EARLY_TEMPLATE
103 #ifdef __EXECUTABLE__
104 #include "dbobjectiditerator.cc"
105 #endif
106 #endif
107 
108 #endif
109 
110 
DBRef< T > get_element() const
Definition: dbobject.hh:29
DBObjectIdIterator(const std::set< DBRef< T >, std::less< DBRef< T > > > &oidlist)
bool not_done() const
Definition: objectbroker.hh:71
Definition: dbobjectiditerator.hh:30