VMware GemFire Native C++ Reference  9.1
geode_base.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_BASE_H_
4 #define GEODE_BASE_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #if defined(_WIN32)
24 
25 #define LIBEXP __declspec(dllexport)
26 
27 #define LIBIMP __declspec(dllimport)
28 
29 #define LIBCALL __stdcall
30 
31 #define LIBEXPORT(type) LIBEXP type LIBCALL
32 #else
33 
34 #define LIBEXP
35 
36 #define LIBIMP extern
37 
38 #define LIBCALL
39 
40 #define LIBEXPORT(type) type
41 #endif
42 
44 #ifdef BUILD_GEMFIRE
45 #define GFCEXTERN(type) LIBEXP type LIBCALL
46 #else
47 #define GFCEXTERN(type) LIBIMP type LIBCALL
48 #endif /* BUILD_GEMFIRE */
49 
51 #if defined(_WIN32)
52 #ifdef BUILD_CPPCACHE
53 #define CPPCACHE_EXPORT LIBEXP
54 #else
55 #define CPPCACHE_EXPORT LIBIMP
56 #endif
57 #else
58 #define CPPCACHE_EXPORT
59 #endif /* BUILD_CPPCACHE */
60 
62 #if defined(_WIN32)
63 #ifdef BUILD_CPPCACHE
64 #define GF_TEMPLATE_EXPORT __declspec(dllexport)
65 #else
66 #define GF_TEMPLATE_EXPORT __declspec(dllimport)
67 #endif
68 #else
69 #define GF_TEMPLATE_EXPORT
70 #endif
71 
72 #if defined(_MSC_VER)
73 /* Windows does not have inttypes.h */
74 /* 32 bit Windows only, for now */
75 #if !defined PRId8
76 #define PRId8 "d"
77 #endif
78 #if !defined PRIi8
79 #define PRIi8 "i"
80 #endif
81 #if !defined PRIo8
82 #define PRIo8 "o"
83 #endif
84 #if !defined PRIu8
85 #define PRIu8 "u"
86 #endif
87 #if !defined PRIx8
88 #define PRIx8 "x"
89 #endif
90 #if !defined PRIX8
91 #define PRIX8 "X"
92 #endif
93 #if !defined PRId16
94 #define PRId16 "d"
95 #endif
96 #if !defined PRIi16
97 #define PRIi16 "i"
98 #endif
99 #if !defined PRIo16
100 #define PRIo16 "o"
101 #endif
102 #if !defined PRIu16
103 #define PRIu16 "u"
104 #endif
105 #if !defined PRIx16
106 #define PRIx16 "x"
107 #endif
108 #if !defined PRIX16
109 #define PRIX16 "X"
110 #endif
111 #if !defined PRId32
112 #define PRId32 "d"
113 #endif
114 #if !defined PRIi32
115 #define PRIi32 "i"
116 #endif
117 #if !defined PRIo32
118 #define PRIo32 "o"
119 #endif
120 #if !defined PRIu32
121 #define PRIu32 "u"
122 #endif
123 #if !defined PRIx32
124 #define PRIx32 "x"
125 #endif
126 #if !defined PRIX32
127 #define PRIX32 "X"
128 #endif
129 #if !defined PRId64
130 #define PRId64 "lld"
131 #endif
132 #if !defined PRIi64
133 #define PRIi64 "lli"
134 #endif
135 #if !defined PRIo64
136 #define PRIo64 "llo"
137 #endif
138 #if !defined PRIu64
139 #define PRIu64 "llu"
140 #endif
141 #if !defined PRIx64
142 #define PRIx64 "llx"
143 #endif
144 #if !defined PRIX64
145 #define PRIX64 "llX"
146 #endif
147 /* end inttypes.h */
148 
149 #else
150 /* Unix, including both Sparc Solaris and Linux */
151 #define __STDC_FORMAT_MACROS
152 
153 #endif /* _WIN32*/
154 
176 #define DEFAULT_QUERY_RESPONSE_TIMEOUT 15
177 
182 typedef enum {
183  GF_NOERR = 0,
184  GF_DEADLK = 1,
185  GF_EACCES = 2,
186  GF_ECONFL = 3,
187  GF_EINVAL = 4,
188  GF_ENOENT = 5,
189  GF_ENOMEM = 6,
190  GF_ERANGE = 7,
191  GF_ETYPE = 8,
192  GF_NOTOBJ = 9,
193  GF_NOTCON = 10,
194  GF_NOTOWN = 11,
195  GF_NOTSUP = 12,
196  GF_SCPGBL = 13,
197  GF_SCPEXC = 14,
198  GF_TIMOUT = 15,
199  GF_OVRFLW = 16,
200  GF_IOERR = 17,
201  GF_EINTR = 18,
202  GF_MSG = 19,
203  GF_DISKFULL = 20,
204  GF_NOSERVER_FOUND = 21,
206 
207  GF_CLIENT_WAIT_TIMEOUT = 23,
208  GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA = 24,
209 
214  104,
218  107,
220  108,
224  111,
227  113,
230  115,
232  116,
234  117,
236  118,
240  121,
242  123,
245  // GF_CACHE_REDUNDANCY_FAILURE = 125, /**< redundancy level not satisfied */
248  GF_AUTHENTICATION_REQUIRED_EXCEPTION = 128,
250  129,
251  GF_REMOTE_QUERY_EXCEPTION = 130,
259  GF_CACHE_LOCATOR_EXCEPTION = 134,
261  GF_FUNCTION_EXCEPTION = 136,
262  GF_ROLLBACK_EXCEPTION = 137,
263  GF_COMMIT_CONFLICT_EXCEPTION = 138,
264  GF_TRANSACTION_DATA_NODE_HAS_DEPARTED_EXCEPTION = 139,
265  GF_TRANSACTION_DATA_REBALANCED_EXCEPTION = 140,
266  GF_PUTALL_PARTIAL_RESULT_EXCEPTION = 141,
267  GF_EUNDEF = 999
268 } GfErrType;
269 
270 #include <new>
271 
272 #ifdef _WIN32
273 
274 typedef void *(*pNew)(size_t);
275 typedef void (*pDelete)(void *);
276 
277 namespace apache {
278 namespace geode {
279 namespace client {
280 extern void setDefaultNewAndDelete();
281 } // namespace client
282 } // namespace geode
283 } // namespace apache
284 
285 void *operator new(size_t size);
286 void operator delete(void *p);
287 void *operator new[](size_t size);
288 void operator delete[](void *p);
289 
290 #endif // _WIN32
291 
293 #define GF_NEW(v, stmt) \
294  { \
295  try { \
296  v = new stmt; \
297  } catch (const std::bad_alloc &) { \
298  throw apache::geode::client::OutOfMemoryException( \
299  "Out of Memory while executing \"" #v " = new " #stmt ";\""); \
300  } \
301  }
302 
304 #define GF_SAFE_DELETE(x) \
305  { \
306  delete x; \
307  x = NULL; \
308  }
309 
311 #define GF_SAFE_DELETE_ARRAY(x) \
312  { \
313  delete[] x; \
314  x = NULL; \
315  }
316 
317 #endif // GEODE_BASE_H_
invalid argument
Definition: geode_base.hpp:187
IllegalArgumentException in Cache Proxy.
Definition: geode_base.hpp:217
Authentication Fails.
Definition: geode_base.hpp:246
index out of range
Definition: geode_base.hpp:190
attempt to exit global scope
Definition: geode_base.hpp:196
success - no error
Definition: geode_base.hpp:183
interrupted Geode call
Definition: geode_base.hpp:201
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
paging file I/O error
Definition: geode_base.hpp:200
RegionDestroyedException in CacheProxy.
Definition: geode_base.hpp:229
class creation conflict
Definition: geode_base.hpp:186
message could not be handled
Definition: geode_base.hpp:202
invalid object reference
Definition: geode_base.hpp:192
Errors detected in CacheProxy processing.
Definition: geode_base.hpp:216
Exception in CacheListener.
Definition: geode_base.hpp:253
EntryNotFoundException in CacheProxy.
Definition: geode_base.hpp:237
StatisticsDisabledException in CacheProxy.
Definition: geode_base.hpp:233
EntryDestroyedException in CacheProxy.
Definition: geode_base.hpp:231
GfErrType
Error codes returned by Geode C++ interface functions.
Definition: geode_base.hpp:182
deadlock detected
Definition: geode_base.hpp:184
CacheClosedException in CacheProxy.
Definition: geode_base.hpp:225
operation timed out
Definition: geode_base.hpp:198
permission problem
Definition: geode_base.hpp:185
insufficient memory
Definition: geode_base.hpp:189
type mismatch
Definition: geode_base.hpp:191
No region with the specified name.
Definition: geode_base.hpp:210
Java cache server exception sent to the thin client by java cache server.
Definition: geode_base.hpp:243
CacheLoaderException in CacheProxy.
Definition: geode_base.hpp:228
Exception in Locator.
Definition: geode_base.hpp:260
Non Authorized Operation Tried.
Definition: geode_base.hpp:247
NoServer found.
Definition: geode_base.hpp:205
unknown exception
Definition: geode_base.hpp:267
An Exception occured while invoking a cachewritter callback.
Definition: geode_base.hpp:239
Query exception on java cache server.
Definition: geode_base.hpp:252
disk full
Definition: geode_base.hpp:203
No Authentication Provided.
Definition: geode_base.hpp:249
IllegalStateException in CacheProxy.
Definition: geode_base.hpp:219
EntryExistsException in CacheProxy.
Definition: geode_base.hpp:238
Entry&#39;s value is not a byte array.
Definition: geode_base.hpp:213
lock not owned by process/thread
Definition: geode_base.hpp:194
ConcurrentModificationException in CacheProxy.
Definition: geode_base.hpp:235
CacheWriterException in CacheProxy.
Definition: geode_base.hpp:222
LeaseExpiredException in CacheProxy.
Definition: geode_base.hpp:226
A failure other than timeout occured durring a batch request.
Definition: geode_base.hpp:241
ALl connections in use.
Definition: geode_base.hpp:258
arithmetic overflow
Definition: geode_base.hpp:199
TimeoutException in CacheProxy.
Definition: geode_base.hpp:221
Distributed locks not supported.
Definition: geode_base.hpp:215
not connected to Geode
Definition: geode_base.hpp:193
maximum scopes exceeded
Definition: geode_base.hpp:197
the region is not valid
Definition: geode_base.hpp:211
Entry keys are not strings.
Definition: geode_base.hpp:212
entity does not exist
Definition: geode_base.hpp:188
RegionExistsException in CacheProxy.
Definition: geode_base.hpp:223
operation not supported
Definition: geode_base.hpp:195
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation