ByteClass.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_BYTE_CLASS_H
00026 #define _EYEDB_BYTE_CLASS_H
00027 
00028 namespace eyedb {
00029 
00038   class ByteClass : public BasicClass {
00039     // ----------------------------------------------------------------------
00040     // ByteClass Interface
00041     // ----------------------------------------------------------------------
00042   public:
00047     ByteClass(Database *db = NULL);
00048 
00053     ByteClass(const ByteClass &cl);
00054 
00060     ByteClass& operator=(const ByteClass &cl);
00061 
00066     virtual Object *clone() const {return new ByteClass(*this);}
00067 
00073     Object *newObj(Database *db = NULL) const;
00074 
00081     Object *newObj(Data data, Bool copy = True) const;
00082 
00092     Status traceData(FILE *fd, int indent, Data inidata,
00093                      Data data, TypeModifier *tmod = NULL) const;
00094 
00099     virtual ByteClass *asByteClass() {return this;}
00100 
00105     virtual const ByteClass *asByteClass() const {return this;}
00106 
00107     // ----------------------------------------------------------------------
00108     // ByteClass Private Part
00109     // ----------------------------------------------------------------------
00110   private:
00111     Status trace_realize(FILE*, int, unsigned int, const RecMode *) const;
00112 
00113     // ----------------------------------------------------------------------
00114     // ByteClass Restricted Access (conceptually private)
00115     // ----------------------------------------------------------------------
00116   public:
00117     // E_XDR
00118     virtual void decode(void * hdata, // to
00119                         const void * xdata, // from
00120                         Size incsize, // temporarely necessary 
00121                         unsigned int nb = 1) const;
00122 
00123     virtual void encode(void * xdata, // to
00124                         const void * hdata, // from
00125                         Size incsize, // temporarely necessary 
00126                         unsigned int nb = 1) const;
00127 
00128     virtual int cmp(const void * xdata,
00129                     const void * hdata,
00130                     Size incsize, // temporarely necessary 
00131                     unsigned int nb = 1) const;
00132   };
00133 
00134   class ByteClassPtr : public BasicClassPtr {
00135 
00136   public:
00137     ByteClassPtr(ByteClass *o = 0) : BasicClassPtr(o) { }
00138 
00139     ByteClass *getByteClass() {return dynamic_cast<ByteClass *>(o);}
00140     const ByteClass *getByteClass() const {return dynamic_cast<ByteClass *>(o);}
00141 
00142     ByteClass *operator->() {return dynamic_cast<ByteClass *>(o);}
00143     const ByteClass *operator->() const {return dynamic_cast<ByteClass *>(o);}
00144   };
00145 
00146   typedef std::vector<ByteClassPtr> ByteClassPtrVector;
00147 
00152 }
00153 
00154 #endif
00155   

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