CollSet.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_SET_H
00026 #define _EYEDB_COLL_SET_H
00027 
00028 namespace eyedb {
00029 
00038   class CollSet : public Collection {
00039 
00040     // ----------------------------------------------------------------------
00041     // CollSet Interface
00042     // ----------------------------------------------------------------------
00043   public:
00052     CollSet(Database *db, const char *n, Class *mc = NULL,
00053             Bool isref = True,
00054             const IndexImpl *idximpl = 0);
00055 
00064     CollSet(Database *db, const char *n, Class *mc, int dim,
00065             const IndexImpl *idximpl = 0);
00066 
00071     CollSet(const CollSet &o);
00072 
00078     CollSet& operator=(const CollSet &o);
00079 
00084     virtual Object *clone() const {return new CollSet(*this);}
00085 
00092     virtual CollSet *asCollSet() {return this;}
00093 
00098     virtual const CollSet *asCollSet() const {return this;}
00099 
00100     // ----------------------------------------------------------------------
00101     // CollSet Private Part
00102     // ----------------------------------------------------------------------
00103   private:
00104     void init();
00105 
00106     const char *getClassName() const;
00107     CollSet(const char *, Class *,
00108             const Oid&, const Oid&, int,
00109             int, int, const IndexImpl *,
00110             Object *, Bool, Bool, Data, Size);
00111     friend class CollectionPeer;
00112 
00113     // ----------------------------------------------------------------------
00114     // CollSet Restricted Access (conceptually private)
00115     // ----------------------------------------------------------------------
00116   public:
00117     CollSet(const char *, Class * = NULL, Bool = True,
00118             const IndexImpl * = 0);
00119     CollSet(const char *, Class *, int,
00120             const IndexImpl * = 0);
00121 
00122     Status insert_p(const Oid &item_oid, Bool noDup = False);
00123     Status insert_p(const Object *item_o, Bool noDup = False);
00124     Status insert_p(Data data, Bool noDup = False, Size size = defaultSize);
00125   };
00126 
00127   class CollSetPtr : public CollectionPtr {
00128 
00129   public:
00130     CollSetPtr(CollSet *o = 0) : CollectionPtr(o) { }
00131 
00132     CollSet *getCollSet() {return dynamic_cast<CollSet *>(o);}
00133     const CollSet *getCollSet() const {return dynamic_cast<CollSet *>(o);}
00134 
00135     CollSet *operator->() {return dynamic_cast<CollSet *>(o);}
00136     const CollSet *operator->() const {return dynamic_cast<CollSet *>(o);}
00137   };
00138 
00139   typedef std::vector<CollSetPtr> CollSetPtrVector;
00140 
00145 }
00146 
00147 #endif

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