Iterator.h

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 
00025 #ifndef _EYEDB_ITERATOR_H
00026 #define _EYEDB_ITERATOR_H
00027 
00028 namespace eyedb {
00029 
00030   // ----------------------------------------------------------------------
00031   //
00032   // The Iterator interface is not part of the API. It is used for internal
00033   // use only.
00034   // 
00035   // ----------------------------------------------------------------------
00036 
00037   class IteratorAtom;
00038 
00039   class Iterator {
00040 
00041     // ----------------------------------------------------------------------
00042     // Iterator Interface
00043     // ----------------------------------------------------------------------
00044   public:
00045     Iterator(Class *, Bool include_subclasses = False); /* class query */
00046     Iterator(const Collection *, Bool index = False); /* collection query */
00047     Iterator(Database *, const Attribute *, int, Data, int);
00048     Iterator(Database *, const Attribute *, int,
00049              Data, Data, Bool, Bool, int);
00050 
00051     Status getStatus() const;
00052 
00053     int getCount() const {return _count;}
00054 
00055     Status scanNext(Bool &found, Oid &);
00056     Status scanNext(Bool &found, ObjectPtr &,
00057                     const RecMode * = RecMode::NoRecurs);
00058     Status scanNext(Bool &found, Object *&,
00059                     const RecMode * = RecMode::NoRecurs);
00060     Status scanNext(Bool &found, Value &);
00061 
00062     /* same as 3 previous methods : pointer version */
00063     Status scanNext(Bool *found, Oid *);
00064     Status scanNext(Bool *found, Object **,
00065                     const RecMode * = RecMode::NoRecurs);
00066     Status scanNext(Bool *found, Value *);
00067 
00068     Status scan(ObjectPtrVector &, const RecMode * = RecMode::NoRecurs);
00069     Status scan(ObjectPtrVector &, unsigned int max,
00070                 unsigned int start = 0, const RecMode * = RecMode::NoRecurs);
00071     Status scan(ObjectArray &, const RecMode * = RecMode::NoRecurs);
00072     Status scan(ObjectArray &, unsigned int max,
00073                 unsigned int start = 0, const RecMode * = RecMode::NoRecurs);
00074     Status scan(OidArray &, unsigned int max = ~0,
00075                 unsigned int start = 0);
00076     Status scan(ValueArray &, unsigned int max = ~0,
00077                 unsigned int start = 0);
00078     ~Iterator();
00079 
00080     // ----------------------------------------------------------------------
00081     // Iterator Private Part
00082     // ----------------------------------------------------------------------
00083   private:
00084     Status status;
00085     int curqid;
00086     int nqids;
00087     int *qid;
00088     Database *db;
00089     int curatom, readatom;
00090     int buff_len;
00091     IteratorAtom *buffatom;
00092     Bool state;
00093     void init(Database *);
00094     int _count;
00095     SchemaInfo *schinfo;
00096 
00097   public: /* restricted */
00098     Status scanNext(Bool *found, IteratorAtom *);
00099     Status scan(int *count, IteratorAtom **);
00100     static Status initDatabase(Database *);
00101   };
00102 
00103   extern void oqml_initialize();
00104   extern void oqml_release();
00105 
00106 }
00107 
00108 #endif

Generated on Mon Dec 22 18:15:56 2008 for eyedb by  doxygen 1.5.3