VMware Tanzu GemFire Native C++ Reference  10.1.5
DataSerializable.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_DATASERIALIZABLE_H_
21 #define GEODE_DATASERIALIZABLE_H_
22 
23 #include <typeindex>
24 #include <typeinfo>
25 
26 #include "Serializable.hpp"
27 #include "internal/geode_globals.hpp"
28 
29 namespace apache {
30 namespace geode {
31 namespace client {
32 
33 class DataOutput;
34 class DataInput;
35 
39 class APACHE_GEODE_EXPORT DataSerializable : public virtual Serializable {
40  public:
41  ~DataSerializable() override = default;
42 
46  virtual void toData(DataOutput& dataOutput) const = 0;
47 
51  virtual void fromData(DataInput& dataInput) = 0;
52 
60  const std::type_info& getType() const { return typeid(*this); }
61 };
62 
63 } // namespace client
64 } // namespace geode
65 } // namespace apache
66 
67 #endif // GEODE_DATASERIALIZABLE_H_
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::DataSerializable::toData
virtual void toData(DataOutput &dataOutput) const =0
serialize this object
apache::geode::client::DataSerializable::fromData
virtual void fromData(DataInput &dataInput)=0
deserialize this object.
apache::geode::client::DataOutput
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:48
apache::geode::client::DataSerializable
An interface for objects whose contents can be serialized as primitive types.
Definition: DataSerializable.hpp:39
apache::geode::client::DataSerializable::getType
const std::type_info & getType() const
Return the std::type_info of the instance being serialized.
Definition: DataSerializable.hpp:60
apache::geode::client::DataInput
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition: DataInput.hpp:59

Apache Geode C++ Cache API Documentation