Apache Geode Native C++ Reference  1.14.0
CacheableBuiltins.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #ifndef GEODE_CACHEABLEBUILTINS_H_
21 #define GEODE_CACHEABLEBUILTINS_H_
22 
28 #include <cstring>
29 
30 #include "CacheableKey.hpp"
31 #include "CacheableString.hpp"
32 #include "Serializable.hpp"
33 #include "Serializer.hpp"
34 #include "internal/CacheableBuiltinTemplates.hpp"
35 #include "internal/CacheableKeys.hpp"
36 
37 namespace apache {
38 namespace geode {
39 namespace client {
40 
45 using CacheableBoolean =
46  internal::CacheableKeyPrimitive<bool, internal::DSCode::CacheableBoolean>;
47 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
48  internal::CacheableKeyPrimitive<bool, internal::DSCode::CacheableBoolean>;
49 template <>
50 inline std::shared_ptr<CacheableKey> CacheableKey::create(bool value) {
51  return CacheableBoolean::create(value);
52 }
53 template <>
54 inline std::shared_ptr<Cacheable> Serializable::create(bool value) {
55  return CacheableBoolean::create(value);
56 }
57 
62 using CacheableByte =
63  internal::CacheableKeyPrimitive<int8_t, internal::DSCode::CacheableByte>;
64 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
65  internal::CacheableKeyPrimitive<int8_t, internal::DSCode::CacheableByte>;
66 template <>
67 inline std::shared_ptr<CacheableKey> CacheableKey::create(int8_t value) {
68  return CacheableByte::create(value);
69 }
70 template <>
71 inline std::shared_ptr<Cacheable> Serializable::create(int8_t value) {
72  return CacheableByte::create(value);
73 }
74 
79 using CacheableDouble =
80  internal::CacheableKeyPrimitive<double, internal::DSCode::CacheableDouble>;
81 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
82  internal::CacheableKeyPrimitive<double, internal::DSCode::CacheableDouble>;
83 template <>
84 inline std::shared_ptr<CacheableKey> CacheableKey::create(double value) {
85  return CacheableDouble::create(value);
86 }
87 template <>
88 inline std::shared_ptr<Cacheable> Serializable::create(double value) {
89  return CacheableDouble::create(value);
90 }
91 
97 using CacheableFloat =
98  internal::CacheableKeyPrimitive<float, internal::DSCode::CacheableFloat>;
99 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
100  internal::CacheableKeyPrimitive<float, internal::DSCode::CacheableFloat>;
101 template <>
102 inline std::shared_ptr<CacheableKey> CacheableKey::create(float value) {
103  return CacheableFloat::create(value);
104 }
105 template <>
106 inline std::shared_ptr<Cacheable> Serializable::create(float value) {
107  return CacheableFloat::create(value);
108 }
109 
114 using CacheableInt16 =
115  internal::CacheableKeyPrimitive<int16_t, internal::DSCode::CacheableInt16>;
116 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
117  internal::CacheableKeyPrimitive<int16_t, internal::DSCode::CacheableInt16>;
118 template <>
119 inline std::shared_ptr<CacheableKey> CacheableKey::create(int16_t value) {
120  return CacheableInt16::create(value);
121 }
122 template <>
123 inline std::shared_ptr<Cacheable> Serializable::create(int16_t value) {
124  return CacheableInt16::create(value);
125 }
126 
131 using CacheableInt32 =
132  internal::CacheableKeyPrimitive<int32_t, internal::DSCode::CacheableInt32>;
133 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
134  internal::CacheableKeyPrimitive<int32_t, internal::DSCode::CacheableInt32>;
135 template <>
136 inline std::shared_ptr<CacheableKey> CacheableKey::create(int32_t value) {
137  return CacheableInt32::create(value);
138 }
139 template <>
140 inline std::shared_ptr<Cacheable> Serializable::create(int32_t value) {
141  return CacheableInt32::create(value);
142 }
143 
148 using CacheableInt64 =
149  internal::CacheableKeyPrimitive<int64_t, internal::DSCode::CacheableInt64>;
150 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
151  internal::CacheableKeyPrimitive<int64_t, internal::DSCode::CacheableInt64>;
152 template <>
153 inline std::shared_ptr<CacheableKey> CacheableKey::create(int64_t value) {
154  return CacheableInt64::create(value);
155 }
156 template <>
157 inline std::shared_ptr<Cacheable> Serializable::create(int64_t value) {
158  return CacheableInt64::create(value);
159 }
160 
165 using CacheableCharacter =
166  internal::CacheableKeyPrimitive<char16_t,
167  internal::DSCode::CacheableCharacter>;
168 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
169  internal::CacheableKeyPrimitive<char16_t,
170  internal::DSCode::CacheableCharacter>;
171 template <>
172 inline std::shared_ptr<CacheableKey> CacheableKey::create(char16_t value) {
173  return CacheableCharacter::create(value);
174 }
175 template <>
176 inline std::shared_ptr<Cacheable> Serializable::create(char16_t value) {
177  return CacheableCharacter::create(value);
178 }
179 
184 using CacheableBytes =
185  internal::CacheableArrayPrimitive<int8_t, internal::DSCode::CacheableBytes>;
186 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
187  internal::CacheableArrayPrimitive<int8_t, internal::DSCode::CacheableBytes>;
188 
193 using BooleanArray =
194  internal::CacheableArrayPrimitive<bool, internal::DSCode::BooleanArray>;
195 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
196  internal::CacheableArrayPrimitive<bool, internal::DSCode::BooleanArray>;
197 
202 using CharArray =
203  internal::CacheableArrayPrimitive<char16_t, internal::DSCode::CharArray>;
204 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
205  internal::CacheableArrayPrimitive<char16_t, internal::DSCode::CharArray>;
206 
211 using CacheableDoubleArray =
212  internal::CacheableArrayPrimitive<double,
213  internal::DSCode::CacheableDoubleArray>;
214 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
215  internal::CacheableArrayPrimitive<double,
216  internal::DSCode::CacheableDoubleArray>;
217 
222 using CacheableFloatArray =
223  internal::CacheableArrayPrimitive<float,
224  internal::DSCode::CacheableFloatArray>;
225 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
226  internal::CacheableArrayPrimitive<float,
227  internal::DSCode::CacheableFloatArray>;
228 
233 using CacheableInt16Array =
234  internal::CacheableArrayPrimitive<int16_t,
235  internal::DSCode::CacheableInt16Array>;
236 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
237  internal::CacheableArrayPrimitive<int16_t,
238  internal::DSCode::CacheableInt16Array>;
239 
244 using CacheableInt32Array =
245  internal::CacheableArrayPrimitive<int32_t,
246  internal::DSCode::CacheableInt32Array>;
247 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
248  internal::CacheableArrayPrimitive<int32_t,
249  internal::DSCode::CacheableInt32Array>;
250 
255 using CacheableInt64Array =
256  internal::CacheableArrayPrimitive<int64_t,
257  internal::DSCode::CacheableInt64Array>;
258 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
259  internal::CacheableArrayPrimitive<int64_t,
260  internal::DSCode::CacheableInt64Array>;
261 
266 using CacheableStringArray =
267  internal::CacheableArrayPrimitive<std::shared_ptr<CacheableString>,
268  internal::DSCode::CacheableStringArray>;
269 extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
270  internal::CacheableArrayPrimitive<std::shared_ptr<CacheableString>,
271  internal::DSCode::CacheableStringArray>;
272 
273 // The following are defined as classes to avoid the issues with MSVC++
274 // warning/erroring on C4503
275 
280 class APACHE_GEODE_EXPORT CacheableVector
281  : public internal::CacheableContainerPrimitive<
282  std::vector<std::shared_ptr<Cacheable>>,
283  internal::DSCode::CacheableVector, CacheableVector> {
284  public:
285  using CacheableContainerPrimitive::CacheableContainerPrimitive;
286 };
287 
288 template class internal::CacheableContainerPrimitive<
289  std::vector<std::shared_ptr<Cacheable>>, internal::DSCode::CacheableVector,
291 
296 class APACHE_GEODE_EXPORT CacheableHashMap
297  : public internal::CacheableContainerPrimitive<
298  HashMapOfCacheable, internal::DSCode::CacheableHashMap,
299  CacheableHashMap> {
300  public:
301  using CacheableContainerPrimitive::CacheableContainerPrimitive;
302 };
303 
304 template class internal::CacheableContainerPrimitive<
305  HashMapOfCacheable, internal::DSCode::CacheableHashMap, CacheableHashMap>;
306 
311 class APACHE_GEODE_EXPORT CacheableHashSet
312  : public internal::CacheableContainerPrimitive<
313  HashSetOfCacheableKey, internal::DSCode::CacheableHashSet,
314  CacheableHashSet> {
315  public:
316  using CacheableContainerPrimitive::CacheableContainerPrimitive;
317 };
318 
319 template class internal::CacheableContainerPrimitive<
320  HashSetOfCacheableKey, internal::DSCode::CacheableHashSet,
322 
327 class APACHE_GEODE_EXPORT CacheableArrayList
328  : public internal::CacheableContainerPrimitive<
329  std::vector<std::shared_ptr<Cacheable>>,
330  internal::DSCode::CacheableArrayList, CacheableArrayList> {
331  public:
332  using CacheableContainerPrimitive::CacheableContainerPrimitive;
333 };
334 
335 template class internal::CacheableContainerPrimitive<
336  std::vector<std::shared_ptr<Cacheable>>,
337  internal::DSCode::CacheableArrayList, CacheableArrayList>;
338 
343 class APACHE_GEODE_EXPORT CacheableLinkedList
344  : public internal::CacheableContainerPrimitive<
345  std::vector<std::shared_ptr<Cacheable>>,
346  internal::DSCode::CacheableLinkedList, CacheableLinkedList> {
347  public:
348  using CacheableContainerPrimitive::CacheableContainerPrimitive;
349 };
350 
351 template class internal::CacheableContainerPrimitive<
352  std::vector<std::shared_ptr<Cacheable>>,
353  internal::DSCode::CacheableLinkedList, CacheableLinkedList>;
354 
359 class APACHE_GEODE_EXPORT CacheableStack
360  : public internal::CacheableContainerPrimitive<
361  std::vector<std::shared_ptr<Cacheable>>,
362  internal::DSCode::CacheableStack, CacheableStack> {
363  public:
364  using CacheableContainerPrimitive::CacheableContainerPrimitive;
365 };
366 
367 template class internal::CacheableContainerPrimitive<
368  HashMapOfCacheable, internal::DSCode::CacheableStack, CacheableStack>;
369 
374 class APACHE_GEODE_EXPORT CacheableHashTable
375  : public internal::CacheableContainerPrimitive<
376  HashMapOfCacheable, internal::DSCode::CacheableHashTable,
377  CacheableHashTable> {
378  public:
379  using CacheableContainerPrimitive::CacheableContainerPrimitive;
380 };
381 
382 template class internal::CacheableContainerPrimitive<
383  HashMapOfCacheable, internal::DSCode::CacheableHashTable,
385 
393 class APACHE_GEODE_EXPORT CacheableIdentityHashMap
394  : public internal::CacheableContainerPrimitive<
395  HashMapOfCacheable, internal::DSCode::CacheableIdentityHashMap,
396  CacheableIdentityHashMap> {
397  public:
398  using CacheableContainerPrimitive::CacheableContainerPrimitive;
399 };
400 
401 template class internal::CacheableContainerPrimitive<
402  HashMapOfCacheable, internal::DSCode::CacheableIdentityHashMap,
404 
412 class APACHE_GEODE_EXPORT CacheableLinkedHashSet
413  : public internal::CacheableContainerPrimitive<
414  HashSetOfCacheableKey, internal::DSCode::CacheableLinkedHashSet,
415  CacheableLinkedHashSet> {
416  public:
417  using CacheableContainerPrimitive::CacheableContainerPrimitive;
418 };
419 
420 template class internal::CacheableContainerPrimitive<
421  HashSetOfCacheableKey, internal::DSCode::CacheableLinkedHashSet,
423 
424 } // namespace client
425 } // namespace geode
426 } // namespace apache
427 
428 #endif // GEODE_CACHEABLEBUILTINS_H_
internal::CacheableKeyPrimitive< bool, internal::DSCode::CacheableBoolean > CacheableBoolean
An immutable wrapper for bool that can serve as a distributable key object for caching.
Definition: CacheableBuiltins.hpp:46
A mutable Cacheable vector wrapper that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:280
A mutable CacheableKey to Serializable hash map that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:374
A mutable Cacheable array list wrapper that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:327
internal::CacheableArrayPrimitive< float, internal::DSCode::CacheableFloatArray > CacheableFloatArray
An immutable wrapper for array of floats that can serve as a distributable object for caching.
A mutable CacheableKey hash set wrapper that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:412
A mutable CacheableKey hash set wrapper that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:311
internal::CacheableArrayPrimitive< int16_t, internal::DSCode::CacheableInt16Array > CacheableInt16Array
An immutable wrapper for array of 16-bit integers that can serve as a distributable object for cachin...
internal::CacheableArrayPrimitive< int32_t, internal::DSCode::CacheableInt32Array > CacheableInt32Array
An immutable wrapper for array of 32-bit integers that can serve as a distributable object for cachin...
A mutable CacheableKey to Serializable hash map that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:296
internal::CacheableArrayPrimitive< double, internal::DSCode::CacheableDoubleArray > CacheableDoubleArray
An immutable wrapper for array of doubles that can serve as a distributable object for caching.
static std::shared_ptr< CacheableKey > create(_T value)
Factory method that creates the key type that matches the type of value.
internal::CacheableArrayPrimitive< char16_t, internal::DSCode::CharArray > CharArray
An immutable wrapper for array of wide-characters that can serve as a distributable object for cachin...
static std::shared_ptr< Serializable > create(_T value)
Factory method that creates the Serializable object that matches the type of value.
internal::CacheableArrayPrimitive< int64_t, internal::DSCode::CacheableInt64Array > CacheableInt64Array
An immutable wrapper for array of 64-bit integers that can serve as a distributable object for cachin...
A mutable Cacheable stack wrapper that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:359
internal::CacheableArrayPrimitive< bool, internal::DSCode::BooleanArray > BooleanArray
An immutable wrapper for array of booleans that can serve as a distributable object for caching.
internal::CacheableArrayPrimitive< std::shared_ptr< CacheableString >, internal::DSCode::CacheableStringArray > CacheableStringArray
An immutable wrapper for array of strings that can serve as a distributable object for caching.
A mutable CacheableKey to Serializable hash map that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:393
A mutable Cacheable array list wrapper that can serve as a distributable object for caching.
Definition: CacheableBuiltins.hpp:343

Apache Geode C++ Cache API Documentation