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 impl::DataArrayImpl<V>(map.getData(serializationService.toData<K>(&key)), serializationService));
67 bool remove(
const K &key,
const V &value) {
68 return map.remove(key, value);
78 std::auto_ptr<DataArray<V> >
remove(
const K &key) {
79 return std::auto_ptr<DataArray<V> >(
new impl::DataArrayImpl<V>(map.removeData(serializationService.toData<K>(&key)), serializationService));
88 std::auto_ptr<DataArray<K> >
keySet() {
89 return std::auto_ptr<DataArray<K> >(
new impl::DataArrayImpl<K>(map.keySetData(), serializationService));
98 std::auto_ptr<DataArray<V> >
values() {
99 return std::auto_ptr<DataArray<V> >(
new impl::DataArrayImpl<V>(map.valuesData(), serializationService));
109 return std::auto_ptr<EntryArray<K, V> >(
new impl::EntryArrayImpl<K, V>(map.entrySetData(), serializationService)) ;
119 return map.containsKey(key);
129 return map.containsValue(value);
140 return map.containsEntry(key, value);
167 return map.valueCount(key);
185 return map.addEntryListener(listener, includeValue);
205 return map.addEntryListener(listener, key, includeValue);
217 return map.removeEntryListener(registrationId);
255 void lock(
const K &key,
long leaseTimeInMillis) {
256 map.lock(key, leaseTimeInMillis);
267 return map.isLocked(key);
280 return map.tryLock(key);
299 bool tryLock(
const K &key,
long timeoutInMillis) {
300 return map.tryLock(key, timeoutInMillis);
321 map.forceUnlock(key);
326 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:204
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:235
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: RawPointerMultiMap.h:266
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: RawPointerMultiMap.h:320
bool tryLock(const K &key, long timeoutInMillis)
Tries to acquire the lock for the specified key.
Definition: RawPointerMultiMap.h:299
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:310
std::auto_ptr< DataArray< K > > keySet()
Returns the set of keys in the multimap.
Definition: RawPointerMultiMap.h:88
int size()
Returns the number of key-value pairs in the multimap.
Definition: RawPointerMultiMap.h:148
void clear()
Clears the multimap.
Definition: RawPointerMultiMap.h:155
bool containsEntry(const K &key, const V &value)
Returns whether the multimap contains the given key-value pair.
Definition: RawPointerMultiMap.h:139
std::string addEntryListener(EntryListener< K, V > &listener, bool includeValue)
Adds an entry listener for this multimap.
Definition: RawPointerMultiMap.h:184
std::auto_ptr< EntryArray< K, V > > entrySet()
Returns the set of key-value pairs in the multimap.
Definition: RawPointerMultiMap.h:108
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:128
std::auto_ptr< DataArray< V > > values()
Returns the multimap of values in the multimap.
Definition: RawPointerMultiMap.h:98
int valueCount(const K &key)
Returns number of values matching to given key in the multimap.
Definition: RawPointerMultiMap.h:166
void lock(const K &key, long leaseTimeInMillis)
Acquires the lock for the specified key for the specified lease time.
Definition: RawPointerMultiMap.h:255
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:279
bool removeEntryListener(const std::string ®istrationId)
Removes the specified entry listener Returns silently if there is no such listener added before...
Definition: RawPointerMultiMap.h:216
bool containsKey(const K &key)
Returns whether the multimap contains an entry with the key.
Definition: RawPointerMultiMap.h:118