Hazelcast C++ Client
IAtomicLong.h
1 /*
2  * Copyright (c) 2008-2018, 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_ATOMIC_NUMBER
17 #define HAZELCAST_ATOMIC_NUMBER
18 
19 #include <string>
20 #include <stdint.h>
21 
22 #include "hazelcast/client/spi/ClientContext.h"
23 #include "hazelcast/client/serialization/pimpl/Data.h"
24 #include "hazelcast/client/proxy/ProxyImpl.h"
25 
26 namespace hazelcast {
27  namespace client {
28  namespace spi {
29  class ClientContext;
30  }
31 
32  namespace proxy {
33  class ClientIdGeneratorProxy;
34  }
35 
42  class HAZELCAST_API IAtomicLong : public proxy::ProxyImpl {
43  friend class impl::HazelcastClientInstanceImpl;
44  friend class proxy::ClientIdGeneratorProxy;
45 
46  public:
47 
54  int64_t addAndGet(int64_t delta);
55 
65  bool compareAndSet(int64_t expect, int64_t update);
66 
72  int64_t decrementAndGet();
73 
79  int64_t get();
80 
87  int64_t getAndAdd(int64_t delta);
88 
95  int64_t getAndSet(int64_t newValue);
96 
102  int64_t incrementAndGet();
103 
109  int64_t getAndIncrement();
110 
116  void set(int64_t newValue);
117 
118  private:
119 
120  IAtomicLong(const std::string& objectName, spi::ClientContext *context);
121 
122  int partitionId;
123  };
124  }
125 }
126 
127 #endif /* HAZELCAST_ATOMIC_NUMBER */
IAtomicLong is a distributed atomic long implementation.
Definition: IAtomicLong.h:42
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32