VMware Tanzu GemFire Native C++ Reference 10.3.0
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
30namespace apache {
31namespace geode {
32namespace client {
33
34class PdxReader;
35class PdxWriter;
36
40class 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_
Represents a cacheable key.
Definition: CacheableKey.hpp:40
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
std::string toString() const override
Display this object as 'string', which depends on the implementation in the subclasses.
virtual void toData(PdxWriter &output) const =0
Serialize this object in Geode PDX format.
virtual const std::string & getClassName() const =0
Get the Type for the Object.
int32_t hashcode() const override
return the hashcode for this key.
virtual void fromData(PdxReader &input)=0
Deserialize this object.
bool operator==(const CacheableKey &other) const override
return true if this key matches other.
A PdxWriter will be passed to PdxSerializable.toData when it is serializing the domain class.
Definition: PdxWriter.hpp:41
This base class is the superclass of all user objects in the cache that can be serialized.
Definition: Serializable.hpp:53

Apache Geode C++ Cache API Documentation