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 
20 
21 
22 #ifndef HAZELCAST_TYPE_SERIALIZER
23 #define HAZELCAST_TYPE_SERIALIZER
24 
25 #include "hazelcast/util/HazelcastDll.h"
26 
27 namespace hazelcast {
28  namespace client {
29  namespace serialization {
30  class ObjectDataOutput;
31 
32  class ObjectDataInput;
33 
37  class HAZELCAST_API SerializerBase {
38  public:
42  virtual ~SerializerBase();
43 
52  virtual int getTypeId() const = 0;
53  };
54 
101  template <typename Serializable>
102  class Serializer : public SerializerBase {
103  public:
107  virtual ~Serializer() {}
108 
115  virtual void write(ObjectDataOutput &out, const Serializable &object) = 0;
116 
123  virtual void read(ObjectDataInput &in, Serializable &object) = 0;
124 
125  };
126 
127  }
128  }
129 }
130 
131 
132 #endif //HAZELCAST_TYPE_SERIALIZER
133 
virtual ~Serializer()
Destructor.
Definition: Serializer.h:107
Internal Base class for Serializers.
Definition: Serializer.h:37
Base class for custom serialization.
Definition: Serializer.h:102
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:48
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:63