Hazelcast C++ Client
IdGenerator.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_IDGENERATOR_H_
17 #define HAZELCAST_CLIENT_IDGENERATOR_H_
18 
19 #include <stdint.h>
20 #include <boost/shared_ptr.hpp>
21 
22 #include "hazelcast/util/HazelcastDll.h"
23 #include "hazelcast/client/impl/IdGeneratorInterface.h"
24 
25 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26 #pragma warning(push)
27 #pragma warning(disable: 4251) //for dll export
28 #endif
29 
30 namespace hazelcast {
31  namespace client {
32  namespace impl {
33  class HazelcastClientInstanceImpl;
34  }
35 
44  class HAZELCAST_API IdGenerator : public impl::IdGeneratorInterface {
45  friend class impl::HazelcastClientInstanceImpl;
46 
47  friend class FlakeIdGenerator;
48 
49  public:
50  virtual ~IdGenerator();
51 
52  virtual bool init(int64_t id);
53 
54  virtual int64_t newId();
55 
56  private:
57  IdGenerator(const boost::shared_ptr<impl::IdGeneratorInterface> &impl);
58 
59  boost::shared_ptr<impl::IdGeneratorInterface> impl;
60  };
61  }
62 }
63 
64 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
65 #pragma warning(pop)
66 #endif
67 
68 #endif /* HAZELCAST_CLIENT_IDGENERATOR_H_ */
Definition: IdGenerator.h:44
A cluster-wide unique ID generator.
Definition: FlakeIdGenerator.h:53
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32