Fennel: /home/pub/open/dev/fennel/common/Types.h Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 #ifndef Fennel_Types_Included 00025 #define Fennel_Types_Included 00026 00027 #include "fennel/common/SharedTypes.h" 00028 00029 #include 00030 00031 00032 00033 00034 #ifdef MSVC 00035 typedef __int8 int8_t; 00036 typedef __int16 int16_t; 00037 typedef __int32 int32_t; 00038 typedef __int64 int64_t; 00039 typedef unsigned __int8 uint8_t; 00040 typedef unsigned __int16 uint16_t; 00041 typedef unsigned __int32 uint32_t; 00042 typedef unsigned __int64 uint64_t; 00043 00044 #define snprintf _snprintf 00045 #define strcasecmp strcmpi 00046 00047 #endif 00048 00049 FENNEL_BEGIN_NAMESPACE 00050 00051 00052 00053 typedef uint8_t FixedBuffer;
00054 typedef uint8_t *PBuffer; 00055 typedef uint8_t const *PConstBuffer; 00056 00057 00058 typedef uint16_t Ucs2Char; 00059 00060 typedef Ucs2Char *Ucs2Buffer; 00061 typedef Ucs2Char const *Ucs2ConstBuffer; 00062 00063 00064 typedef uint64_t FileSize; 00065 00066 00067 typedef uint TupleStorageByteLength; 00068 00069 00070 typedef uint64_t SegVersionNum; 00071 00072 00073 typedef uint64_t MagicNumber; 00074 00075 template 00076 class SegNodeLock; 00077 00081 struct FENNEL_COMMON_EXPORT IntrusiveListNode 00082 { 00083 IntrusiveListNode *pNext; 00084 00085 #ifdef DEBUG 00086 IntrusiveListNode() 00087 { 00088 pNext = NULL; 00089 } 00090 #endif 00091 }; 00092 00093 00094 00095 00096 00097 00098 00099 class FENNEL_COMMON_EXPORT MaxU { 00100 public: 00101 MaxU() 00102 { 00103 } 00104 00105 operator uint8_t() const 00106 { 00107 return 0xFF; 00108 } 00109 00110 operator uint16_t() const 00111 { 00112 return 0xFFFF; 00113 } 00114 00115 operator uint32_t() const 00116 { 00117 return 0xFFFFFFFF; 00118 } 00119 00120 operator uint64_t() const 00121 { 00122 return 0xFFFFFFFFFFFFFFFFLL; 00123 } 00124 }; 00125 00126 static const MaxU MAXU; 00127 00128 00129 00130 template 00131 inline bool isMAXU(tU u) 00132 { 00133 return (u == tU(0xFFFFFFFFFFFFFFFFLL)); 00134 } 00135 00136 enum { ETERNITY = 0xFFFFFFFF }; 00137 00141 enum LockMode 00142 { 00146 LOCKMODE_S, 00147 00151 LOCKMODE_X, 00152 00156 LOCKMODE_S_NOWAIT, 00157 00161 LOCKMODE_X_NOWAIT 00162 00163 00164 }; 00165 00170 enum CheckpointType 00171 { 00175 CHECKPOINT_DISCARD, 00176 00180 CHECKPOINT_FLUSH_AND_UNMAP, 00181 00185 CHECKPOINT_FLUSH_ALL, 00186 00190 CHECKPOINT_FLUSH_FUZZY 00191 00192 00193 }; 00194 00199 enum DuplicateSeek 00200 { 00204 DUP_SEEK_ANY, 00205 00209 DUP_SEEK_BEGIN, 00210 00214 DUP_SEEK_END 00215 }; 00216 00221 typedef char const * const ParamName; 00222 00227 typedef char const * const ParamVal; 00228 00229 00230 00231 00232 00233 00234 00235 DEFINE_OPAQUE_INTEGER(PageOwnerId,uint64_t); 00236 00237 #define VALID_PAGE_OWNER_ID(pageOwnerId)
00238 (!(opaqueToInt(pageOwnerId) & 0xC000000000000000LL)) 00239 00240 00241 DEFINE_OPAQUE_INTEGER(DeviceId,uint); 00242 00243 00244 DEFINE_OPAQUE_INTEGER(SegmentId,uint); 00245 00246 00247 DEFINE_OPAQUE_INTEGER(BlockId,uint64_t); 00248 00249 00250 00251 DEFINE_OPAQUE_INTEGER(PageId,uint64_t); 00252 00253 00254 00255 DEFINE_OPAQUE_INTEGER(SegByteId,uint64_t); 00256 00257 00258 00259 DEFINE_OPAQUE_INTEGER(TxnId,uint64_t); 00260 00261 00262 DEFINE_OPAQUE_INTEGER(SavepointId,uint); 00263 00264 00265 00266 DEFINE_OPAQUE_INTEGER(LogicalTxnClassId,uint64_t); 00267 00268 00269 00270 DEFINE_OPAQUE_INTEGER(DynamicParamId,uint); 00271 00272 00273 00274 00275 00276 00277 typedef int LogicalActionType; 00278 00279 00280 typedef std::set PageSet; 00281 typedef PageSet::const_iterator PageSetConstIter; 00282 00286 static const PageId NULL_PAGE_ID = PageId(0xFFFFFFFFFFFFFFFFLL); 00287 00291 static const PageId FIRST_LINEAR_PAGE_ID = PageId(0); 00292 00296 static const BlockId NULL_BLOCK_ID = BlockId(0xFFFFFFFFFFFFFFFFLL); 00297 00302 static const PageOwnerId ANON_PAGE_OWNER_ID = PageOwnerId(0xFFFFFFFFFFFFFFFFLL); 00303 00307 static const SavepointId NULL_SVPT_ID = SavepointId(MAXU); 00308 00313 static const TxnId IMPLICIT_TXN_ID = TxnId(0); 00314 00318 static const TxnId FIRST_TXN_ID = TxnId(1); 00319 00323 static const TxnId NULL_TXN_ID = TxnId(0xFFFFFFFFFFFFFFFFLL); 00324 00325 00326 00327 00328 00329 00333 typedef uint64_t RecordNum; 00334 00338 typedef uint ExtentNum; 00339 00343 typedef uint BlockNum; 00344 00348 enum SeekPosition 00349 { 00350 SEEK_STREAM_BEGIN, 00351 SEEK_STREAM_END 00352 }; 00353 00354 FENNEL_END_NAMESPACE 00355 00356 #endif 00357 00358