Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
Serializer.h
1 /*
2  * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 //
17 // Created by sancar koyunlu on 6/7/13.
18 
19 #ifndef HAZELCAST_TYPE_SERIALIZER
20 #define HAZELCAST_TYPE_SERIALIZER
21 
22 #include "hazelcast/util/HazelcastDll.h"
23 
24 namespace hazelcast {
25  namespace client {
26  namespace serialization {
27  class ObjectDataOutput;
28 
29  class ObjectDataInput;
30 
34  class HAZELCAST_API SerializerBase {
35  public:
39  virtual ~SerializerBase();
40 
50  virtual int getHazelcastTypeId() const = 0;
51  };
52 
107  template <typename Serializable>
108  class Serializer : public SerializerBase {
109  public:
113  virtual ~Serializer() {}
114 
121  virtual void write(ObjectDataOutput &out, const Serializable &object) = 0;
122 
129  virtual void read(ObjectDataInput &in, Serializable &object) = 0;
130 
131  };
132 
133  }
134  }
135 }
136 
137 
138 #endif //HAZELCAST_TYPE_SERIALIZER
139 
virtual ~Serializer()
Destructor.
Definition: Serializer.h:113
Internal Base class for Serializers.
Definition: Serializer.h:34
Base class for custom serialization.
Definition: Serializer.h:108
virtual void read(ObjectDataInput &in, Serializable &object)=0
Reads object from objectDataInputStream.
Provides serialization methods for primitive types,a arrays of primitive types, Portable, IdentifiedDataSerializable and custom serializables.
Definition: ObjectDataOutput.h:51
virtual void write(ObjectDataOutput &out, const Serializable &object)=0
This method writes object to ObjectDataOutput.
Provides deserialization methods for primitives types, arrays of primitive types Portable, IdentifiedDataSerializable and custom serializable types.
Definition: ObjectDataInput.h:66