CollBag.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_COLL_BAG_H
00026 #define _EYEDB_COLL_BAG_H
00027 
00028 namespace eyedb {
00029 
00038   class CollBag : public Collection {
00039 
00040     // ----------------------------------------------------------------------
00041     // CollBag Interface
00042     // ----------------------------------------------------------------------
00043   public:
00052     CollBag(Database *db, const char *n, Class *mc = NULL,
00053             Bool isref = True, const IndexImpl *idximpl = 0);
00054 
00063     CollBag(Database *db, const char *n, Class *mc, int dim,
00064             const IndexImpl *idximpl = 0);
00065 
00070     CollBag(const CollBag &o);
00071 
00077     CollBag& operator=(const CollBag &o);
00078 
00083     virtual Object *clone() const {return new CollBag(*this);}
00084 
00085 
00090     virtual CollBag *asCollBag() {return this;}
00091 
00096     virtual const CollBag *asCollBag() const {return this;}
00097 
00098     // ----------------------------------------------------------------------
00099     // CollBag Private Part
00100     // ----------------------------------------------------------------------
00101   private:
00102     void init();
00103     const char *getClassName() const;
00104     CollBag(const char *, Class *,
00105             const Oid&, const Oid&, int,
00106             int, int, const IndexImpl *, Object *, Bool, Bool,
00107             Data, Size);
00108     friend class CollectionPeer;
00109 
00110     // ----------------------------------------------------------------------
00111     // CollBag Restricted Access (conceptually private)
00112     // ----------------------------------------------------------------------
00113   public:
00114     CollBag(const char *, Class * = NULL, Bool = True,
00115             const IndexImpl * = 0);
00116     CollBag(const char *, Class *, int,
00117             const IndexImpl * = 0);
00118 
00119     Status insert_p(const Oid &item_oid, Bool noDup = False);
00120     Status insert_p(const Object *item_o, Bool noDup = False);
00121     Status insert_p(Data val, Bool noDup = False, Size size = defaultSize);
00122   };
00123 
00124   class CollBagPtr : public CollectionPtr {
00125 
00126   public:
00127     CollBagPtr(CollBag *o = 0) : CollectionPtr(o) { }
00128 
00129     CollBag *getCollBag() {return dynamic_cast<CollBag *>(o);}
00130     const CollBag *getCollBag() const {return dynamic_cast<CollBag *>(o);}
00131 
00132     CollBag *operator->() {return dynamic_cast<CollBag *>(o);}
00133     const CollBag *operator->() const {return dynamic_cast<CollBag *>(o);}
00134   };
00135 
00136   typedef std::vector<CollBagPtr> CollBagPtrVector;
00137 
00142 }
00143 
00144 #endif

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