Hazelcast C++ Client
RawPointerTransactionalMultiMap.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 //
17 // Created by ihsan demir on 24/3/16.
18 
19 #ifndef HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERTRANSACTIONALMULTIMAP_H_
20 #define HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERTRANSACTIONALMULTIMAP_H_
21 
22 #include "hazelcast/client/TransactionalMultiMap.h"
23 #include "hazelcast/client/impl/DataArrayImpl.h"
24 
25 namespace hazelcast {
26  namespace client {
27  namespace adaptor {
36  template<typename K, typename V>
38  public:
39  RawPointerTransactionalMultiMap(TransactionalMultiMap<K, V> &m) : map(m), serializationService(
40  m.context->getSerializationService()) {
41  }
42 
48  bool put(const K &key, const V &value) {
49  return map.put(key, value);
50  };
51 
57  std::auto_ptr<DataArray<K> > get(const K &key) {
58  return std::auto_ptr<DataArray<K> >(new hazelcast::client::impl::DataArrayImpl<K>(map.getData(serializationService.toData<K>(&key)), serializationService));
59  };
60 
66  bool remove(const K &key, const V &value) {
67  return map.remove(key, value);
68  };
69 
75  std::auto_ptr<DataArray<V> > remove(const K &key) {
76  return std::auto_ptr<DataArray<V> >(new hazelcast::client::impl::DataArrayImpl<V>(map.removeData(serializationService.toData<K>(&key)), serializationService));
77  };
78 
79 
85  int valueCount(const K &key) {
86  return map.valueCount(key);
87  }
88 
94  int size() {
95  return map.size();
96  }
97 
98  private :
100  serialization::pimpl::SerializationService &serializationService;
101  };
102  }
103  }
104 }
105 
106 #endif //HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERTRANSACTIONALMULTIMAP_H_
107 
int size()
Transactional implementation of Multimap::size().
Definition: RawPointerTransactionalMultiMap.h:94
Transactional implementation of MultiMap.
Definition: RawPointerTransactionalMultiMap.h:37
Transactional implementation of MultiMap.
Definition: TransactionalMultiMap.h:40
bool put(const K &key, const V &value)
Transactional implementation of Multimap::put(key , value).
Definition: RawPointerTransactionalMultiMap.h:48
int valueCount(const K &key)
Transactional implementation of Multimap::valueCount(key).
Definition: RawPointerTransactionalMultiMap.h:85
Definition: MapEntryView.h:32