Byte.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_H
00026 #define _EYEDB_BYTE_H
00027 
00028 namespace eyedb {
00029 
00038   class Byte : public Basic {
00039 
00040     // -----------------------------------------------------------------------
00041     // Byte Interface
00042     // -----------------------------------------------------------------------
00043   public:
00048     Byte(unsigned char c =0);
00049 
00056     Byte(Database *db, unsigned char c = 0, const Dataspace *dataspace = 0);
00057 
00062     Byte(const Byte *o);
00063 
00068     Byte(const Byte &o);
00069 
00074     Byte& operator=(const Byte &o);
00075 
00080     virtual Object *clone() const {return new Byte(*this);}
00081 
00089     Status trace(FILE* fd = stdout, unsigned int flags = 0, const RecMode * recmode = RecMode::FullRecurs) const;
00090 
00096     Status setValue(Data data);
00097 
00103     Status getValue(Data* data) const;
00104 
00109     virtual Byte *asByte() {return this;}
00110 
00115     virtual const Byte *asByte() const {return this;}
00116 
00117     // -----------------------------------------------------------------------
00118     // Byte Private Part
00119     // -----------------------------------------------------------------------
00120   private:
00121     Status trace_realize(FILE*, int, unsigned int, const RecMode *) const;
00122     unsigned char val;
00123     Status create();
00124     Status update();
00125   };
00126 
00127   class BytePtr : public BasicPtr {
00128 
00129   public:
00130     BytePtr(Byte *o = 0) : BasicPtr(o) { }
00131 
00132     Byte *getByte() {return dynamic_cast<Byte *>(o);}
00133     const Byte *getByte() const {return dynamic_cast<Byte *>(o);}
00134 
00135     Byte *operator->() {return dynamic_cast<Byte *>(o);}
00136     const Byte *operator->() const {return dynamic_cast<Byte *>(o);}
00137   };
00138 
00139   typedef std::vector<BytePtr> BytePtrVector;
00140 
00141   extern ByteClass    *Byte_Class;
00142   extern const char byte_class_name[];
00143 
00148 }
00149 
00150 #endif

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