VMware GemFire Native C++ Reference  9.1
PdxInstance.hpp
1 #pragma once
2 
3 #ifndef GEODE_PDXINSTANCE_H_
4 #define GEODE_PDXINSTANCE_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include "PdxSerializable.hpp"
24 #include "CacheableBuiltins.hpp"
25 #include "PdxFieldTypes.hpp"
26 
27 namespace apache {
28 namespace geode {
29 namespace client {
30 
50 class CPPCACHE_EXPORT PdxInstance : public PdxSerializable {
51  public:
55  virtual ~PdxInstance() {}
56 
65  virtual PdxSerializablePtr getObject() = 0;
66 
75  virtual bool hasField(const char* fieldname) = 0;
76 
89  virtual void getField(const char* fieldname, CacheablePtr& value) const = 0;
90 
100  virtual void getField(const char* fieldname, bool& value) const = 0;
101 
115  virtual void getField(const char* fieldname, signed char& value) const = 0;
116 
130  virtual void getField(const char* fieldname, unsigned char& value) const = 0;
131 
141  virtual void getField(const char* fieldname, int16_t& value) const = 0;
142 
150  virtual void getField(const char* fieldname, int32_t& value) const = 0;
151 
161  virtual void getField(const char* fieldname, int64_t& value) const = 0;
162 
172  virtual void getField(const char* fieldname, float& value) const = 0;
173 
183  virtual void getField(const char* fieldname, double& value) const = 0;
184 
194  virtual void getField(const char* fieldName, wchar_t& value) const = 0;
195 
205  virtual void getField(const char* fieldName, char& value) const = 0;
206 
217  virtual void getField(const char* fieldname, bool** value,
218  int32_t& length) const = 0;
219 
234  virtual void getField(const char* fieldname, signed char** value,
235  int32_t& length) const = 0;
236 
252  virtual void getField(const char* fieldname, unsigned char** value,
253  int32_t& length) const = 0;
254 
265  virtual void getField(const char* fieldname, int16_t** value,
266  int32_t& length) const = 0;
267 
278  virtual void getField(const char* fieldname, int32_t** value,
279  int32_t& length) const = 0;
280 
291  virtual void getField(const char* fieldname, int64_t** value,
292  int32_t& length) const = 0;
293 
304  virtual void getField(const char* fieldname, float** value,
305  int32_t& length) const = 0;
306 
317  virtual void getField(const char* fieldname, double** value,
318  int32_t& length) const = 0;
319 
320  // charArray
331  virtual void getField(const char* fieldName, wchar_t** value,
332  int32_t& length) const = 0;
333 
344  virtual void getField(const char* fieldName, char** value,
345  int32_t& length) const = 0;
346 
347  // String
357  virtual void getField(const char* fieldname, wchar_t** value) const = 0;
358 
368  virtual void getField(const char* fieldname, char** value) const = 0;
369 
370  // StringArray
381  virtual void getField(const char* fieldname, wchar_t*** value,
382  int32_t& length) const = 0;
383 
394  virtual void getField(const char* fieldname, char*** value,
395  int32_t& length) const = 0;
396 
406  virtual void getField(const char* fieldname,
407  CacheableDatePtr& value) const = 0;
408 
421  virtual void getField(const char* fieldName, int8_t*** value,
422  int32_t& arrayLength,
423  int32_t*& elementLength) const = 0;
424 
438  virtual void getField(const char* fieldname,
439  CacheableObjectArrayPtr& value) const = 0;
440 
452  virtual bool isIdentityField(const char* fieldname) = 0;
453 
461  virtual WritablePdxInstancePtr createWriter() = 0;
462 
481  virtual int32_t hashcode() const = 0;
482 
494  virtual CacheableStringPtr toString() const = 0;
495 
499  virtual void toData(DataOutput& output) const {
500  PdxSerializable::toData(output);
501  }
502 
507  virtual Serializable* fromData(DataInput& input) {
508  return PdxSerializable::fromData(input);
509  }
510 
554  virtual bool operator==(const CacheableKey& other) const = 0;
555 
560  virtual uint32_t objectSize() const = 0;
561 
566  virtual CacheableStringArrayPtr getFieldNames() = 0;
567 
568  // From PdxSerializable
574  virtual void toData(PdxWriterPtr output) = 0;
575 
580  virtual void fromData(PdxReaderPtr input) = 0;
581 
589  virtual const char* getClassName() const = 0;
590 
600  virtual PdxFieldTypes::PdxFieldType getFieldType(
601  const char* fieldname) const = 0;
602 
603  protected:
608 
609  private:
610  // never implemented.
611  PdxInstance(const PdxInstance& other);
612  void operator=(const PdxInstance& other);
613 };
614 } // namespace client
615 } // namespace geode
616 } // namespace apache
617 
618 #endif // GEODE_PDXINSTANCE_H_
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
Contains generic template definitions for Cacheable types and instantiations for built-in types...
virtual ~PdxInstance()
destructor
Definition: PdxInstance.hpp:55
PdxInstance provides run time access to the fields of a PDX without deserializing the PDX...
Definition: PdxInstance.hpp:50
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:74
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:52
PdxInstance()
constructors
Definition: PdxInstance.hpp:607
Template class for CacheableArrayType SharedPtr's that adds [] operator.
Definition: CacheableBuiltins.hpp:144
virtual void toData(DataOutput &output) const
serialize this object.
Definition: PdxInstance.hpp:499
This abstract base class is the superclass of all user objects in the cache that can be serialized...
Definition: Serializable.hpp:53
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition: DataInput.hpp:56
Represents a cacheable key.
Definition: CacheableKey.hpp:36
virtual Serializable * fromData(DataInput &input)
deserialize this object, typical implementation should return the 'this' pointer. ...
Definition: PdxInstance.hpp:507
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation