VMware Tanzu GemFire Native C++ Reference  10.1.5
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"
27 #include "CacheableObjectArray.hpp"
28 #include "PdxInstance.hpp"
29 #include "internal/geode_globals.hpp"
30 
31 namespace apache {
32 namespace geode {
33 namespace client {
34 
35 class PdxType;
36 typedef std::map<std::string, std::shared_ptr<Cacheable>> FieldVsValues;
37 class CachePerfStats;
38 class PdxTypeRegistry;
39 class AuthenticatedView;
40 
52 class 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 
239  PdxInstanceFactory& writeBooleanArray(const std::string& fieldName,
240  const std::vector<bool>& value);
241 
253  PdxInstanceFactory& writeCharArray(const std::string& fieldName,
254  const std::vector<char16_t>& value);
255 
267  PdxInstanceFactory& writeByteArray(const std::string& fieldName,
268  const std::vector<int8_t>& value);
269 
281  PdxInstanceFactory& writeShortArray(const std::string& fieldName,
282  const std::vector<int16_t>& value);
283 
295  PdxInstanceFactory& writeIntArray(const std::string& fieldName,
296  const std::vector<int32_t>& value);
297 
309  PdxInstanceFactory& writeLongArray(const std::string& fieldName,
310  const std::vector<int64_t>& value);
311 
323  PdxInstanceFactory& writeFloatArray(const std::string& fieldName,
324  const std::vector<float>& value);
325 
337  PdxInstanceFactory& writeDoubleArray(const std::string& fieldName,
338  const std::vector<double>& value);
339 
351  PdxInstanceFactory& writeStringArray(const std::string& fieldName,
352  const std::vector<std::string>& value);
353 
369  const std::string& fieldName,
370  std::shared_ptr<CacheableObjectArray> value);
371 
385  PdxInstanceFactory& writeArrayOfByteArrays(const std::string& fieldName,
386  int8_t** value,
387  int32_t arrayLength,
388  int32_t* elementLength);
389 
413  PdxInstanceFactory& markIdentityField(const std::string& fieldName);
414 
415  private:
416  bool m_created;
417  std::shared_ptr<PdxType> m_pdxType;
418  FieldVsValues m_FieldVsValues;
419  CachePerfStats& m_cachePerfStats;
420  PdxTypeRegistry& m_pdxTypeRegistry;
421  const CacheImpl& m_cacheImpl;
422  bool m_enableTimeStatistics;
423  void isFieldAdded(const std::string& fieldName);
424 
425  PdxInstanceFactory(const std::string& className,
426  CachePerfStats& cachePerfStats,
427  PdxTypeRegistry& m_pdxTypeRegistry, const CacheImpl& cache,
428  bool enableTimeStatistics);
429 
430  friend CacheImpl;
431  friend AuthenticatedView;
432 };
433 } // namespace client
434 } // namespace geode
435 } // namespace apache
436 
437 #endif // GEODE_PDXINSTANCEFACTORY_H_
apache::geode::client::PdxInstanceFactory::writeDouble
PdxInstanceFactory & writeDouble(const std::string &fieldName, double value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeChar
PdxInstanceFactory & writeChar(const std::string &fieldName, char value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeFloatArray
PdxInstanceFactory & writeFloatArray(const std::string &fieldName, const std::vector< float > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeShortArray
PdxInstanceFactory & writeShortArray(const std::string &fieldName, const std::vector< int16_t > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeShort
PdxInstanceFactory & writeShort(const std::string &fieldName, int16_t value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeBoolean
PdxInstanceFactory & writeBoolean(const std::string &fieldName, bool value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeChar
PdxInstanceFactory & writeChar(const std::string &fieldName, char16_t value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeDoubleArray
PdxInstanceFactory & writeDoubleArray(const std::string &fieldName, const std::vector< double > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeByte
PdxInstanceFactory & writeByte(const std::string &fieldName, int8_t value)
Writes the named field with the given value to the serialized form.
apache::geode::client::AuthenticatedView
Creates an authenticated cache view to allow credential based access to region services.
Definition: AuthenticatedView.hpp:46
apache::geode::client::PdxInstanceFactory::create
std::shared_ptr< PdxInstance > create()
Create a PdxInstance.
CacheableDate.hpp
apache::geode::client::PdxInstanceFactory::writeInt
PdxInstanceFactory & writeInt(const std::string &fieldName, int32_t value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeObjectArray
PdxInstanceFactory & writeObjectArray(const std::string &fieldName, std::shared_ptr< CacheableObjectArray > value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeStringArray
PdxInstanceFactory & writeStringArray(const std::string &fieldName, const std::vector< std::string > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeBooleanArray
PdxInstanceFactory & writeBooleanArray(const std::string &fieldName, const std::vector< bool > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory
PdxInstanceFactory gives you a way to create PdxInstances.
Definition: PdxInstanceFactory.hpp:52
apache::geode::client::PdxInstanceFactory::writeByteArray
PdxInstanceFactory & writeByteArray(const std::string &fieldName, const std::vector< int8_t > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeLongArray
PdxInstanceFactory & writeLongArray(const std::string &fieldName, const std::vector< int64_t > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::markIdentityField
PdxInstanceFactory & markIdentityField(const std::string &fieldName)
Indicate that the named field should be included in hashCode and equals (operator==()) checks of this...
CacheableBuiltins.hpp
Contains generic template definitions for Cacheable types and instantiations for built-in types.
apache::geode::client::PdxInstanceFactory::writeIntArray
PdxInstanceFactory & writeIntArray(const std::string &fieldName, const std::vector< int32_t > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeString
PdxInstanceFactory & writeString(const std::string &fieldName, const std::string &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeCharArray
PdxInstanceFactory & writeCharArray(const std::string &fieldName, const std::vector< char16_t > &value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeLong
PdxInstanceFactory & writeLong(const std::string &fieldName, int64_t value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeArrayOfByteArrays
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.
apache::geode::client::PdxInstanceFactory::writeFloat
PdxInstanceFactory & writeFloat(const std::string &fieldName, float value)
Writes the named field with the given value to the serialized form.
apache::geode::client::PdxInstanceFactory::writeDate
PdxInstanceFactory & writeDate(const std::string &fieldName, std::shared_ptr< CacheableDate > value)
Writes the named field with the given value to the serialized form.
CacheableObjectArray.hpp
apache::geode::client::PdxInstanceFactory::writeObject
PdxInstanceFactory & writeObject(const std::string &fieldName, std::shared_ptr< Cacheable > value)
Writes the named field with the given value to the serialized form.

Apache Geode C++ Cache API Documentation