VMware Tanzu GemFire Native C++ Reference 10.2.7
PdxInstance.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_PDXINSTANCE_H_
21#define GEODE_PDXINSTANCE_H_
22
23#include "CacheableBuiltins.hpp"
24#include "PdxFieldTypes.hpp"
25#include "PdxSerializable.hpp"
26
27namespace apache {
28namespace geode {
29namespace client {
30class WritablePdxInstance;
31class CacheableDate;
32class CacheableObjectArray;
51class APACHE_GEODE_EXPORT PdxInstance : public PdxSerializable {
52 public:
56 ~PdxInstance() override = default;
57
66 virtual std::shared_ptr<PdxSerializable> getObject() = 0;
67
76 virtual bool hasField(const std::string& fieldname) = 0;
77
90 virtual std::shared_ptr<Cacheable> getCacheableField(
91 const std::string& fieldname) const = 0;
92
101 virtual bool getBooleanField(const std::string& fieldname) const = 0;
102
111 virtual int8_t getByteField(const std::string& fieldname) const = 0;
112
121 virtual int16_t getShortField(const std::string& fieldname) const = 0;
122
129 virtual int32_t getIntField(const std::string& fieldname) const = 0;
130
139 virtual int64_t getLongField(const std::string& fieldname) const = 0;
140
149 virtual float getFloatField(const std::string& fieldname) const = 0;
150
159 virtual double getDoubleField(const std::string& fieldname) const = 0;
160
168 virtual char16_t getCharField(const std::string& fieldName) const = 0;
169
179 virtual std::string getStringField(const std::string& fieldname) const = 0;
180
189 virtual std::vector<bool> getBooleanArrayField(
190 const std::string& fieldname) const = 0;
191
200 virtual std::vector<int8_t> getByteArrayField(
201 const std::string& fieldname) const = 0;
202
211 virtual std::vector<int16_t> getShortArrayField(
212 const std::string& fieldname) const = 0;
213
222 virtual std::vector<int32_t> getIntArrayField(
223 const std::string& fieldname) const = 0;
224
233 virtual std::vector<int64_t> getLongArrayField(
234 const std::string& fieldname) const = 0;
235
244 virtual std::vector<float> getFloatArrayField(
245 const std::string& fieldname) const = 0;
246
255 virtual std::vector<double> getDoubleArrayField(
256 const std::string& fieldname) const = 0;
257
258 // charArray
267 virtual std::vector<char16_t> getCharArrayField(
268 const std::string& fieldName) const = 0;
269
278 virtual std::vector<std::string> getStringArrayField(
279 const std::string& fieldname) const = 0;
280
291 virtual std::shared_ptr<CacheableDate> getCacheableDateField(
292 const std::string& fieldname) const = 0;
293
306 virtual void getField(const std::string& fieldName, int8_t*** value,
307 int32_t& arrayLength,
308 int32_t*& elementLength) const = 0;
309
323 virtual std::shared_ptr<CacheableObjectArray> getCacheableObjectArrayField(
324 const std::string& fieldname) const = 0;
325
337 virtual bool isIdentityField(const std::string& fieldname) = 0;
338
346 virtual std::shared_ptr<WritablePdxInstance> createWriter() = 0;
347
366 virtual int32_t hashcode() const override = 0;
367
379 virtual std::string toString() const override = 0;
380
423 virtual bool operator==(const CacheableKey& other) const override = 0;
424
429 virtual size_t objectSize() const override = 0;
430
435 virtual std::shared_ptr<CacheableStringArray> getFieldNames() = 0;
436
437 // From PdxSerializable
443 virtual void toData(PdxWriter& output) const override = 0;
444
449 virtual void fromData(PdxReader& input) override = 0;
450
458 virtual const std::string& getClassName() const override = 0;
459
468 virtual PdxFieldTypes getFieldType(const std::string& fieldname) const = 0;
469
470 PdxInstance(const PdxInstance& other) = delete;
471 void operator=(const PdxInstance& other) = delete;
472
473 protected:
478};
479
480} // namespace client
481} // namespace geode
482} // namespace apache
483
484#endif // GEODE_PDXINSTANCE_H_
Contains generic template definitions for Cacheable types and instantiations for built-in types.
Represents a cacheable key.
Definition: CacheableKey.hpp:40
PdxInstance provides run time access to the fields of a PDX without deserializing the PDX.
Definition: PdxInstance.hpp:51
virtual bool operator==(const CacheableKey &other) const override=0
Returns true if the given CacheableKey derived object is equals to this instance.
virtual int64_t getLongField(const std::string &fieldname) const =0
Reads the named field and sets its value in int64_t type out param.
virtual bool hasField(const std::string &fieldname)=0
Checks if the named field exists and returns the result.
virtual std::shared_ptr< WritablePdxInstance > createWriter()=0
Creates and returns a WritablePdxInstance whose initial values are those of this PdxInstance.
virtual bool getBooleanField(const std::string &fieldname) const =0
Reads the named field and sets its value in bool type out param.
virtual size_t objectSize() const override=0
virtual std::vector< bool > getBooleanArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in bool array type out param.
virtual std::string toString() const override=0
Prints out all of the identity fields of this PdxInstance.
virtual int32_t getIntField(const std::string &fieldname) const =0
Reads the named field and sets its value in int32_t type out param.
virtual std::vector< int64_t > getLongArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in int64_t array type out param.
virtual std::shared_ptr< Cacheable > getCacheableField(const std::string &fieldname) const =0
Reads the named field and sets its value in std::shared_ptr<Cacheable> type out param.
virtual int8_t getByteField(const std::string &fieldname) const =0
Reads the named field and sets its value in signed char type out param.
~PdxInstance() override=default
destructor
virtual std::vector< float > getFloatArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in float array type out param.
virtual std::vector< char16_t > getCharArrayField(const std::string &fieldName) const =0
Reads the named field and sets its value in char array type out param.
virtual int32_t hashcode() const override=0
Generates a hashcode based on the identity fields of this PdxInstance.
virtual std::shared_ptr< CacheableObjectArray > getCacheableObjectArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in std::shared_ptr<CacheableObjectArray> type out param.
virtual void getField(const std::string &fieldName, int8_t ***value, int32_t &arrayLength, int32_t *&elementLength) const =0
Reads the named field and sets its value in array of byte arrays type out param.
PdxInstance()
constructors
Definition: PdxInstance.hpp:477
virtual std::string getStringField(const std::string &fieldname) const =0
Reads the named field and sets its value in std::string type out param.
virtual const std::string & getClassName() const override=0
Return the full name of the class that this pdx instance represents.
virtual std::vector< std::string > getStringArrayField(const std::string &fieldname) const =0
Reads the named field as a string array.
virtual void toData(PdxWriter &output) const override=0
serialize this object in geode PDX format.
virtual void fromData(PdxReader &input) override=0
Deserialize this object.
virtual std::vector< int16_t > getShortArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in int16_t array type out param.
virtual std::vector< int8_t > getByteArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in signed char array type out param.
virtual std::shared_ptr< CacheableDate > getCacheableDateField(const std::string &fieldname) const =0
Reads the named field and sets its value in std::shared_ptr<CacheableDate> type out param.
virtual PdxFieldTypes getFieldType(const std::string &fieldname) const =0
Return the type.
virtual double getDoubleField(const std::string &fieldname) const =0
Reads the named field and sets its value in double type out param.
virtual std::vector< double > getDoubleArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in double array type out param.
virtual char16_t getCharField(const std::string &fieldName) const =0
Reads the named field and sets its value in char type out param.
virtual int16_t getShortField(const std::string &fieldname) const =0
Reads the named field and sets its value in int16_t type out param.
virtual bool isIdentityField(const std::string &fieldname)=0
Checks if the named field was PdxWriter#markIdentityFieldmarked as an identity field.
virtual std::vector< int32_t > getIntArrayField(const std::string &fieldname) const =0
Reads the named field and sets its value in int32_t array type out param.
virtual std::shared_ptr< PdxSerializable > getObject()=0
Deserializes and returns the domain object that this instance represents.
virtual std::shared_ptr< CacheableStringArray > getFieldNames()=0
Return an unmodifiable list of the field names on this PdxInstance.
virtual float getFloatField(const std::string &fieldname) const =0
Reads the named field and sets its value in float type out param.
A PdxReader will be passed to PdxSerializable.fromData or during deserialization of a PDX.
Definition: PdxReader.hpp:58
An interface for objects whose contents can be serialized as PDX types.
Definition: PdxSerializable.hpp:41
A PdxWriter will be passed to PdxSerializable.toData when it is serializing the domain class.
Definition: PdxWriter.hpp:41

Apache Geode C++ Cache API Documentation