Hazelcast C++ Client
 All Classes Functions Variables Enumerations Enumerator Pages
IAtomicLong.h
1 /*
2  * Copyright (c) 2008-2017, 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/spi/InvocationService.h"
21 #include "hazelcast/client/serialization/pimpl/Data.h"
22 #include "hazelcast/client/proxy/ProxyImpl.h"
23 #include <string>
24 #include <stdint.h>
25 
26 namespace hazelcast {
27  namespace client {
28  namespace spi {
29  class ClientContext;
30  }
31 
38  class HAZELCAST_API IAtomicLong : public proxy::ProxyImpl {
39  friend class HazelcastClient;
40 
41  friend class IdGenerator;
42 
43  public:
44 
51  int64_t addAndGet(int64_t delta);
52 
62  bool compareAndSet(int64_t expect, int64_t update);
63 
69  int64_t decrementAndGet();
70 
76  int64_t get();
77 
84  int64_t getAndAdd(int64_t delta);
85 
92  int64_t getAndSet(int64_t newValue);
93 
99  int64_t incrementAndGet();
100 
106  int64_t getAndIncrement();
107 
113  void set(int64_t newValue);
114 
115  private:
116 
117  IAtomicLong(const std::string& objectName, spi::ClientContext *context);
118 
119  int partitionId;
120  };
121  }
122 }
123 
124 #endif /* HAZELCAST_ATOMIC_NUMBER */
Cluster-wide unique id generator.
Definition: IdGenerator.h:42
IAtomicLong is a distributed atomic long implementation.
Definition: IAtomicLong.h:38
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:458