IteratorAtom.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_ITERATOR_ATOM_H
00026 #define _EYEDB_ITERATOR_ATOM_H
00027 
00028 namespace eyedb {
00029 
00030 #define NEW_ITER_ATOM
00031   enum IteratorAtomType {
00032 #ifdef NEW_ITER_ATOM
00033     IteratorAtom_INT16 = 1,
00034     IteratorAtom_INT32,
00035     IteratorAtom_INT64,
00036     IteratorAtom_CHAR,
00037     IteratorAtom_DOUBLE,
00038     IteratorAtom_STRING,
00039     IteratorAtom_OID,
00040     IteratorAtom_IDR
00041 #else
00042     IteratorAtom_NULL = 1,
00043     IteratorAtom_NIL,
00044     IteratorAtom_BOOL,
00045     IteratorAtom_INT16,
00046     IteratorAtom_INT32,
00047     IteratorAtom_INT64,
00048     IteratorAtom_CHAR,
00049     IteratorAtom_DOUBLE,
00050     IteratorAtom_STRING,
00051     IteratorAtom_IDENT,
00052     IteratorAtom_OID,
00053     IteratorAtom_IDR,
00054     IteratorAtom_LISTSEP
00055 #endif
00056   };
00057 
00058   struct IteratorAtom {
00059     IteratorAtomType type;
00060 
00061     char *fmt_str;
00062 
00063     union {
00064       eyedblib::int16 i16;
00065       eyedblib::int32 i32;
00066       eyedblib::int64 i64;
00067       char c;
00068       double d;
00069       char *str;
00070       eyedbsm::Oid oid;
00071       struct {
00072         Size size;
00073         Data idr;
00074       } data;
00075 #ifndef NEW_ITER_ATOM
00076       Bool b;
00077       char *ident;
00078       Bool open;
00079 #endif
00080     };
00081 
00082     IteratorAtom();
00083     IteratorAtom(const IteratorAtom&);
00084 
00085     Value* toValue() const;
00086 
00087     operator Value *() {
00088       return toValue();
00089     }
00090 
00091     void print(FILE * = stdout);
00092     char *getString();
00093     int getSize() const;
00094 
00095     IteratorAtom &operator =(const IteratorAtom &);
00096     void code(Data *, Offset *, Size *);
00097     void decode(Data, Offset *);
00098 
00099     void garbage();
00100     IteratorAtom *next;
00101 
00102     static void makeValueArray(IteratorAtom **atoms, int count,
00103                                ValueArray &valarray);
00104     ~IteratorAtom();
00105   };
00106 
00107 }
00108 
00109 #endif

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