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 "hazelcast/client/spi/ClientContext.h"
20 #include "hazelcast/client/serialization/pimpl/Data.h"
21 #include "hazelcast/client/proxy/ProxyImpl.h"
22 #include <string>
23 #include <stdint.h>
24 
25 namespace hazelcast {
26  namespace client {
27  namespace spi {
28  class ClientContext;
29  }
30 
37  class HAZELCAST_API IAtomicLong : public proxy::ProxyImpl {
38  friend class impl::HazelcastClientInstanceImpl;
39 
40  friend class IdGenerator;
41 
42  public:
43 
50  int64_t addAndGet(int64_t delta);
51 
61  bool compareAndSet(int64_t expect, int64_t update);
62 
68  int64_t decrementAndGet();
69 
75  int64_t get();
76 
83  int64_t getAndAdd(int64_t delta);
84 
91  int64_t getAndSet(int64_t newValue);
92 
98  int64_t incrementAndGet();
99 
105  int64_t getAndIncrement();
106 
112  void set(int64_t newValue);
113 
114  private:
115 
116  IAtomicLong(const std::string& objectName, spi::ClientContext *context);
117 
118  int partitionId;
119  };
120  }
121 }
122 
123 #endif /* HAZELCAST_ATOMIC_NUMBER */
Cluster-wide unique id generator.
Definition: IdGenerator.h:42
IAtomicLong is a distributed atomic long implementation.
Definition: IAtomicLong.h:37
Definition: MapEntryView.h:32