00001 #ifndef _GEMFIRE_GF_BASE_HPP_
00002 #define _GEMFIRE_GF_BASE_HPP_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #if defined(_WIN32)
00014
00015 #define LIBEXP __declspec(dllexport)
00016
00017 #define LIBIMP __declspec(dllimport)
00018
00019 #define LIBCALL __stdcall
00020
00021 #define LIBEXPORT(type) LIBEXP type LIBCALL
00022 #else
00023
00024 #define LIBEXP
00025
00026 #define LIBIMP extern
00027
00028 #define LIBCALL
00029
00030 #define LIBEXPORT(type) type
00031 #endif
00032
00034 #ifdef BUILD_GEMFIRE
00035 #define GFCEXTERN(type) LIBEXP type LIBCALL
00036 #else
00037 #define GFCEXTERN(type) LIBIMP type LIBCALL
00038 #endif
00039
00041 #if defined(_WIN32)
00042 #ifdef BUILD_CPPCACHE
00043 #define CPPCACHE_EXPORT LIBEXP
00044 #else
00045 #define CPPCACHE_EXPORT LIBIMP
00046 #endif
00047 #else
00048 #define CPPCACHE_EXPORT
00049 #endif
00050
00052 #if defined(_WIN32)
00053 #ifdef BUILD_CPPCACHE
00054 #define GF_TEMPLATE_EXPORT __declspec(dllexport)
00055 #else
00056 #define GF_TEMPLATE_EXPORT __declspec(dllimport)
00057 #endif
00058 #else
00059 #define GF_TEMPLATE_EXPORT
00060 #endif
00061
00062 #if defined(_MSC_VER)
00063
00064 typedef signed char int8;
00065 typedef unsigned char uint8;
00066 typedef signed short int16;
00067 typedef unsigned short uint16;
00068 typedef signed int int32;
00069 typedef unsigned int uint32;
00070 typedef signed __int64 int64;
00071 typedef unsigned __int64 uint64;
00073 typedef int32 intptr_t;
00074 typedef uint32 uintptr_t;
00076
00077 typedef int8 int8_t;
00078 typedef uint8 uint8_t;
00079 typedef int16 int16_t;
00080 typedef uint16 uint16_t;
00081 typedef int32 int32_t;
00082 typedef uint32 uint32_t;
00083 typedef int64 int64_t;
00084 typedef uint64 uint64_t;
00085
00086
00087
00088
00089 #if !defined PRId8
00090 # define PRId8 "d"
00091 #endif
00092 #if !defined PRIi8
00093 # define PRIi8 "i"
00094 #endif
00095 #if !defined PRIo8
00096 # define PRIo8 "o"
00097 #endif
00098 #if !defined PRIu8
00099 # define PRIu8 "u"
00100 #endif
00101 #if !defined PRIx8
00102 # define PRIx8 "x"
00103 #endif
00104 #if !defined PRIX8
00105 # define PRIX8 "X"
00106 #endif
00107 #if !defined PRId16
00108 # define PRId16 "d"
00109 #endif
00110 #if !defined PRIi16
00111 # define PRIi16 "i"
00112 #endif
00113 #if !defined PRIo16
00114 # define PRIo16 "o"
00115 #endif
00116 #if !defined PRIu16
00117 # define PRIu16 "u"
00118 #endif
00119 #if !defined PRIx16
00120 # define PRIx16 "x"
00121 #endif
00122 #if !defined PRIX16
00123 # define PRIX16 "X"
00124 #endif
00125 #if !defined PRId32
00126 # define PRId32 "d"
00127 #endif
00128 #if !defined PRIi32
00129 # define PRIi32 "i"
00130 #endif
00131 #if !defined PRIo32
00132 # define PRIo32 "o"
00133 #endif
00134 #if !defined PRIu32
00135 # define PRIu32 "u"
00136 #endif
00137 #if !defined PRIx32
00138 # define PRIx32 "x"
00139 #endif
00140 #if !defined PRIX32
00141 # define PRIX32 "X"
00142 #endif
00143 #if !defined PRId64
00144 # define PRId64 "lld"
00145 #endif
00146 #if !defined PRIi64
00147 # define PRIi64 "lli"
00148 #endif
00149 #if !defined PRIo64
00150 # define PRIo64 "llo"
00151 #endif
00152 #if !defined PRIu64
00153 # define PRIu64 "llu"
00154 #endif
00155 #if !defined PRIx64
00156 # define PRIx64 "llx"
00157 #endif
00158 #if !defined PRIX64
00159 # define PRIX64 "llX"
00160 #endif
00161
00162
00163 #ifndef _INC_WCHAR
00164 #include <wchar.h>
00165 #endif
00166
00167 #else
00168
00169 #define __STDC_FORMAT_MACROS
00170 #include <inttypes.h>
00171 typedef char int8;
00172 typedef unsigned char uint8;
00173 typedef short int16;
00174 typedef unsigned short uint16;
00175 typedef int32_t int32;
00176 typedef uint32_t uint32;
00177 typedef int64_t int64;
00178 typedef uint64_t uint64;
00180 #ifndef _WCHAR_H
00181 #include <wchar.h>
00182 #endif
00183 #endif
00184
00185
00186 namespace gemfire {
00187 typedef bool Bool;
00188 typedef uint8 UInt8;
00189 typedef int8 Int8;
00190 typedef uint16 UInt16;
00191 typedef int16 Int16;
00192 typedef uint32 UInt32;
00193 typedef int32 Int32;
00194 typedef uint64 UInt64;
00195 typedef int64 Int64;
00196 typedef int64 Duration;
00197 }
00198
00223 typedef uint32 Oid;
00228 enum {
00229 GF_S_NOTCON = 0,
00230 GF_S_CONN = 1,
00231 GF_S_DISCON = 2,
00232 GF_S_SHUTDN = 3
00233 };
00234
00236 #define GF_FALSE 0
00237
00238 #define GF_TRUE 1
00239
00241 #define GF_UNPROTECT 0
00242
00243 #define GF_PROTECT 1
00244
00249 typedef enum {
00250 GF_NOERR = 0,
00251 GF_DEADLK = 1,
00252 GF_EACCES = 2,
00253 GF_ECONFL = 3,
00254 GF_EINVAL = 4,
00255 GF_ENOENT = 5,
00256 GF_ENOMEM = 6,
00257 GF_ERANGE = 7,
00258 GF_ETYPE = 8,
00259 GF_NOTOBJ = 9,
00260 GF_NOTCON = 10,
00261 GF_NOTOWN = 11,
00262 GF_NOTSUP = 12,
00263 GF_SCPGBL = 13,
00264 GF_SCPEXC = 14,
00265 GF_TIMOUT = 15,
00266 GF_OVRFLW = 16,
00267 GF_IOERR = 17,
00268 GF_EINTR = 18,
00269 GF_MSG = 19,
00271 GF_CACHE_REGION_NOT_FOUND = 101,
00272 GF_CACHE_REGION_INVALID = 102,
00273 GF_CACHE_REGION_KEYS_NOT_STRINGS = 103,
00274 GF_CACHE_REGION_ENTRY_NOT_BYTES = 104,
00275 GF_CACHE_REGION_NOT_GLOBAL = 105,
00276 GF_CACHE_PROXY = 106,
00277 GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION = 107,
00278 GF_CACHE_ILLEGAL_STATE_EXCEPTION = 108,
00279 GF_CACHE_TIMEOUT_EXCEPTION = 109,
00280 GF_CACHE_WRITER_EXCEPTION = 110,
00281 GF_CACHE_REGION_EXISTS_EXCEPTION = 111,
00282 GF_CACHE_CLOSED_EXCEPTION = 112,
00283 GF_CACHE_LEASE_EXPIRED_EXCEPTION = 113,
00284 GF_CACHE_LOADER_EXCEPTION = 114,
00285 GF_CACHE_REGION_DESTROYED_EXCEPTION = 115,
00286 GF_CACHE_ENTRY_DESTROYED_EXCEPTION = 116,
00287 GF_CACHE_STATISTICS_DISABLED_EXCEPTION = 117,
00288 GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION = 118,
00289 GF_CACHE_ENTRY_NOT_FOUND = 119,
00290 GF_CACHE_ENTRY_EXISTS = 120,
00291 GF_CACHEWRITER_ERROR=121,
00292 GF_ENTRYEXISTS_EXCEPTION=122,
00293 GF_CANNOT_PROCESS_GII_REQUEST=123,
00294 GF_CACHESERVER_EXCEPTION=124,
00295 GF_CACHE_REDUNDANCY_FAILURE = 125,
00296 GF_AUTHENTICATION_FAILED_EXCEPTION = 126,
00297 GF_NOT_AUTHORIZED_EXCEPTION = 127,
00298 GF_AUTHENTICATION_REQUIRED_EXCEPTION = 128,
00299 GF_DUPLICATE_DURABLE_CLIENT = 129,
00300 GF_REMOTE_QUERY_EXCEPTION = 130,
00301 GF_CACHE_LISTENER_EXCEPTION = 131,
00302 GF_EUNDEF = 999
00303 } GfErrType;
00304
00305
00306 #include <new>
00307
00309 #define GF_SAFE_DELETE(x) \
00310 { \
00311 delete x; \
00312 x = NULL; \
00313 }
00314
00316 #define GF_SAFE_DELETE_ARRAY(x) \
00317 { \
00318 delete [ ] x; \
00319 x = NULL; \
00320 }
00321
00323 #define GF_NEW(v, stmt) \
00324 { \
00325 try { \
00326 v = new stmt; \
00327 } \
00328 catch (const std::bad_alloc&) { \
00329 throw gemfire::OutOfMemoryException( \
00330 "Out of Memory while allocating "#v ); \
00331 } \
00332 }
00333
00334 #endif