RecMode.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_RECMODE_H
00026 #define _EYEDB_RECMODE_H
00027 
00028 namespace eyedb {
00029 
00035   enum RecModeType {
00036     RecMode_NoRecurs,
00037     RecMode_FullRecurs,
00038     RecMode_FieldNames,
00039     RecMode_Predicat
00040   };
00041 
00042   struct Attribute;
00043   class Object;
00044   class ObjectPtr;
00045 
00049   class RecMode {
00050 
00051     // ----------------------------------------------------------------------
00052     // RecMode Interface
00053     // ----------------------------------------------------------------------
00054   public:
00059     RecMode(RecModeType typ);
00060 
00065     RecMode(Bool (*p)(const Object *, const Attribute *, int));
00066 
00071     RecMode(const char *first, ...);
00072 
00078     RecMode(Bool no, const char *first, ...);
00079 
00087     Bool isAgregRecurs(const Attribute *agreg, int n = 0, const Object *o = NULL) const;
00088 
00093     RecModeType getType() const {return type;}
00094 
00095 
00096     static const RecMode *FullRecurs;
00097     static const RecMode *NoRecurs;
00098 
00099     // ----------------------------------------------------------------------
00100     // RecMode Private Part
00101     // ----------------------------------------------------------------------
00102   private:
00103     RecModeType type;
00104 
00105     union {
00106       struct {
00107         Bool _not;
00108         int fnm_cnt;
00109         char **fnm;
00110       } fnm;
00111       Bool (*pred)(const Object *, const Attribute *, int);
00112     } u;
00113 
00114     // ----------------------------------------------------------------------
00115     // RecMode Restricted Access (conceptually private)
00116     // ----------------------------------------------------------------------
00117   public:
00118     static void init(void);
00119     static void _release(void);
00120   };
00121 
00122   extern const RecMode *FullRecurs;
00123   extern const RecMode *NoRecurs;
00124 
00129 }
00130 
00131 #endif

Generated on Mon Dec 22 18:16:07 2008 for eyedb by  doxygen 1.5.3