16 #ifndef HAZELCAST_CLIENT_MIXEDTYPE_IMAP_H_
17 #define HAZELCAST_CLIENT_MIXEDTYPE_IMAP_H_
22 #include "hazelcast/client/mixedtype/ClientMapProxy.h"
24 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26 #pragma warning(disable: 4251) //for dll export
33 class HazelcastClientImpl;
48 friend class impl::HazelcastClientImpl;
58 return mapImpl->containsKey<K>(key);
69 return mapImpl->containsValue(value);
81 return mapImpl->
get<K>(key);
92 template <
typename K,
typename V>
94 return mapImpl->put(key, value);
108 template <
typename K,
typename V>
110 return mapImpl->put<K, V>(key, value, ttlInMillis);
120 template <
typename K>
122 return mapImpl->remove<K>(key);
132 template <
typename K,
typename V>
133 bool remove(
const K &key,
const V &value) {
134 return mapImpl->remove<K, V>(key, value);
151 template <
typename K>
153 return mapImpl->deleteEntry<K>(key);
172 template <
typename K>
174 return mapImpl->tryRemove<K>(key, timeoutInMillis);
189 template <
typename K,
typename V>
190 bool tryPut(
const K &key,
const V &value,
long timeoutInMillis) {
191 return mapImpl->tryPut<K, V>(key, value, timeoutInMillis);
203 template <
typename K,
typename V>
205 return mapImpl->putTransient<K, V>(key, value, ttlInMillis);
216 template <
typename K,
typename V>
218 return mapImpl->putIfAbsent<K, V>(key, value);
232 template <
typename K,
typename V>
234 return mapImpl->putIfAbsent<K, V>(key, value, ttlInMillis);
244 template <
typename K,
typename V,
typename NEWTYPE>
245 bool replace(
const K &key,
const V &oldValue,
const NEWTYPE &newValue) {
246 return mapImpl->replace<K, V, NEWTYPE>(key, oldValue, newValue);
256 template <
typename K,
typename V>
258 return mapImpl->replace<K, V>(key, value);
268 template <
typename K,
typename V>
269 void set(
const K &key,
const V &value) {
270 return mapImpl->set<K, V>(key, value);
282 template <
typename K,
typename V>
283 void set(
const K &key,
const V &value,
long ttl) {
284 return mapImpl->set<K, V>(key, value, ttl);
301 template <
typename K>
303 return mapImpl->lock<K>(key);
324 template <
typename K>
325 void lock(
const K &key,
long leaseTime) {
326 return mapImpl->lock<K>(key, leaseTime);
337 template <
typename K>
339 return mapImpl->isLocked<K>(key);
351 template <
typename K>
353 return mapImpl->tryLock<K>(key);
372 template <
typename K>
373 bool tryLock(
const K &key,
long timeInMillis) {
374 return mapImpl->tryLock<K>(key, timeInMillis);
390 template <
typename K>
392 mapImpl->unlock<K>(key);
403 template <
typename K>
405 mapImpl->forceUnlock<K>(key);
419 template<
typename MapInterceptor>
421 return mapImpl->addInterceptor<MapInterceptor>(interceptor);
430 void removeInterceptor(
const std::string &
id);
475 bool removeEntryListener(
const std::string ®istrationId);
490 template <
typename K>
492 return mapImpl->addEntryListener<K>(key, listener, includeValue);
503 template <
typename K>
504 std::auto_ptr<EntryView<TypedData, TypedData> >
getEntryView(
const K &key) {
505 return mapImpl->getEntryView<K>(key);
518 template <
typename K>
520 return mapImpl->evict<K>(key);
542 template <
typename K>
543 std::vector<std::pair<TypedData, TypedData> >
getAll(
const std::set<K> &keys) {
544 return mapImpl->getAll<K>(keys);
554 std::vector<TypedData> keySet();
594 template <
typename K,
typename V>
596 return mapImpl->keySet<K, V>(predicate);
606 std::vector<TypedData> values();
639 template <
typename K,
typename V>
641 return mapImpl->values<K, V>(predicate);
651 std::vector<std::pair<TypedData, TypedData> > entrySet();
677 std::vector<std::pair<TypedData, TypedData> > entrySet(
const query::Predicate &predicate);
689 template <
typename K,
typename V>
691 return mapImpl->entrySet<K, V>(predicate);
726 void addIndex(
const std::string &attribute,
bool ordered);
742 template<
typename K,
typename EntryProcessor>
744 return mapImpl->executeOnKey<K, EntryProcessor>(key, entryProcessor);
747 template<
typename K,
typename EntryProcessor>
748 Future<TypedData> submitToKey(
const K &key,
const EntryProcessor &entryProcessor) {
749 return mapImpl->submitToKey<K, EntryProcessor>(key, entryProcessor);
752 template<
typename K,
typename EntryProcessor>
753 std::map<K, TypedData> executeOnKeys(
const std::set<K> &keys,
const EntryProcessor &entryProcessor) {
754 return mapImpl->executeOnKeys<K>(keys, entryProcessor);
769 template<
typename EntryProcessor>
771 return mapImpl->executeOnEntries<EntryProcessor>(entryProcessor);
788 template<
typename EntryProcessor>
789 std::map<TypedData, TypedData>
791 return mapImpl->executeOnEntries<EntryProcessor>(entryProcessor, predicate);
821 template<
typename K,
typename V>
822 void putAll(
const std::map<K, V> &entries) {
823 return mapImpl->putAll<K, V>(entries);
841 IMap(boost::shared_ptr<mixedtype::ClientMapProxy> proxy);
843 boost::shared_ptr<mixedtype::ClientMapProxy> mapImpl;
849 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: IMap.h:338
bool evict(const K &key)
Evicts the specified key from this map.
Definition: IMap.h:519
std::auto_ptr< T > get() const
Deserializes the underlying binary data and produces the object of type T.
Definition: TypedData.h:69
void set(const K &key, const V &value)
Puts an entry into this map.
Definition: IMap.h:269
bool tryRemove(const K &key, long timeoutInMillis)
Tries to remove the entry with the given key from this map within specified timeout value...
Definition: IMap.h:173
std::vector< std::pair< K, V > > entrySet(query::PagingPredicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the matching entries.
Definition: IMap.h:690
bool tryLock(const K &key, long timeInMillis)
Tries to acquire the lock for the specified key.
Definition: IMap.h:373
TypedData put(const K &key, const V &value)
put new entry into map.
Definition: IMap.h:93
bool replace(const K &key, const V &oldValue, const NEWTYPE &newValue)
Replaces the entry for a key only if currently mapped to a given value.
Definition: IMap.h:245
Definition: LocalMapStats.h:31
Definition: EntryListener.h:108
bool containsValue(const V &value)
check if this map contains value.
Definition: IMap.h:68
Classes that will be used with hazelcast data structures like IMap, IQueue etc should either inherit ...
Definition: IdentifiedDataSerializable.h:47
NOTE: PagingPredicate can only be used with values(), keySet() and entries() methods!!! ...
Definition: PagingPredicate.h:127
TypedData putIfAbsent(const K &key, const V &value, long ttlInMillis)
Puts an entry into this map with a given ttl (time to live) value if the specified key is not already...
Definition: IMap.h:233
void set(const K &key, const V &value, long ttl)
Puts an entry into this map.
Definition: IMap.h:283
void unlock(const K &key)
Releases the lock for the specified key.
Definition: IMap.h:391
void putAll(const std::map< K, V > &entries)
Copies all of the mappings from the specified map to this map (optional operation).
Definition: IMap.h:822
std::map< TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor, const query::Predicate &predicate)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: IMap.h:790
bool containsKey(const K &key)
check if this map contains key.
Definition: IMap.h:57
std::map< TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: IMap.h:770
std::vector< std::pair< TypedData, TypedData > > getAll(const std::set< K > &keys)
Returns the entries for the given keys.
Definition: IMap.h:543
This is a merker class for Predicate classes.
Definition: Predicate.h:36
std::string addInterceptor(MapInterceptor &interceptor)
Adds an interceptor for this map.
Definition: IMap.h:420
Concurrent, distributed, observable and queryable map client.
Definition: IMap.h:47
void putTransient(const K &key, const V &value, long ttlInMillis)
Same as put(K, V, long, TimeUnit) but MapStore, if defined, will not be called to store/persist the e...
Definition: IMap.h:204
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: IMap.h:404
std::vector< K > keySet(query::PagingPredicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries...
Definition: IMap.h:595
bool tryPut(const K &key, const V &value, long timeoutInMillis)
Tries to put the given key, value into this map within specified timeout value.
Definition: IMap.h:190
Definition: MapEntryView.h:32
void deleteEntry(const K &key)
removes entry from map.
Definition: IMap.h:152
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: IMap.h:352
std::auto_ptr< EntryView< TypedData, TypedData > > getEntryView(const K &key)
Returns the EntryView for the specified key.
Definition: IMap.h:504
TypedData put(const K &key, const V &value, long ttlInMillis)
Puts an entry into this map with a given ttl (time to live) value.
Definition: IMap.h:109
This specialization overwrites the get method to return TypedData.
Definition: Future.h:236
void lock(const K &key)
Acquires the lock for the specified key.
Definition: IMap.h:302
TypedData class is a wrapper class for the serialized binary data.
Definition: TypedData.h:40
TypedData putIfAbsent(const K &key, const V &value)
Puts an entry into this map, if the specified key is not already associated with a value...
Definition: IMap.h:217
TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
Definition: IMap.h:743
std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: IMap.h:491
TypedData replace(const K &key, const V &value)
Replaces the entry for a key only if currently mapped to some value.
Definition: IMap.h:257
void lock(const K &key, long leaseTime)
Acquires the lock for the specified key for the specified lease time.
Definition: IMap.h:325
std::vector< V > values(query::PagingPredicate< K, V > &predicate)
Returns a vector clone of the values contained in this map.
Definition: IMap.h:640