base.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_BASE_H
00026 #define _EYEDB_BASE_H
00027 
00028 #include <eyedblib/machtypes.h>
00029 #include <eyedbsm/eyedbsm.h>
00030 
00031 class rpcDB_LocalDBContext;
00032 
00033 namespace eyedb {
00034 
00040   class DbHandle;
00041   class ConnHandle;
00042 
00043   typedef unsigned char *Data;
00044   typedef eyedblib::uint32 Size;
00045   typedef eyedblib::uint32 Type;
00046   typedef eyedblib::uint32 Offset;
00047   typedef void * Any;
00048   typedef eyedbsm::DatType DatType;
00049 
00050   enum Bool {
00051     False = 0,
00052     True = 1
00053   };
00054 
00055   enum {
00056     _DBRead       = 0x2,
00057     _DBRW         = 0x4,
00058     _DBSRead      = 0x8,
00059 
00060     /* modifier */
00061     _DBAdmin      = 0x10,
00062     _DBOpenLocal  = 0x20
00063   };
00064 
00065   struct DbCreateDescription {
00066     char dbfile[256];
00067     eyedbsm::DbCreateDescription sedbdesc;
00068   };
00069 
00070   typedef DbCreateDescription DbInfoDescription;
00071 
00072   enum LockMode {
00073     DefaultLock = eyedbsm::DefaultLock,
00074     LockN = eyedbsm::LockN,   /* no lock */
00075     LockX = eyedbsm::LockX,   /* exclusive */
00076     LockSX = eyedbsm::LockSX, /* shared/exclusive */
00077     LockS = eyedbsm::LockS,   /* shared */
00078     LockP = eyedbsm::LockP    /* private */
00079   };
00080 
00081   enum TransactionMode {
00082     TransactionOff = eyedbsm::TransactionOff,  /* no rollback is possible */
00083     TransactionOn  = eyedbsm::TransactionOn
00084   };
00085 
00086   enum MapHints {
00087     DefaultMap = 0,
00088     WholeMap = eyedbsm::WholeMap,
00089     SegmentMap = eyedbsm::SegmentMap
00090   };
00091 
00092   struct OpenHints {
00093     MapHints maph;
00094     unsigned int mapwide; /* in pages */
00095   };
00096 
00097   /* lockmode: S means shared, X means exclusive, SX means shared/exclusive,
00098      N means no */
00099   enum TransactionLockMode {
00100     ReadSWriteS = eyedbsm::ReadSWriteS, /* read shared; write shared */
00101     ReadSWriteSX = eyedbsm::ReadSWriteSX, /* read shared; write shared/exclusive */  
00102     ReadSWriteX = eyedbsm::ReadSWriteX,  /* read shared; write exclusive */  
00103     ReadSXWriteSX = eyedbsm::ReadSXWriteSX, /* read shared/exclusive; write shared/exclusive */
00104     ReadSXWriteX = eyedbsm::ReadSXWriteX, /* read shared/exclusive; write exclusive */
00105     ReadXWriteX = eyedbsm::ReadXWriteX,  /* read exclusive; write exclusive */
00106     ReadNWriteS = eyedbsm::ReadNWriteS,  /* read no lock; write shared */
00107     ReadNWriteSX = eyedbsm::ReadNWriteSX, /* read no lock; write shared/exclusive */
00108     ReadNWriteX = eyedbsm::ReadNWriteX, /* read no lock; write exclusive */
00109     ReadNWriteN = eyedbsm::ReadNWriteN, /* read no lock; write no lock */
00110     DatabaseW = eyedbsm::DatabaseW, /* database exclusive for writing */
00111     DatabaseRW = eyedbsm::DatabaseRW, /* database exclusive for reading and writing */
00112     DatabaseWtrans = eyedbsm::DatabaseWtrans /* database exclusive for writing transaction */
00113   };
00114 
00115   enum RecoveryMode {
00116     RecoveryOff = eyedbsm::RecoveryOff, /* prevents from remote client failure */
00117     RecoveryPartial = eyedbsm::RecoveryPartial, /* plus prevents from local client and server failure */
00118     RecoveryFull = eyedbsm::RecoveryFull     /* plus prevents from OS failure */
00119   };
00120 
00121   extern const char NullString[];
00122   extern const char NilString[];
00123 
00124 #define IDBBOOL(X) ((X) ? True : False)
00125 
00130 }
00131 
00132 #endif

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