CollectionPeer.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 #include "eyedb_p.h"
00026 
00027 namespace eyedb {
00028 
00029   int CollectionPeer::coherent = Collection::coherent,
00030     CollectionPeer::added = Collection::added,
00031     CollectionPeer::removed = Collection::removed;
00032 
00033   CollSet *CollectionPeer::collSet(const char *name,
00034                                    const IndexImpl *idximpl)
00035   {
00036     return new CollSet(name, 0, True, idximpl);
00037   }
00038 
00039   CollSet *CollectionPeer::collSet(const char *name, Class *cls,
00040                                    const Oid& idx1_oid,
00041                                    const Oid& idx2_oid, int icnt,
00042                                    int bottom, int top,
00043                                    const IndexImpl *idximpl,
00044                                    Object *card,
00045                                    Bool is_literal,
00046                                    Bool is_pure_literal,
00047                                    Data idx_data, Size idx_data_size)
00048   {
00049     return new CollSet(name, cls, idx1_oid, idx2_oid, icnt,
00050                        bottom, top, idximpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00051   }
00052 
00053   CollBag *CollectionPeer::collBag(const char *name,
00054                                    const IndexImpl *idximpl)
00055   {
00056     return new CollBag(name, 0, True, idximpl);
00057   }
00058 
00059   CollBag *CollectionPeer::collBag(const char *name, Class *cls,
00060                                    const Oid& idx1_oid,
00061                                    const Oid& idx2_oid, int icnt,
00062                                    int bottom, int top,
00063                                    const IndexImpl *idximpl,
00064                                    Object *card,
00065                                    Bool is_literal,
00066                                    Bool is_pure_literal,
00067                                    Data idx_data, Size idx_data_size)
00068   {
00069     return new CollBag(name, cls, idx1_oid, idx2_oid, icnt,
00070                        bottom, top, idximpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00071   }
00072 
00073   CollList *CollectionPeer::collList(const char *name,
00074                                      const IndexImpl *idximpl)
00075   {
00076     return new CollList(name, 0, True, idximpl);
00077   }
00078 
00079   CollList *CollectionPeer::collList(const char *name, Class *cls,
00080                                      const Oid& idx1_oid,
00081                                      const Oid& idx2_oid, int icnt,
00082                                      int bottom, int top,
00083                                      const IndexImpl *idximpl,
00084                                      Object *card,
00085                                      Bool is_literal,
00086                                      Bool is_pure_literal,
00087                                      Data idx_data, Size idx_data_size)
00088   {
00089     return new CollList(name, cls, idx1_oid, idx2_oid, icnt,
00090                        bottom, top, idximpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00091   }
00092 
00093   CollArray *CollectionPeer::collArray(const char *name,
00094                                        const IndexImpl *idximpl)
00095   {
00096     return new CollArray(name, 0, True, idximpl);
00097   }
00098 
00099   CollArray *CollectionPeer::collArray(const char *name, Class *cls,
00100                                        const Oid& idx1_oid,
00101                                        const Oid& idx2_oid, int icnt,
00102                                        int bottom, int top,
00103                                        const IndexImpl *idximpl,
00104                                        Object *card,
00105                                        Bool is_literal,
00106                                        Bool is_pure_literal,
00107                                        Data idx_data, Size idx_data_size)
00108   {
00109     return new CollArray(name, cls, idx1_oid, idx2_oid, icnt,
00110                          bottom, top, idximpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00111   }
00112 
00113   void CollectionPeer::setLock(Collection *coll, Bool locked)
00114   {
00115     coll->locked = locked;
00116   }
00117 
00118   void CollectionPeer::setInvOid(Collection *coll, const Oid& inv_oid,
00119                                  int inv_item)
00120   {
00121     coll->inv_oid = inv_oid;
00122     coll->inv_item = inv_item;
00123   }
00124 
00125   Bool CollectionPeer::isLocked(Collection *coll)
00126   {
00127     Database *db = coll->getDatabase();
00128     return IDBBOOL(coll->locked && (!db || !(db->getOpenFlag() & _DBAdmin)));
00129   }
00130 }

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