16 #ifndef HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERMULTIMAP_H_
17 #define HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERMULTIMAP_H_
19 #include "hazelcast/client/MultiMap.h"
20 #include "hazelcast/client/impl/DataArrayImpl.h"
21 #include "hazelcast/client/impl/EntryArrayImpl.h"
31 template<
typename K,
typename V>
46 bool put(
const K &key,
const V &value) {
47 return map.put(key, value);
56 std::auto_ptr<DataArray<V> >
get(
const K &key) {
57 return std::auto_ptr<DataArray<V> >(
new hazelcast::client::impl::DataArrayImpl<V>(
58 map.getData(serializationService.toData<K>(&key)), serializationService));
68 bool remove(
const K &key,
const V &value) {
69 return map.remove(key, value);
79 std::auto_ptr<DataArray<V> >
remove(
const K &key) {
80 return std::auto_ptr<DataArray<V> >(
new hazelcast::client::impl::DataArrayImpl<V>(
81 map.removeData(serializationService.toData<K>(&key)), serializationService));
90 std::auto_ptr<DataArray<K> >
keySet() {
91 return std::auto_ptr<DataArray<K> >(
new hazelcast::client::impl::DataArrayImpl<K>(
92 map.keySetData(), serializationService));
102 return std::auto_ptr<DataArray<V> >(
new hazelcast::client::impl::DataArrayImpl<V>(
103 map.valuesData(), serializationService));
113 return std::auto_ptr<EntryArray<K, V> >(
new hazelcast::client::impl::EntryArrayImpl<K, V>(
114 map.entrySetData(), serializationService)) ;
124 return map.containsKey(key);
134 return map.containsValue(value);
145 return map.containsEntry(key, value);
172 return map.valueCount(key);
190 return map.addEntryListener(listener, includeValue);
210 return map.addEntryListener(listener, key, includeValue);
222 return map.removeEntryListener(registrationId);
260 void lock(
const K &key,
long leaseTimeInMillis) {
261 map.lock(key, leaseTimeInMillis);
272 return map.isLocked(key);
285 return map.tryLock(key);
304 bool tryLock(
const K &key,
long timeoutInMillis) {
305 return map.tryLock(key, timeoutInMillis);
326 map.forceUnlock(key);
331 serialization::pimpl::SerializationService &serializationService;
std::string addEntryListener(EntryListener< K, V > &listener, const K &key, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: RawPointerMultiMap.h:209
Map Entry listener to get notified when a map entry is added, removed, updated or evicted...
Definition: EntryListener.h:45
void lock(const K &key)
Acquires the lock for the specified key.
Definition: RawPointerMultiMap.h:240
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: RawPointerMultiMap.h:271
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: RawPointerMultiMap.h:325
bool tryLock(const K &key, long timeoutInMillis)
Tries to acquire the lock for the specified key.
Definition: RawPointerMultiMap.h:304
A specialized distributed map client whose keys can be associated with multiple values.
Definition: MultiMap.h:41
void unlock(const K &key)
Releases the lock for the specified key.
Definition: RawPointerMultiMap.h:315
std::auto_ptr< DataArray< K > > keySet()
Returns the set of keys in the multimap.
Definition: RawPointerMultiMap.h:90
int size()
Returns the number of key-value pairs in the multimap.
Definition: RawPointerMultiMap.h:153
void clear()
Clears the multimap.
Definition: RawPointerMultiMap.h:160
bool containsEntry(const K &key, const V &value)
Returns whether the multimap contains the given key-value pair.
Definition: RawPointerMultiMap.h:144
std::string addEntryListener(EntryListener< K, V > &listener, bool includeValue)
Adds an entry listener for this multimap.
Definition: RawPointerMultiMap.h:189
std::auto_ptr< EntryArray< K, V > > entrySet()
Returns the set of key-value pairs in the multimap.
Definition: RawPointerMultiMap.h:112
bool put(const K &key, const V &value)
Stores a key-value pair in the multimap.
Definition: RawPointerMultiMap.h:46
bool containsValue(const V &value)
Returns whether the multimap contains an entry with the value.
Definition: RawPointerMultiMap.h:133
std::auto_ptr< DataArray< V > > values()
Returns the multimap of values in the multimap.
Definition: RawPointerMultiMap.h:101
int valueCount(const K &key)
Returns number of values matching to given key in the multimap.
Definition: RawPointerMultiMap.h:171
void lock(const K &key, long leaseTimeInMillis)
Acquires the lock for the specified key for the specified lease time.
Definition: RawPointerMultiMap.h:260
A specialized distributed map client whose keys can be associated with multiple values.
Definition: RawPointerMultiMap.h:32
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: RawPointerMultiMap.h:284
bool removeEntryListener(const std::string ®istrationId)
Removes the specified entry listener Returns silently if there is no such listener added before...
Definition: RawPointerMultiMap.h:221
bool containsKey(const K &key)
Returns whether the multimap contains an entry with the key.
Definition: RawPointerMultiMap.h:123