IteratorBE.cc

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 
00026 #include "eyedb_p.h"
00027 #include "OQLBE.h"
00028 #include "IteratorBE.h"
00029 #include "CollectionBE.h"
00030 #include "IteratorBEEngine.h"
00031 #include "BEQueue.h"
00032 
00033 namespace eyedb {
00034 
00035 LinkedList *IteratorBE::def_cl_list;
00036 
00037 IteratorBE::IteratorBE(Database *_db)
00038 {
00039   collbe = 0;
00040   schinfo = 0;
00041   qiter = 0;
00042 }
00043 
00044 IteratorBE::IteratorBE(Database *db, const Attribute *agr, int ind,
00045                        Data start, Data end, Bool sexcl,
00046                        Bool eexcl, int x_size)
00047 {
00048   qiter = new IteratorBEEngineAttribute(db, agr, ind, start, end, 
00049                                           sexcl, eexcl, x_size);
00050   status = qiter->getStatus();
00051   if (status == Success)
00052     qid = db->getBEQueue()->addIterator(this);
00053 
00054   collbe = 0;
00055   schinfo = 0;
00056 }
00057 
00058 IteratorBE::IteratorBE(CollectionBE *_collbe, Bool index)
00059 {
00060   collbe = _collbe;
00061   qiter = new IteratorBEEngineCollection(collbe, index);
00062 
00063   status = qiter->getStatus();
00064   if (status == Success)
00065     qid = collbe->getDatabase()->getBEQueue()->addIterator(this);
00066   schinfo = 0;
00067 }
00068 
00069 Status IteratorBE::getStatus() const
00070 {
00071   return status;
00072 }
00073 
00074 /*
00075 SchemaInfo *IteratorBE::getSchemaInfo()
00076 {
00077   if (!schinfo && qiter)
00078     schinfo =
00079       new SchemaInfo(((IteratorBEEngineOQL *)qiter)->getSchemaInfo());
00080   return schinfo;
00081 }
00082 */
00083 
00084 Status IteratorBE::scanNext(int wanted, int *found, IteratorAtom *atom_array)
00085 {
00086   IDB_CHECK_INTR();
00087 
00088   if (qiter)
00089     return qiter->scanNext(wanted, found, atom_array);
00090 
00091   return Success;
00092 }
00093 
00094 int IteratorBE::getQid() const
00095 {
00096   return qid;
00097 }
00098 
00099 IteratorBE::~IteratorBE()
00100 {
00101   delete qiter;
00102   if (collbe && !collbe->isLocked())
00103     delete collbe;
00104   delete schinfo;
00105 }
00106 }

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