VMware Tanzu GemFire Native C++ Reference 10.2.7
PdxInstanceFactory.hpp
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_PDXINSTANCEFACTORY_H_
21#define GEODE_PDXINSTANCEFACTORY_H_
22
23#include <map>
24
25#include "CacheableBuiltins.hpp"
26#include "CacheableDate.hpp"
28#include "PdxInstance.hpp"
29#include "internal/geode_globals.hpp"
30
31namespace apache {
32namespace geode {
33namespace client {
34
35class PdxType;
36typedef std::map<std::string, std::shared_ptr<Cacheable>> FieldVsValues;
37class CachePerfStats;
38class PdxTypeRegistry;
39class AuthenticatedView;
40
52class APACHE_GEODE_EXPORT PdxInstanceFactory {
53 public:
54 PdxInstanceFactory() = delete;
55 ~PdxInstanceFactory() noexcept = default;
56 PdxInstanceFactory(const PdxInstanceFactory& other) = default;
57 PdxInstanceFactory& operator=(const PdxInstanceFactory& other) = default;
58 PdxInstanceFactory(PdxInstanceFactory&& other) = default;
59 PdxInstanceFactory& operator=(PdxInstanceFactory&& other) = default;
60
61 public:
69 std::shared_ptr<PdxInstance> create();
70
81 PdxInstanceFactory& writeChar(const std::string& fieldName, char16_t value);
82
93 PdxInstanceFactory& writeChar(const std::string& fieldName, char value);
94
105 PdxInstanceFactory& writeBoolean(const std::string& fieldName, bool value);
106
117 PdxInstanceFactory& writeByte(const std::string& fieldName, int8_t value);
118
129 PdxInstanceFactory& writeShort(const std::string& fieldName, int16_t value);
130
141 PdxInstanceFactory& writeInt(const std::string& fieldName, int32_t value);
142
153 PdxInstanceFactory& writeLong(const std::string& fieldName, int64_t value);
154
165 PdxInstanceFactory& writeFloat(const std::string& fieldName, float value);
166
177 PdxInstanceFactory& writeDouble(const std::string& fieldName, double value);
178
189 PdxInstanceFactory& writeDate(const std::string& fieldName,
190 std::shared_ptr<CacheableDate> value);
191
202 PdxInstanceFactory& writeString(const std::string& fieldName,
203 const std::string& value);
204
205 PdxInstanceFactory& writeString(const std::string& fieldName,
206 std::string&& value);
207
225 PdxInstanceFactory& writeObject(const std::string& fieldName,
226 std::shared_ptr<Cacheable> value);
227
238 PdxInstanceFactory& writeBooleanArray(const std::string& fieldName,
239 const std::vector<bool>& value);
240
251 PdxInstanceFactory& writeCharArray(const std::string& fieldName,
252 const std::vector<char16_t>& value);
253
264 PdxInstanceFactory& writeByteArray(const std::string& fieldName,
265 const std::vector<int8_t>& value);
266
277 PdxInstanceFactory& writeShortArray(const std::string& fieldName,
278 const std::vector<int16_t>& value);
279
290 PdxInstanceFactory& writeIntArray(const std::string& fieldName,
291 const std::vector<int32_t>& value);
292
303 PdxInstanceFactory& writeLongArray(const std::string& fieldName,
304 const std::vector<int64_t>& value);
305
316 PdxInstanceFactory& writeFloatArray(const std::string& fieldName,
317 const std::vector<float>& value);
318
329 PdxInstanceFactory& writeDoubleArray(const std::string& fieldName,
330 const std::vector<double>& value);
331
342 PdxInstanceFactory& writeStringArray(const std::string& fieldName,
343 const std::vector<std::string>& value);
344
360 const std::string& fieldName,
361 std::shared_ptr<CacheableObjectArray> value);
362
376 PdxInstanceFactory& writeArrayOfByteArrays(const std::string& fieldName,
377 int8_t** value,
378 int32_t arrayLength,
379 int32_t* elementLength);
380
404 PdxInstanceFactory& markIdentityField(const std::string& fieldName);
405
406 private:
407 bool m_created;
408 std::shared_ptr<PdxType> m_pdxType;
409 FieldVsValues m_FieldVsValues;
410 CachePerfStats& m_cachePerfStats;
411 PdxTypeRegistry& m_pdxTypeRegistry;
412 const CacheImpl& m_cacheImpl;
413 bool m_enableTimeStatistics;
414 void isFieldAdded(const std::string& fieldName);
415
416 PdxInstanceFactory(const std::string& className, bool expectDomainClass,
417 CachePerfStats& cachePerfStats,
418 PdxTypeRegistry& m_pdxTypeRegistry, const CacheImpl& cache,
419 bool enableTimeStatistics);
420
421 friend CacheImpl;
422 friend AuthenticatedView;
423};
424} // namespace client
425} // namespace geode
426} // namespace apache
427
428#endif // GEODE_PDXINSTANCEFACTORY_H_
Contains generic template definitions for Cacheable types and instantiations for built-in types.
Creates an authenticated cache view to allow credential based access to region services.
Definition: AuthenticatedView.hpp:46
PdxInstanceFactory gives you a way to create PdxInstances.
Definition: PdxInstanceFactory.hpp:52
PdxInstanceFactory & writeBooleanArray(const std::string &fieldName, const std::vector< bool > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeLongArray(const std::string &fieldName, const std::vector< int64_t > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeString(const std::string &fieldName, const std::string &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeFloatArray(const std::string &fieldName, const std::vector< float > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeByteArray(const std::string &fieldName, const std::vector< int8_t > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeShort(const std::string &fieldName, int16_t value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeObject(const std::string &fieldName, std::shared_ptr< Cacheable > value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & markIdentityField(const std::string &fieldName)
Indicate that the named field should be included in hashCode and equals (operator==()) checks of this...
PdxInstanceFactory & writeArrayOfByteArrays(const std::string &fieldName, int8_t **value, int32_t arrayLength, int32_t *elementLength)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeChar(const std::string &fieldName, char value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeInt(const std::string &fieldName, int32_t value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeCharArray(const std::string &fieldName, const std::vector< char16_t > &value)
Writes the named field with the given value to the serialized form.
std::shared_ptr< PdxInstance > create()
Create a PdxInstance.
PdxInstanceFactory & writeDoubleArray(const std::string &fieldName, const std::vector< double > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeDate(const std::string &fieldName, std::shared_ptr< CacheableDate > value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeDouble(const std::string &fieldName, double value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeStringArray(const std::string &fieldName, const std::vector< std::string > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeBoolean(const std::string &fieldName, bool value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeLong(const std::string &fieldName, int64_t value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeFloat(const std::string &fieldName, float value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeByte(const std::string &fieldName, int8_t value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeObjectArray(const std::string &fieldName, std::shared_ptr< CacheableObjectArray > value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeShortArray(const std::string &fieldName, const std::vector< int16_t > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeIntArray(const std::string &fieldName, const std::vector< int32_t > &value)
Writes the named field with the given value to the serialized form.
PdxInstanceFactory & writeChar(const std::string &fieldName, char16_t value)
Writes the named field with the given value to the serialized form.

Apache Geode C++ Cache API Documentation