VMware Tanzu GemFire Native C++ Reference  10.1.5
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 
27 namespace apache {
28 namespace geode {
29 namespace client {
30 class WritablePdxInstance;
31 class CacheableDate;
32 class CacheableObjectArray;
51 class 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 
92  virtual std::shared_ptr<Cacheable> getCacheableField(
93  const std::string& fieldname) const = 0;
94 
104  virtual bool getBooleanField(const std::string& fieldname) const = 0;
105 
115  virtual int8_t getByteField(const std::string& fieldname) const = 0;
116 
126  virtual int16_t getShortField(const std::string& fieldname) const = 0;
127 
135  virtual int32_t getIntField(const std::string& fieldname) const = 0;
136 
146  virtual int64_t getLongField(const std::string& fieldname) const = 0;
147 
157  virtual float getFloatField(const std::string& fieldname) const = 0;
158 
168  virtual double getDoubleField(const std::string& fieldname) const = 0;
169 
179  virtual char16_t getCharField(const std::string& fieldName) const = 0;
180 
190  virtual std::string getStringField(const std::string& fieldname) const = 0;
191 
202  virtual std::vector<bool> getBooleanArrayField(
203  const std::string& fieldname) const = 0;
204 
215  virtual std::vector<int8_t> getByteArrayField(
216  const std::string& fieldname) const = 0;
217 
228  virtual std::vector<int16_t> getShortArrayField(
229  const std::string& fieldname) const = 0;
230 
241  virtual std::vector<int32_t> getIntArrayField(
242  const std::string& fieldname) const = 0;
243 
254  virtual std::vector<int64_t> getLongArrayField(
255  const std::string& fieldname) const = 0;
256 
267  virtual std::vector<float> getFloatArrayField(
268  const std::string& fieldname) const = 0;
269 
280  virtual std::vector<double> getDoubleArrayField(
281  const std::string& fieldname) const = 0;
282 
283  // charArray
294  virtual std::vector<char16_t> getCharArrayField(
295  const std::string& fieldName) const = 0;
296 
305  virtual std::vector<std::string> getStringArrayField(
306  const std::string& fieldname) const = 0;
307 
319  virtual std::shared_ptr<CacheableDate> getCacheableDateField(
320  const std::string& fieldname) const = 0;
321 
334  virtual void getField(const std::string& fieldName, int8_t*** value,
335  int32_t& arrayLength,
336  int32_t*& elementLength) const = 0;
337 
352  virtual std::shared_ptr<CacheableObjectArray> getCacheableObjectArrayField(
353  const std::string& fieldname) const = 0;
354 
366  virtual bool isIdentityField(const std::string& fieldname) = 0;
367 
375  virtual std::shared_ptr<WritablePdxInstance> createWriter() = 0;
376 
395  virtual int32_t hashcode() const override = 0;
396 
408  virtual std::string toString() const override = 0;
409 
452  virtual bool operator==(const CacheableKey& other) const override = 0;
453 
458  virtual size_t objectSize() const override = 0;
459 
464  virtual std::shared_ptr<CacheableStringArray> getFieldNames() = 0;
465 
466  // From PdxSerializable
472  virtual void toData(PdxWriter& output) const override = 0;
473 
478  virtual void fromData(PdxReader& input) override = 0;
479 
487  virtual const std::string& getClassName() const override = 0;
488 
497  virtual PdxFieldTypes getFieldType(const std::string& fieldname) const = 0;
498 
499  PdxInstance(const PdxInstance& other) = delete;
500  void operator=(const PdxInstance& other) = delete;
501 
502  protected:
507 };
508 
509 } // namespace client
510 } // namespace geode
511 } // namespace apache
512 
513 #endif // GEODE_PDXINSTANCE_H_
apache::geode::client::PdxInstance::getCacheableObjectArrayField
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.
apache::geode::client::PdxInstance::hashcode
virtual int32_t hashcode() const override=0
Generates a hashcode based on the identity fields of this PdxInstance.
apache::geode::client::PdxInstance::fromData
virtual void fromData(PdxReader &input) override=0
Deserialize this object.
apache::geode::client::PdxInstance::getBooleanArrayField
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.
apache::geode::client::PdxInstance::getFieldType
virtual PdxFieldTypes getFieldType(const std::string &fieldname) const =0
Return the type.
apache::geode::client::PdxInstance::toString
virtual std::string toString() const override=0
Prints out all of the identity fields of this PdxInstance.
apache::geode::client::PdxInstance::getFloatArrayField
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.
apache::geode::client::PdxInstance::~PdxInstance
~PdxInstance() override=default
destructor
apache::geode::client::PdxInstance::getCharField
virtual char16_t getCharField(const std::string &fieldName) const =0
Reads the named field and sets its value in char type out param.
apache::geode::client::PdxInstance::getByteField
virtual int8_t getByteField(const std::string &fieldname) const =0
Reads the named field and sets its value in signed char type out param.
apache::geode::client::PdxInstance::toData
virtual void toData(PdxWriter &output) const override=0
serialize this object in geode PDX format.
apache::geode::client::PdxWriter
A PdxWriter will be passed to PdxSerializable.toData when it is serializing the domain class.
Definition: PdxWriter.hpp:41
apache::geode::client::PdxInstance::getCacheableDateField
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.
apache::geode::client::PdxInstance::getCharArrayField
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.
apache::geode::client::PdxInstance::getIntArrayField
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.
apache::geode::client::PdxInstance::getStringField
virtual std::string getStringField(const std::string &fieldname) const =0
Reads the named field and sets its value in std::string type out param.
apache::geode::client::PdxReader
A PdxReader will be passed to PdxSerializable.fromData or during deserialization of a PDX.
Definition: PdxReader.hpp:58
apache::geode::client::PdxInstance::createWriter
virtual std::shared_ptr< WritablePdxInstance > createWriter()=0
Creates and returns a WritablePdxInstance whose initial values are those of this PdxInstance.
apache::geode::client::PdxInstance::getFieldNames
virtual std::shared_ptr< CacheableStringArray > getFieldNames()=0
Return an unmodifiable list of the field names on this PdxInstance.
apache::geode::client::PdxInstance::getDoubleArrayField
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.
apache::geode::client::PdxInstance::getDoubleField
virtual double getDoubleField(const std::string &fieldname) const =0
Reads the named field and sets its value in double type out param.
apache::geode::client::PdxInstance::getByteArrayField
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.
apache::geode::client::PdxInstance::getIntField
virtual int32_t getIntField(const std::string &fieldname) const =0
Reads the named field and sets its value in int32_t type out param.
apache::geode::client::PdxInstance::isIdentityField
virtual bool isIdentityField(const std::string &fieldname)=0
Checks if the named field was PdxWriter#markIdentityFieldmarked as an identity field.
apache::geode::client::PdxInstance::getFloatField
virtual float getFloatField(const std::string &fieldname) const =0
Reads the named field and sets its value in float type out param.
apache::geode::client::PdxInstance::getObject
virtual std::shared_ptr< PdxSerializable > getObject()=0
Deserializes and returns the domain object that this instance represents.
CacheableBuiltins.hpp
Contains generic template definitions for Cacheable types and instantiations for built-in types.
apache::geode::client::CacheableKey
Represents a cacheable key.
Definition: CacheableKey.hpp:40
apache::geode::client::PdxInstance::getCacheableField
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.
apache::geode::client::PdxInstance::getLongArrayField
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.
apache::geode::client::PdxInstance::operator==
virtual bool operator==(const CacheableKey &other) const override=0
Returns true if the given CacheableKey derived object is equals to this instance.
apache::geode::client::PdxInstance::getBooleanField
virtual bool getBooleanField(const std::string &fieldname) const =0
Reads the named field and sets its value in bool type out param.
apache::geode::client::PdxInstance::getField
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.
apache::geode::client::PdxSerializable
An interface for objects whose contents can be serialized as PDX types.
Definition: PdxSerializable.hpp:41
apache::geode::client::PdxInstance::getLongField
virtual int64_t getLongField(const std::string &fieldname) const =0
Reads the named field and sets its value in int64_t type out param.
apache::geode::client::PdxInstance::getShortArrayField
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.
apache::geode::client::PdxInstance::getShortField
virtual int16_t getShortField(const std::string &fieldname) const =0
Reads the named field and sets its value in int16_t type out param.
apache::geode::client::PdxInstance::objectSize
virtual size_t objectSize() const override=0
apache::geode::client::PdxInstance::PdxInstance
PdxInstance()
constructors
Definition: PdxInstance.hpp:506
apache::geode::client::PdxInstance::getStringArrayField
virtual std::vector< std::string > getStringArrayField(const std::string &fieldname) const =0
Reads the named field as a string array.
apache::geode::client::PdxInstance::hasField
virtual bool hasField(const std::string &fieldname)=0
Checks if the named field exists and returns the result.
apache::geode::client::PdxInstance::getClassName
virtual const std::string & getClassName() const override=0
Return the full name of the class that this pdx instance represents.
apache::geode::client::PdxInstance
PdxInstance provides run time access to the fields of a PDX without deserializing the PDX.
Definition: PdxInstance.hpp:51

Apache Geode C++ Cache API Documentation