VMware Tanzu GemFire Native C++ Reference  10.1.5
PdxSerializable.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_PDXSERIALIZABLE_H_
21 #define GEODE_PDXSERIALIZABLE_H_
22 
23 #include <iosfwd>
24 #include <memory>
25 #include <string>
26 
27 #include "CacheableKey.hpp"
28 #include "internal/geode_base.hpp"
29 
30 namespace apache {
31 namespace geode {
32 namespace client {
33 
34 class PdxReader;
35 class PdxWriter;
36 
40 class APACHE_GEODE_EXPORT PdxSerializable : public virtual Serializable,
41  public virtual CacheableKey {
42  public:
43  ~PdxSerializable() noexcept override{};
44 
45  std::string toString() const override;
46 
47  bool operator==(const CacheableKey& other) const override;
48 
49  int32_t hashcode() const override;
50 
55  virtual void toData(PdxWriter& output) const = 0;
56 
61  virtual void fromData(PdxReader& input) = 0;
62 
66  virtual const std::string& getClassName() const = 0;
67 };
68 
69 } // namespace client
70 } // namespace geode
71 } // namespace apache
72 
73 #endif // GEODE_PDXSERIALIZABLE_H_
apache::geode::client::PdxSerializable::getClassName
virtual const std::string & getClassName() const =0
Get the Type for the Object.
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::PdxReader
A PdxReader will be passed to PdxSerializable.fromData or during deserialization of a PDX.
Definition: PdxReader.hpp:58
CacheableKey.hpp
apache::geode::client::PdxSerializable::toData
virtual void toData(PdxWriter &output) const =0
Serialize this object in Geode PDX format.
apache::geode::client::Serializable
This base class is the superclass of all user objects in the cache that can be serialized.
Definition: Serializable.hpp:53
apache::geode::client::PdxSerializable::toString
std::string toString() const override
Display this object as 'string', which depends on the implementation in the subclasses.
apache::geode::client::CacheableKey
Represents a cacheable key.
Definition: CacheableKey.hpp:40
apache::geode::client::PdxSerializable::hashcode
int32_t hashcode() const override
return the hashcode for this key.
apache::geode::client::PdxSerializable::fromData
virtual void fromData(PdxReader &input)=0
Deserialize this object.
apache::geode::client::PdxSerializable
An interface for objects whose contents can be serialized as PDX types.
Definition: PdxSerializable.hpp:41
apache::geode::client::PdxSerializable::operator==
bool operator==(const CacheableKey &other) const override
return true if this key matches other.

Apache Geode C++ Cache API Documentation