Agregat.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_AGREGAT_H
00026 #define _EYEDB_AGREGAT_H
00027 
00028 namespace eyedb {
00029 
00038   class Agregat : public Instance {
00039 
00040     // ----------------------------------------------------------------------
00041     // Agregat Interface
00042     // ----------------------------------------------------------------------
00043   public:
00049     Agregat(Database *db = 0, const Dataspace *dataspace = 0);
00050 
00055     Agregat(const Agregat &o);
00056 
00062     Agregat(const Agregat *o, Bool share = False);
00063 
00068     Agregat& operator=(const Agregat &o);
00069 
00076     Status setValue(Data data);
00077 
00084     Status getValue(Data* data) const;
00085 
00092     Status setItemSize(const Attribute* agreg, Size size);
00093 
00100     Status getItemSize(const Attribute* agreg, Size* psize) const;
00101 
00110     Status setItemValue(const Attribute* agreg, Data data, int nb=1, int from=0);
00111 
00120     Status setItemOid(const Attribute* agreg, const Oid * poid, int nb=1, int from=0);
00121 
00130     Status getItemOid(const Attribute *agreg, Oid *poid, int nb = 1, int from = 0) const;
00131 
00137     virtual Status realize(const RecMode* recmode = RecMode::NoRecurs);
00138 
00144     virtual Status remove(const RecMode* recmode = RecMode::NoRecurs);
00145 
00153     virtual Status trace(FILE* fd = stdout, unsigned int flags = 0,
00154                          const RecMode * recmode = RecMode::FullRecurs) const;
00155 
00160     virtual Agregat *asAgregat() {return this;}
00161 
00166     virtual const Agregat *asAgregat() const {return this;}
00167 
00170     virtual ~Agregat();
00171 
00172     // ----------------------------------------------------------------------
00173     // Agregat Protected Part
00174     // ----------------------------------------------------------------------
00175   protected:
00176     Status checkAgreg(const Attribute*) const;
00177     Status create();
00178     Status update();
00179     virtual void garbage();
00180 #ifdef GBX_NEW_CYCLE
00181     virtual void decrRefCountPropag();
00182 #endif
00183     void initialize(Database *);
00184 
00185     // ----------------------------------------------------------------------
00186     // Agregat Private Part
00187     // ----------------------------------------------------------------------
00188   private:
00189     void copy(const Agregat *, Bool);
00190 
00191     Status trace_realize(FILE*, int, unsigned int, const RecMode *) const;
00192     Status create_realize(Bool);
00193     Status update_realize(Bool);
00194 
00195     // ----------------------------------------------------------------------
00196     // Agregat Restricted Access (conceptually private)
00197     // ----------------------------------------------------------------------
00198   public:
00199     virtual void manageCycle(gbxCycleContext &);
00200 
00201     Status realizePerform(const Oid& cloid,
00202                           const Oid& objoid,
00203                           AttrIdxContext &idx_ctx,
00204                           const RecMode *);
00205     Status loadPerform(const Oid& cloid,
00206                        LockMode,
00207                        AttrIdxContext &idx_ctx,
00208                        const RecMode* = RecMode::NoRecurs);
00209     Status removePerform(const Oid& cloid,
00210                          const Oid& objoid,
00211                          AttrIdxContext &idx_ctx,
00212                          const RecMode *);
00213   };
00214 
00215   class AgregatPtr : public InstancePtr {
00216 
00217   public:
00218     AgregatPtr(Agregat *o = 0) : InstancePtr(o) { }
00219 
00220     Agregat *getAgregat() {return dynamic_cast<Agregat *>(o);}
00221     const Agregat *getAgregat() const {return dynamic_cast<Agregat *>(o);}
00222 
00223     Agregat *operator->() {return dynamic_cast<Agregat *>(o);}
00224     const Agregat *operator->() const {return dynamic_cast<Agregat *>(o);}
00225   };
00226 
00227   typedef std::vector<AgregatPtr> AgregatPtrVector;
00228 
00233 }
00234 
00235 #endif

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