Apache Geode Native C++ Reference 1.15.0
PdxWrapper.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_PDXWRAPPER_H_
21#define GEODE_PDXWRAPPER_H_
22
23#include <iosfwd>
24#include <memory>
25#include <string>
26
27#include "PdxSerializable.hpp"
28#include "PdxSerializer.hpp"
29#include "internal/geode_base.hpp"
30
31namespace apache {
32namespace geode {
33namespace client {
34
35class CacheableKey;
36class DataInput;
37class DataOutput;
38class PdxReader;
39class PdxWriter;
40
46class APACHE_GEODE_EXPORT PdxWrapper : public PdxSerializable {
47 public:
56 PdxWrapper(std::shared_ptr<void> userObject, std::string className);
57
64 std::shared_ptr<void> getObject();
65
66 const std::string& getClassName() const override;
67
68 bool operator==(const CacheableKey& other) const override;
69
70 int32_t hashcode() const override;
71
72 void toData(PdxWriter& output) const override;
73
74 void fromData(PdxReader& input) override;
75
76 std::string toString() const override;
77
78 ~PdxWrapper() noexcept override {}
79
80 private:
81 PdxWrapper() = delete;
82
83 std::shared_ptr<void> m_userObject;
84 std::string m_className;
85};
86} // namespace client
87} // namespace geode
88} // namespace apache
89
90#endif // GEODE_PDXWRAPPER_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
The PdxWrapper class allows domain classes to be used in Region operations.
Definition: PdxWrapper.hpp:46
const std::string & getClassName() const override
Get the Type for the Object.
int32_t hashcode() const override
return the hashcode for this key.
void fromData(PdxReader &input) override
Deserialize this object.
void toData(PdxWriter &output) const override
Serialize this object in Geode PDX format.
std::string toString() const override
Display this object as 'string', which depends on the implementation in the subclasses.
bool operator==(const CacheableKey &other) const override
return true if this key matches other.
std::shared_ptr< void > getObject()
Returns the pointer to the user object which is deserialized with a PdxSerializer.
PdxWrapper(std::shared_ptr< void > userObject, std::string className)
Constructor which takes the address of the user object to contain for PDX serialization.
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