16 #ifndef HAZELCAST_IMAP 
   17 #define HAZELCAST_IMAP 
   25 #include "hazelcast/client/protocol/codec/MapAddEntryListenerWithPredicateCodec.h" 
   26 #include "hazelcast/client/impl/EntryArrayImpl.h" 
   27 #include "hazelcast/client/proxy/IMapImpl.h" 
   28 #include "hazelcast/client/impl/EntryEventHandler.h" 
   29 #include "hazelcast/client/EntryListener.h" 
   30 #include "hazelcast/client/EntryView.h" 
   31 #include "hazelcast/client/map/ClientMapProxy.h" 
   32 #include "hazelcast/client/Future.h" 
   34 #if  defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 
   36 #pragma warning(disable: 4251) //for dll export 
   41         class HazelcastClient;
 
   44             template<
typename K, 
typename V>
 
   65         template<
typename K, 
typename V>
 
   67             friend class spi::ProxyManager;
 
   72             static const std::string SERVICE_NAME;
 
   81                 return mapImpl->containsKey(key);
 
   91                 return mapImpl->containsValue(value);
 
  101             boost::shared_ptr<V> 
get(
const K &key) {
 
  102                 return mapImpl->get(key);
 
  113             boost::shared_ptr<V> 
put(
const K &key, 
const V &value) {
 
  114                 return mapImpl->put(key, value);
 
  128             boost::shared_ptr<V> 
put(
const K &key, 
const V &value, 
long ttlInMillis) {
 
  129                 return mapImpl->put(key, value, ttlInMillis);
 
  139             boost::shared_ptr<V> 
remove(
const K &key) {
 
  140                 return mapImpl->remove(key);
 
  150             bool remove(
const K &key, 
const V &value) {
 
  151                 return mapImpl->remove(key, value);
 
  161                 mapImpl->deleteEntry(key);
 
  183                 return mapImpl->tryRemove(key, timeoutInMillis);
 
  198             bool tryPut(
const K &key, 
const V &value, 
long timeoutInMillis) {
 
  199                 return mapImpl->tryPut(key, value, timeoutInMillis);
 
  212                 mapImpl->putTransient(key, value, ttlInMillis);
 
  224                 return mapImpl->putIfAbsent(key, value);
 
  238             boost::shared_ptr<V> 
putIfAbsent(
const K &key, 
const V &value, 
long ttlInMillis) {
 
  239                 return mapImpl->putIfAbsent(key, value, ttlInMillis);
 
  249             bool replace(
const K &key, 
const V &oldValue, 
const V &newValue) {
 
  250                 return mapImpl->replace(key, oldValue, newValue);
 
  260             boost::shared_ptr<V> 
replace(
const K &key, 
const V &value) {
 
  261                 return mapImpl->replace(key, value);
 
  300             void lock(
const K &key, 
long leaseTime) {
 
  301                 mapImpl->lock(key, leaseTime);
 
  313                 return mapImpl->isLocked(key);
 
  326                 return mapImpl->tryLock(key);
 
  345             bool tryLock(
const K &key, 
long timeInMillis) {
 
  346                 return mapImpl->tryLock(key, timeInMillis);
 
  363                 mapImpl->unlock(key);
 
  375                 mapImpl->forceUnlock(key);
 
  389             template<
typename MapInterceptor>
 
  391                 return mapImpl->template addInterceptor<MapInterceptor>(interceptor);
 
  401                 mapImpl->removeInterceptor(
id);
 
  419                 return mapImpl->addEntryListener(listener, includeValue);
 
  439                 return mapImpl->addEntryListener(listener, predicate, includeValue);
 
  452                 return mapImpl->removeEntryListener(registrationId);
 
  470                 return mapImpl->addEntryListener(listener, key, includeValue);
 
  482                 return mapImpl->getEntryView(key);
 
  496                 return mapImpl->evict(key);
 
  520             std::map<K, V> 
getAll(
const std::set<K> &keys) {
 
  521                 return mapImpl->getAll(keys);
 
  532                 return mapImpl->keySet();
 
  548                 return mapImpl->keySet(predicate);
 
  563                 return mapImpl->keySet(predicate);
 
  578                 return mapImpl->keySet(predicate);
 
  589                 return mapImpl->values();
 
  603                 return mapImpl->values(predicate);
 
  615                 return mapImpl->values(predicate);
 
  628                 return mapImpl->values(predicate);
 
  639                 return mapImpl->entrySet();
 
  655                 return mapImpl->entrySet(predicate);
 
  669                 return mapImpl->entrySet(predicate);
 
  683                 return mapImpl->entrySet(predicate);
 
  718             void addIndex(
const std::string &attribute, 
bool ordered) {
 
  719                 mapImpl->addIndex(attribute, ordered);
 
  736             template<
typename ResultType, 
typename EntryProcessor>
 
  737             boost::shared_ptr<ResultType> 
executeOnKey(
const K &key, EntryProcessor &entryProcessor) {
 
  738                 return mapImpl->template executeOnKey<ResultType, EntryProcessor>(key, entryProcessor);
 
  753             template<
typename ResultType, 
typename EntryProcessor>
 
  754             std::map<K, boost::shared_ptr<ResultType> >
 
  756                 return mapImpl->template executeOnKeys<ResultType, EntryProcessor>(keys, entryProcessor);
 
  768             template<
typename ResultType, 
typename EntryProcessor>
 
  770                 return mapImpl->template submitToKey<ResultType, EntryProcessor>(key, entryProcessor);
 
  786             template<
typename ResultType, 
typename EntryProcessor>
 
  787             std::map<K, boost::shared_ptr<ResultType> > 
executeOnEntries(EntryProcessor &entryProcessor) {
 
  788                 return mapImpl->template executeOnEntries<ResultType, EntryProcessor>(entryProcessor);
 
  808             template<
typename ResultType, 
typename EntryProcessor>
 
  809             std::map<K, boost::shared_ptr<ResultType> > 
executeOnEntries(EntryProcessor &entryProcessor,
 
  811                 return mapImpl->template executeOnEntries<ResultType, EntryProcessor>(entryProcessor, predicate);
 
  828             template<
typename ResultType, 
typename EntryProcessor>
 
  829             std::map<K, boost::shared_ptr<ResultType> >
 
  831                 return mapImpl->template executeOnEntries<ResultType, EntryProcessor>(entryProcessor, predicate);
 
  841             void set(
const K &key, 
const V &value) {
 
  842                 mapImpl->set(key, value);
 
  854             void set(
const K &key, 
const V &value, 
long ttl) {
 
  855                 mapImpl->set(key, value, ttl);
 
  866                 return mapImpl->size();
 
  875                 return mapImpl->isEmpty();
 
  889             void putAll(
const std::map<K, V> &entries) {
 
  890                 return mapImpl->putAll(entries);
 
  922                 return mapImpl->getLocalMapStats();
 
  925             IMap(boost::shared_ptr<spi::ClientProxy> clientProxy) {
 
  926                 mapImpl = boost::static_pointer_cast<map::ClientMapProxy<K, V> >(clientProxy);
 
  929             boost::shared_ptr<map::ClientMapProxy<K, V> > mapImpl;
 
  932         template <
typename K, 
typename V>
 
  933         const std::string IMap<K, V>::SERVICE_NAME = 
"hz:impl:mapService";
 
  937 #if  defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 
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:211
 
std::vector< std::pair< K, V > > entrySet()
Returns a std::vector< std::pair<K, V> > clone of the mappings contained in this map. 
Definition: IMap.h:638
 
boost::shared_ptr< V > 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:238
 
std::map< K, V > getAll(const std::set< K > &keys)
Returns the entries for the given keys. 
Definition: IMap.h:520
 
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:889
 
void destroy()
Destroys this object cluster-wide. 
Definition: IMap.h:905
 
boost::shared_ptr< V > replace(const K &key, const V &value)
Replaces the entry for a key only if currently mapped to some value. 
Definition: IMap.h:260
 
bool tryLock(const K &key)
Tries to acquire the lock for the specified key. 
Definition: IMap.h:325
 
Map Entry listener to get notified when a map entry is added, removed, updated or evicted...
Definition: EntryListener.h:45
 
bool tryLock(const K &key, long timeInMillis)
Tries to acquire the lock for the specified key. 
Definition: IMap.h:345
 
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:198
 
void set(const K &key, const V &value)
Puts an entry into this map. 
Definition: IMap.h:841
 
std::vector< V > values(const query::Predicate &predicate)
Returns a vector clone of the values contained in this map. 
Definition: IMap.h:614
 
std::vector< V > values()
Returns a vector clone of the values contained in this map. 
Definition: IMap.h:588
 
void deleteEntry(const K &key)
removes entry from map. 
Definition: IMap.h:160
 
void evictAll()
Evicts all keys from this map except locked ones. 
Definition: IMap.h:510
 
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries(EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map. 
Definition: IMap.h:787
 
std::string addEntryListener(EntryListener< K, V > &listener, bool includeValue)
Adds an entry listener for this map. 
Definition: IMap.h:418
 
std::vector< K > keySet()
Returns a vector clone of the keys contained in this map. 
Definition: IMap.h:531
 
Definition: LocalMapStats.h:31
 
void set(const K &key, const V &value, long ttl)
Puts an entry into this map. 
Definition: IMap.h:854
 
std::string addEntryListener(EntryListener< K, V > &listener, const K &key, bool includeValue)
Adds the specified entry listener for the specified key. 
Definition: IMap.h:469
 
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:682
 
bool replace(const K &key, const V &oldValue, const V &newValue)
Replaces the entry for a key only if currently mapped to a given value. 
Definition: IMap.h:249
 
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries(EntryProcessor &entryProcessor, const query::Predicate &predicate)
Applies the user defined EntryProcessor to the all entries in the map. 
Definition: IMap.h:830
 
boost::shared_ptr< V > 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:223
 
Classes that will be used with hazelcast data structures like IMap, IQueue etc should either inherit ...
Definition: IdentifiedDataSerializable.h:42
 
NOTE: PagingPredicate can only be used with values(), keySet() and entries() methods!!! ...
Definition: PagingPredicate.h:127
 
Future< ResultType > submitToKey(const K &key, EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key. 
Definition: IMap.h:769
 
void addIndex(const std::string &attribute, bool ordered)
Adds an index to this map for the specified entries so that queries can run faster. 
Definition: IMap.h:718
 
bool isLocked(const K &key)
Checks the lock for the specified key. 
Definition: IMap.h:312
 
std::vector< K > keySet(const query::Predicate &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries...
Definition: IMap.h:562
 
boost::shared_ptr< V > 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:128
 
void flush()
If this map has a MapStore this method flushes all the local dirty entries by calling MapStore...
Definition: IMap.h:168
 
std::string addInterceptor(MapInterceptor &interceptor)
Adds an interceptor for this map. 
Definition: IMap.h:390
 
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries(EntryProcessor &entryProcessor, const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:809
 
Adaptor class to IMap which provides releasable raw pointers for returned objects. 
Definition: RawPointerMap.h:51
 
void lock(const K &key)
Acquires the lock for the specified key. 
Definition: IMap.h:278
 
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:182
 
void lock(const K &key, long leaseTime)
Acquires the lock for the specified key for the specified lease time. 
Definition: IMap.h:300
 
void removeInterceptor(const std::string &id)
Removes the given interceptor for this map. 
Definition: IMap.h:400
 
std::string addEntryListener(EntryListener< K, V > &listener, const query::Predicate &predicate, bool includeValue)
Adds an entry listener for this map. 
Definition: IMap.h:438
 
This is a unique Future. 
Definition: Future.h:111
 
This is a merker class for Predicate classes. 
Definition: Predicate.h:36
 
std::vector< std::pair< K, V > > entrySet(const query::Predicate &predicate)
Queries the map based on the specified predicate and returns the matching entries. 
Definition: IMap.h:668
 
EntryView represents a readonly view of a map entry. 
Definition: EntryView.h:39
 
std::vector< K > keySet(const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:547
 
Concurrent, distributed, observable and queryable map client. 
Definition: IMap.h:66
 
bool isEmpty()
Returns true if this map contains no key-value mappings. 
Definition: IMap.h:874
 
void unlock(const K &key)
Releases the lock for the specified key. 
Definition: IMap.h:362
 
std::map< K, boost::shared_ptr< ResultType > > executeOnKeys(const std::set< K > &keys, EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entries mapped by the collection of keys...
Definition: IMap.h:755
 
bool evict(const K &key)
Evicts the specified key from this map. 
Definition: IMap.h:495
 
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner. 
Definition: IMap.h:374
 
monitor::LocalMapStats & getLocalMapStats()
Returns LocalMapStats for this map. 
Definition: IMap.h:921
 
std::vector< V > values(const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:602
 
void clear()
Removes all of the mappings from this map (optional operation). 
Definition: IMap.h:897
 
std::vector< V > values(query::PagingPredicate< K, V > &predicate)
Returns a vector clone of the values contained in this map. 
Definition: IMap.h:627
 
boost::shared_ptr< V > put(const K &key, const V &value)
put new entry into map. 
Definition: IMap.h:113
 
EntryView< K, V > getEntryView(const K &key)
Returns the EntryView for the specified key. 
Definition: IMap.h:481
 
bool containsValue(const V &value)
check if this map contains value. 
Definition: IMap.h:90
 
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:577
 
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:459
 
bool containsKey(const K &key)
check if this map contains key. 
Definition: IMap.h:80
 
std::vector< std::pair< K, V > > entrySet(const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:654
 
bool removeEntryListener(const std::string ®istrationId)
Removes the specified entry listener Returns silently if there is no such listener added before...
Definition: IMap.h:451
 
int size()
Returns the number of key-value mappings in this map. 
Definition: IMap.h:865
 
boost::shared_ptr< ResultType > executeOnKey(const K &key, EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key. 
Definition: IMap.h:737