Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
IAtomicLong.h
1 /*
2  * Copyright (c) 2008-2015, 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 
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  long addAndGet(long delta);
52 
62  bool compareAndSet(long expect, long update);
63 
69  long decrementAndGet();
70 
76  long get();
77 
84  long getAndAdd(long delta);
85 
92  long getAndSet(long newValue);
93 
99  long incrementAndGet();
100 
106  long getAndIncrement();
107 
113  void set(long 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:412