Hazelcast C++ Client
SerializationConfig.h
1 /*
2  * Copyright (c) 2008-2017, 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 25/06/14.
18 //
19 
20 
21 #ifndef HAZELCAST_SerializationConfig
22 #define HAZELCAST_SerializationConfig
23 
24 #include <boost/shared_ptr.hpp>
25 #include <vector>
26 #include <map>
27 
28 #include "hazelcast/util/HazelcastDll.h"
29 #include "hazelcast/client/serialization/Serializer.h"
30 #include "hazelcast/client/serialization/DataSerializableFactory.h"
31 #include "hazelcast/client/serialization/PortableFactory.h"
32 
33 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
34 #pragma warning(push)
35 #pragma warning(disable: 4251) //for dll export
36 #endif
37 
38 namespace hazelcast {
39  namespace client {
40  namespace serialization{
41  class SerializerBase;
42  }
43 
49  class HAZELCAST_API SerializationConfig {
50  public:
51 
57 
64  int getPortableVersion() const;
65 
71  SerializationConfig& setPortableVersion(int portableVersion);
72 
77  std::vector<boost::shared_ptr<serialization::SerializerBase> > const &getSerializers() const;
78 
87  SerializationConfig& registerSerializer(boost::shared_ptr<serialization::SerializerBase> serializer);
88 
89 
96  SerializationConfig& registerSerializer(boost::shared_ptr<serialization::StreamSerializer> serializer);
97 
104  SerializationConfig &addDataSerializableFactory(int32_t factoryId,
105  boost::shared_ptr<serialization::DataSerializableFactory> dataSerializableFactory);
106 
114  addPortableFactory(int32_t factoryId, boost::shared_ptr<serialization::PortableFactory> portableFactory);
115 
116  const std::map<int32_t, boost::shared_ptr<serialization::DataSerializableFactory> > &
117  getDataSerializableFactories() const;
118 
119  const std::map<int32_t, boost::shared_ptr<serialization::PortableFactory> > &getPortableFactories() const;
120 
128  setGlobalSerializer(const boost::shared_ptr<serialization::StreamSerializer> &serializer);
129 
134  const boost::shared_ptr<serialization::StreamSerializer> &getGlobalSerializer() const;
135 
136  private:
137  int version;
138  std::vector<boost::shared_ptr<serialization::SerializerBase> > serializers;
139  std::map<int32_t, boost::shared_ptr<serialization::DataSerializableFactory> > dataSerializableFactories;
140  std::map<int32_t, boost::shared_ptr<serialization::PortableFactory> > portableFactories;
141  boost::shared_ptr<serialization::StreamSerializer> globalSerializer;
142  };
143  }
144 }
145 
146 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
147 #pragma warning(pop)
148 #endif
149 
150 #endif //HAZELCAST_SerializationConfig
SerializationConfig is used to.
Definition: SerializationConfig.h:49
Definition: MapEntryView.h:32