Hazelcast C++ Client
TypedData.h
1 /*
2  * Copyright (c) 2008-2019, 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 #ifndef HAZELCAST_CLIENT_TYPEDDATA_H_
17 #define HAZELCAST_CLIENT_TYPEDDATA_H_
18 
19 #include <memory>
20 
21 #include "hazelcast/util/HazelcastDll.h"
22 #include "hazelcast/client/serialization/pimpl/SerializationService.h"
23 
24 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
25 #pragma warning(push)
26 #pragma warning(disable: 4251) //for dll export
27 #endif
28 
29 namespace hazelcast {
30  namespace client {
31  namespace serialization {
32  namespace pimpl {
33  class Data;
34  }
35  }
40  class HAZELCAST_API TypedData {
41  public:
42  TypedData();
43 
44  TypedData(std::auto_ptr<serialization::pimpl::Data> data,
45  serialization::pimpl::SerializationService &serializationService);
46 
47  TypedData(const boost::shared_ptr<serialization::pimpl::Data> &data,
48  serialization::pimpl::SerializationService &serializationService);
49 
50  virtual ~TypedData();
51 
56  const serialization::pimpl::ObjectType getType() const;
57 
67  template <typename T>
68  std::auto_ptr<T> get() const {
69  return ss->toObject<T>(data.get());
70  }
71 
76  const boost::shared_ptr<serialization::pimpl::Data> getData() const;
77 
78  private:
79  boost::shared_ptr<serialization::pimpl::Data> data;
80  serialization::pimpl::SerializationService *ss;
81  };
82 
83  bool HAZELCAST_API operator<(const TypedData &lhs, const TypedData &rhs);
84  }
85 }
86 
87 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
88 #pragma warning(pop)
89 #endif
90 
91 #endif //HAZELCAST_CLIENT_TYPEDDATA_H_
92 
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
TypedData class is a wrapper class for the serialized binary data.
Definition: TypedData.h:40