Hazelcast C++ Client
IAtomicLong.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_IATOMICLONG_H_
17 #define HAZELCAST_CLIENT_IATOMICLONG_H_
18 
19 #include <boost/shared_ptr.hpp>
20 
21 #include "hazelcast/client/impl/AtomicLongInterface.h"
22 
23 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
24 #pragma warning(push)
25 #pragma warning(disable: 4251) //for dll export
26 #endif
27 
28 namespace hazelcast {
29  namespace client {
30  namespace impl {
31  class HazelcastClientInstanceImpl;
32  }
33 
55  class HAZELCAST_API IAtomicLong : public impl::AtomicLongInterface {
56  friend class impl::HazelcastClientInstanceImpl;
57  public:
64  int64_t addAndGet(int64_t delta);
65 
75  bool compareAndSet(int64_t expect, int64_t update);
76 
82  int64_t decrementAndGet();
83 
89  int64_t get();
90 
97  int64_t getAndAdd(int64_t delta);
98 
105  int64_t getAndSet(int64_t newValue);
106 
112  int64_t incrementAndGet();
113 
119  int64_t getAndIncrement();
120 
126  void set(int64_t newValue);
127 
128  virtual const std::string &getServiceName() const;
129 
130  virtual const std::string &getName() const;
131 
132  virtual void destroy();
133 
158  boost::shared_ptr<ICompletableFuture<int64_t> > addAndGetAsync(int64_t delta);
159 
173  boost::shared_ptr<ICompletableFuture<bool> > compareAndSetAsync(int64_t expect, int64_t update);
174 
184  boost::shared_ptr<ICompletableFuture<int64_t> > decrementAndGetAsync();
185 
193  boost::shared_ptr<ICompletableFuture<int64_t> > getAsync();
194 
205  boost::shared_ptr<ICompletableFuture<int64_t> > getAndAddAsync(int64_t delta);
206 
217  boost::shared_ptr<ICompletableFuture<int64_t> > getAndSetAsync(int64_t newValue);
218 
228  boost::shared_ptr<ICompletableFuture<int64_t> > incrementAndGetAsync();
229 
239  boost::shared_ptr<ICompletableFuture<int64_t> > getAndIncrementAsync();
240 
251  boost::shared_ptr<ICompletableFuture<void> > setAsync(int64_t newValue);
252 
253  private:
254  IAtomicLong(const boost::shared_ptr<impl::AtomicLongInterface> &impl);
255 
256  boost::shared_ptr<impl::AtomicLongInterface> impl;
257  };
258  }
259 }
260 
261 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
262 #pragma warning(pop)
263 #endif
264 
265 #endif /* HAZELCAST_CLIENT_IATOMICLONG_H_ */
IAtomicLong is a redundant and highly available distributed alternative to the java.util.concurrent.atomic.AtomicLong.
Definition: IAtomicLong.h:55
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32