Hazelcast C++ Client
TransactionalMultiMap.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 //
17 // Created by sancar koyunlu on 8/6/13.
18 
19 #ifndef HAZELCAST_TransactionalMultiMap
20 #define HAZELCAST_TransactionalMultiMap
21 
22 #include "hazelcast/client/proxy/TransactionalMultiMapImpl.h"
23 
24 namespace hazelcast {
25  namespace client {
26  namespace adaptor {
27  template<typename K, typename V>
28  class RawPointerTransactionalMultiMap;
29  }
30 
39  template<typename K, typename V>
40  class TransactionalMultiMap : public proxy::TransactionalMultiMapImpl {
41  friend class TransactionContext;
43 
44  public:
50  bool put(const K& key, const V& value) {
51  return proxy::TransactionalMultiMapImpl::put(toData(&key), toData(&value));
52  };
53 
59  std::vector<V> get(const K& key) {
60  return toObjectCollection<V>(proxy::TransactionalMultiMapImpl::getData(toData(&key)));
61  };
62 
68  bool remove(const K& key, const V& value) {
69  return proxy::TransactionalMultiMapImpl::remove(toData(&key), toData(&value));
70  };
71 
77  std::vector<V> remove(const K& key) {
78  return toObjectCollection<V>(proxy::TransactionalMultiMapImpl::removeData(toData(&key)));
79  };
80 
81 
87  int valueCount(const K& key) {
88  return proxy::TransactionalMultiMapImpl::valueCount(toData(&key));
89  }
90 
96  int size() {
97  return proxy::TransactionalMultiMapImpl::size();
98  }
99 
100  private :
101  TransactionalMultiMap(const std::string& name, txn::TransactionProxy *transactionProxy)
102  : proxy::TransactionalMultiMapImpl(name, transactionProxy) {
103 
104  }
105  };
106  }
107 }
108 
109 
110 #endif //HAZELCAST_TransactionalMultiMap
111 
Transactional implementation of MultiMap.
Definition: RawPointerTransactionalMultiMap.h:37
Transactional implementation of MultiMap.
Definition: TransactionalMultiMap.h:40
int size()
Transactional implementation of Multimap::size().
Definition: TransactionalMultiMap.h:96
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
bool put(const K &key, const V &value)
Transactional implementation of Multimap::put(key , value).
Definition: TransactionalMultiMap.h:50
int valueCount(const K &key)
Transactional implementation of Multimap::valueCount(key).
Definition: TransactionalMultiMap.h:87
Provides a context to do transactional operations; so beginning/committing transactions, but also retrieving transactional data-structures like the TransactionalMap.
Definition: TransactionContext.h:54