VMware Tanzu GemFire Native C++ Reference  10.1.5
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 
31 namespace apache {
32 namespace geode {
33 namespace client {
34 
35 class CacheableKey;
36 class DataInput;
37 class DataOutput;
38 class PdxReader;
39 class PdxWriter;
40 
46 class APACHE_GEODE_EXPORT PdxWrapper : public PdxSerializable {
47  public:
56  PdxWrapper(std::shared_ptr<void> userObject, std::string className);
57 
66  std::shared_ptr<void> getObject();
67 
68  const std::string& getClassName() const override;
69 
70  bool operator==(const CacheableKey& other) const override;
71 
72  int32_t hashcode() const override;
73 
74  void toData(PdxWriter& output) const override;
75 
76  void fromData(PdxReader& input) override;
77 
78  std::string toString() const override;
79 
80  ~PdxWrapper() noexcept override {}
81 
82  private:
83  PdxWrapper() = delete;
84 
85  std::shared_ptr<void> m_userObject;
86  std::string m_className;
87 };
88 } // namespace client
89 } // namespace geode
90 } // namespace apache
91 
92 #endif // GEODE_PDXWRAPPER_H_
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::PdxWrapper::fromData
void fromData(PdxReader &input) override
Deserialize this object.
apache::geode::client::PdxReader
A PdxReader will be passed to PdxSerializable.fromData or during deserialization of a PDX.
Definition: PdxReader.hpp:58
apache::geode::client::PdxWrapper
The PdxWrapper class allows domain classes to be used in Region operations.
Definition: PdxWrapper.hpp:46
apache::geode::client::PdxWrapper::getObject
std::shared_ptr< void > getObject()
Returns the pointer to the user object which is deserialized with a PdxSerializer.
apache::geode::client::PdxWrapper::toData
void toData(PdxWriter &output) const override
Serialize this object in Geode PDX format.
apache::geode::client::PdxWrapper::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::PdxWrapper::PdxWrapper
PdxWrapper(std::shared_ptr< void > userObject, std::string className)
Constructor which takes the address of the user object to contain for PDX serialization.
apache::geode::client::PdxSerializable
An interface for objects whose contents can be serialized as PDX types.
Definition: PdxSerializable.hpp:41
apache::geode::client::PdxWrapper::getClassName
const std::string & getClassName() const override
Get the Type for the Object.
apache::geode::client::PdxWrapper::hashcode
int32_t hashcode() const override
return the hashcode for this key.
apache::geode::client::PdxWrapper::operator==
bool operator==(const CacheableKey &other) const override
return true if this key matches other.

Apache Geode C++ Cache API Documentation