VMware GemFire Native Client Cache Reference  9.0.6
gf_base.hpp
Go to the documentation of this file.
1 #ifndef _GEMFIRE_GF_BASE_HPP_
2 #define _GEMFIRE_GF_BASE_HPP_
3 /*=========================================================================
4  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
5  * This product is protected by U.S. and international copyright
6  * and intellectual property laws. Pivotal products are covered by
7  * more patents listed at http://www.pivotal.io/patents.
8  *
9  * The specification of function behaviors is found in the gfc*.cpp files.
10  *
11  *========================================================================
12  */
13 
14 //#include "config.h"
15 
16 #if defined(_WIN32)
17 
18 #define LIBEXP __declspec(dllexport)
19 
20 #define LIBIMP __declspec(dllimport)
21 
22 #define LIBCALL __stdcall
23 
24 #define LIBEXPORT(type) LIBEXP type LIBCALL
25 #else
26 
27 #define LIBEXP
28 
29 #define LIBIMP extern
30 
31 #define LIBCALL
32 
33 #define LIBEXPORT(type) type
34 #endif
35 
37 #ifdef BUILD_GEMFIRE
38 #define GFCEXTERN(type) LIBEXP type LIBCALL
39 #else
40 #define GFCEXTERN(type) LIBIMP type LIBCALL
41 #endif /* BUILD_GEMFIRE */
42 
44 #if defined(_WIN32)
45  #ifdef BUILD_CPPCACHE
46  #define CPPCACHE_EXPORT LIBEXP
47  #else
48  #define CPPCACHE_EXPORT LIBIMP
49  #endif
50 #else
51  #define CPPCACHE_EXPORT
52 #endif /* BUILD_CPPCACHE */
53 
55 #if defined(_WIN32)
56  #ifdef BUILD_CPPCACHE
57  #define GF_TEMPLATE_EXPORT __declspec(dllexport)
58  #else
59  #define GF_TEMPLATE_EXPORT __declspec(dllimport)
60  #endif
61 #else
62  #define GF_TEMPLATE_EXPORT
63 #endif
64 
65 #if defined(_MSC_VER)
66 /* 32 bit Windows only, for now */
67 typedef signed char int8;
68 typedef unsigned char uint8;
69 typedef signed short int16;
70 typedef unsigned short uint16;
71 typedef signed int int32;
72 typedef unsigned int uint32;
73 typedef signed __int64 int64;
74 typedef unsigned __int64 uint64;
76 //typedef int32 intptr_t; /**< a pointer to a 32 bit integer */
77 //typedef uint32 uintptr_t; /**< a pointer to an unsigned 32 bit integer */
78 
79 /* Windows does not have stdint.h */
80 typedef int8 int8_t;
81 typedef uint8 uint8_t;
82 typedef int16 int16_t;
83 typedef uint16 uint16_t;
84 typedef int32 int32_t;
85 typedef uint32 uint32_t;
86 typedef int64 int64_t;
87 typedef uint64 uint64_t;
88 /* end stdint.h */
89 
90 /* Windows does not have inttypes.h */
91 /* 32 bit Windows only, for now */
92 #if !defined PRId8
93 # define PRId8 "d"
94 #endif
95 #if !defined PRIi8
96 # define PRIi8 "i"
97 #endif
98 #if !defined PRIo8
99 # define PRIo8 "o"
100 #endif
101 #if !defined PRIu8
102 # define PRIu8 "u"
103 #endif
104 #if !defined PRIx8
105 # define PRIx8 "x"
106 #endif
107 #if !defined PRIX8
108 # define PRIX8 "X"
109 #endif
110 #if !defined PRId16
111 # define PRId16 "d"
112 #endif
113 #if !defined PRIi16
114 # define PRIi16 "i"
115 #endif
116 #if !defined PRIo16
117 # define PRIo16 "o"
118 #endif
119 #if !defined PRIu16
120 # define PRIu16 "u"
121 #endif
122 #if !defined PRIx16
123 # define PRIx16 "x"
124 #endif
125 #if !defined PRIX16
126 # define PRIX16 "X"
127 #endif
128 #if !defined PRId32
129 # define PRId32 "d"
130 #endif
131 #if !defined PRIi32
132 # define PRIi32 "i"
133 #endif
134 #if !defined PRIo32
135 # define PRIo32 "o"
136 #endif
137 #if !defined PRIu32
138 # define PRIu32 "u"
139 #endif
140 #if !defined PRIx32
141 # define PRIx32 "x"
142 #endif
143 #if !defined PRIX32
144 # define PRIX32 "X"
145 #endif
146 #if !defined PRId64
147 # define PRId64 "lld"
148 #endif
149 #if !defined PRIi64
150 # define PRIi64 "lli"
151 #endif
152 #if !defined PRIo64
153 # define PRIo64 "llo"
154 #endif
155 #if !defined PRIu64
156 # define PRIu64 "llu"
157 #endif
158 #if !defined PRIx64
159 # define PRIx64 "llx"
160 #endif
161 #if !defined PRIX64
162 # define PRIX64 "llX"
163 #endif
164 /* end inttypes.h */
165 
166 #ifndef _INC_WCHAR
167 #include <wchar.h>
168 #endif
169 
170 #else
171 /* Unix, including both Sparc Solaris and Linux */
172 #define __STDC_FORMAT_MACROS
173 #include <inttypes.h>
174 typedef int8_t int8;
175 typedef uint8_t uint8;
176 typedef int16_t int16;
177 typedef uint16_t uint16;
178 typedef int32_t int32;
179 typedef uint32_t uint32;
180 typedef int64_t int64;
181 typedef uint64_t uint64;
183 #ifndef _WCHAR_H
184 #include <wchar.h>
185 #endif
186 #endif /* _WIN32*/
187 
188 
214 #define DEFAULT_QUERY_RESPONSE_TIMEOUT 15
215 
220 typedef enum {
221  GF_NOERR = 0,
222  GF_DEADLK = 1,
223  GF_EACCES = 2,
224  GF_ECONFL = 3,
225  GF_EINVAL = 4,
226  GF_ENOENT = 5,
227  GF_ENOMEM = 6,
228  GF_ERANGE = 7,
229  GF_ETYPE = 8,
230  GF_NOTOBJ = 9,
231  GF_NOTCON = 10,
232  GF_NOTOWN = 11,
233  GF_NOTSUP = 12,
234  GF_SCPGBL = 13,
235  GF_SCPEXC = 14,
236  GF_TIMOUT = 15,
237  GF_OVRFLW = 16,
238  GF_IOERR = 17,
239  GF_EINTR = 18,
240  GF_MSG = 19,
242  GF_NOSERVER_FOUND = 21,
244 
245  GF_CLIENT_WAIT_TIMEOUT = 23,
246  GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA = 24,
247 
271  //GF_CACHE_REDUNDANCY_FAILURE = 125, /**< redundancy level not satisfied */
274  GF_AUTHENTICATION_REQUIRED_EXCEPTION = 128,
276  GF_REMOTE_QUERY_EXCEPTION = 130,
284  GF_CACHE_LOCATOR_EXCEPTION = 134,
286  GF_FUNCTION_EXCEPTION = 136,
287  GF_ROLLBACK_EXCEPTION = 137,
288  GF_COMMIT_CONFLICT_EXCEPTION = 138,
289  GF_TRANSACTION_DATA_NODE_HAS_DEPARTED_EXCEPTION = 139,
290  GF_TRANSACTION_DATA_REBALANCED_EXCEPTION = 140,
291  GF_PUTALL_PARTIAL_RESULT_EXCEPTION = 141,
292  GF_EUNDEF = 999
293 } GfErrType;
294 
295 
296 #include <new>
297 
298 #ifdef _WIN32
299 
300 typedef void * (* pNew) (size_t);
301 typedef void (* pDelete) (void *);
302 
303 namespace gemfire {
304  extern void setDefaultNewAndDelete();
305 }
306 
307 void * operator new (size_t size);
308 void operator delete (void * p);
309 void * operator new [] (size_t size);
310 void operator delete [] (void * p);
311 
312 #endif // _WIN32
313 
315 #define GF_NEW(v, stmt) \
316 { \
317  try { \
318  v = new stmt; \
319  } \
320  catch (const std::bad_alloc&) { \
321  throw gemfire::OutOfMemoryException( \
322  "Out of Memory while executing \""#v" = new "#stmt";\""); \
323  } \
324 }
325 
327 #define GF_SAFE_DELETE(x) \
328 { \
329  delete x; \
330  x = NULL; \
331 }
332 
334 #define GF_SAFE_DELETE_ARRAY(x) \
335 { \
336  delete [ ] x; \
337  x = NULL; \
338 }
339 
340 #endif
uint32_t uint32
unsigned 32 bit integer
Definition: gf_base.hpp:179
entity does not exist
Definition: gf_base.hpp:226
ConcurrentModificationException in CacheProxy.
Definition: gf_base.hpp:265
Distributed locks not supported.
Definition: gf_base.hpp:252
int64_t int64
signed 64 bit integer
Definition: gf_base.hpp:180
Errors detected in CacheProxy processing.
Definition: gf_base.hpp:253
uint16_t uint16
unsigned 16 bit integer (ushort)
Definition: gf_base.hpp:177
type mismatch
Definition: gf_base.hpp:229
CacheWriterException in CacheProxy.
Definition: gf_base.hpp:257
LeaseExpiredException in CacheProxy.
Definition: gf_base.hpp:260
int16_t int16
signed 16 bit integer (short)
Definition: gf_base.hpp:176
StatisticsDisabledException in CacheProxy.
Definition: gf_base.hpp:264
Entry keys are not strings.
Definition: gf_base.hpp:250
IllegalArgumentException in Cache Proxy.
Definition: gf_base.hpp:254
unknown exception
Definition: gf_base.hpp:292
An Exception occured while invoking a cachewritter callback.
Definition: gf_base.hpp:268
No Authentication Provided.
Definition: gf_base.hpp:275
operation timed out
Definition: gf_base.hpp:236
Exception in CacheListener.
Definition: gf_base.hpp:278
Query exception on java cache server.
Definition: gf_base.hpp:277
Authentication Fails.
Definition: gf_base.hpp:272
maximum scopes exceeded
Definition: gf_base.hpp:235
invalid object reference
Definition: gf_base.hpp:230
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
Exception in Locator.
Definition: gf_base.hpp:285
operation not supported
Definition: gf_base.hpp:233
RegionExistsException in CacheProxy.
Definition: gf_base.hpp:258
message could not be handled
Definition: gf_base.hpp:240
int8_t int8
single byte, character or boolean field
Definition: gf_base.hpp:174
index out of range
Definition: gf_base.hpp:228
GfErrType
Error codes returned by GemFire C++ interface functions.
Definition: gf_base.hpp:220
class creation conflict
Definition: gf_base.hpp:224
int32_t int32
signed 32 bit integer
Definition: gf_base.hpp:178
NoServer found.
Definition: gf_base.hpp:243
deadlock detected
Definition: gf_base.hpp:222
EntryDestroyedException in CacheProxy.
Definition: gf_base.hpp:263
success - no error
Definition: gf_base.hpp:221
EntryNotFoundException in CacheProxy.
Definition: gf_base.hpp:266
invalid argument
Definition: gf_base.hpp:225
A failure other than timeout occured durring a batch request.
Definition: gf_base.hpp:269
insufficient memory
Definition: gf_base.hpp:227
RegionDestroyedException in CacheProxy.
Definition: gf_base.hpp:262
Non Authorized Operation Tried.
Definition: gf_base.hpp:273
disk full
Definition: gf_base.hpp:241
uint64_t uint64
unsigned 64 bit integer
Definition: gf_base.hpp:181
uint8_t uint8
unsigned integer value
Definition: gf_base.hpp:175
ALl connections in use.
Definition: gf_base.hpp:283
permission problem
Definition: gf_base.hpp:223
the region is not valid
Definition: gf_base.hpp:249
Java cache server exception sent to the thin client by java cache server.
Definition: gf_base.hpp:270
No region with the specified name.
Definition: gf_base.hpp:248
interrupted GemFire call
Definition: gf_base.hpp:239
Entry&#39;s value is not a byte array.
Definition: gf_base.hpp:251
arithmetic overflow
Definition: gf_base.hpp:237
lock not owned by process/thread
Definition: gf_base.hpp:232
CacheLoaderException in CacheProxy.
Definition: gf_base.hpp:261
not connected to GemFire
Definition: gf_base.hpp:231
IllegalStateException in CacheProxy.
Definition: gf_base.hpp:255
CacheClosedException in CacheProxy.
Definition: gf_base.hpp:259
EntryExistsException in CacheProxy.
Definition: gf_base.hpp:267
paging file I/O error
Definition: gf_base.hpp:238
attempt to exit global scope
Definition: gf_base.hpp:234
TimeoutException in CacheProxy.
Definition: gf_base.hpp:256

GemFire C++ Cache API Documentation