Apache Geode Native C++ Reference 1.15.0
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
29namespace apache {
30namespace geode {
31namespace client {
32
33class DataOutput;
34class DataInput;
35
39class 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_
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition: DataInput.hpp:59
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:48
An interface for objects whose contents can be serialized as primitive types.
Definition: DataSerializable.hpp:39
virtual void fromData(DataInput &dataInput)=0
deserialize this object.
virtual void toData(DataOutput &dataOutput) const =0
serialize this object
const std::type_info & getType() const
Return the std::type_info of the instance being serialized.
Definition: DataSerializable.hpp:60
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