VMware Tanzu GemFire Native C++ Reference 10.3.0
PdxSerializer.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_PDXSERIALIZER_H_
21#define GEODE_PDXSERIALIZER_H_
22
23#include "PdxReader.hpp"
24#include "PdxWriter.hpp"
25#include "Serializable.hpp"
26
27namespace apache {
28namespace geode {
29namespace client {
30
35using UserObjectSizer = std::function<size_t(const std::shared_ptr<const void>&,
36 const std::string&)>;
37
46class APACHE_GEODE_EXPORT PdxSerializer {
47 public:
48 PdxSerializer() {}
49
50 virtual ~PdxSerializer() {}
51
58 virtual std::shared_ptr<void> fromData(const std::string& className,
59 PdxReader& pdxReader) = 0;
60
66 virtual bool toData(const std::shared_ptr<const void>& userObject,
67 const std::string& className, PdxWriter& pdxWriter) = 0;
68
74 virtual UserObjectSizer getObjectSizer(const std::string& className);
75};
76} // namespace client
77} // namespace geode
78} // namespace apache
79
80#endif // GEODE_PDXSERIALIZER_H_
A PdxReader will be passed to PdxSerializable.fromData or during deserialization of a PDX.
Definition: PdxReader.hpp:58
The PdxSerializer class allows domain classes to be serialized and deserialized as PDXs without modif...
Definition: PdxSerializer.hpp:46
virtual std::shared_ptr< void > fromData(const std::string &className, PdxReader &pdxReader)=0
Deserialize this object.
virtual UserObjectSizer getObjectSizer(const std::string &className)
Get the function pointer to the user function that returns the size of an instance of a user domain o...
virtual bool toData(const std::shared_ptr< const void > &userObject, const std::string &className, PdxWriter &pdxWriter)=0
Serializes this object in Geode PDX format.
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