Hazelcast C++ Client
HazelcastClient.h
1 /*
2  * Copyright (c) 2008-2018, 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 #ifndef HAZELCAST_CLIENT
17 #define HAZELCAST_CLIENT
18 
19 #include <hazelcast/client/impl/HazelcastClientInstanceImpl.h>
20 
21 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
22 #pragma warning(push)
23 #pragma warning(disable: 4251) //for dll export
24 #endif
25 
26 namespace hazelcast {
27  namespace client {
394  class HAZELCAST_API HazelcastClient {
395  friend class spi::ClientContext;
396  public:
402  HazelcastClient(ClientConfig &config);
403 
409  const std::string &getName() const;
410 
417  template<typename T>
418  T getDistributedObject(const std::string& name) {
419  return clientImpl->getDistributedObject<T>(name);
420  }
421 
431  template<typename K, typename V>
432  IMap<K, V> getMap(const std::string &name) {
433  return clientImpl->getMap<K, V>(name);
434  }
435 
442  template<typename K, typename V>
443  MultiMap<K, V> getMultiMap(const std::string& name) {
444  return clientImpl->getMultiMap<K, V>(name);
445  }
446 
453  template<typename E>
454  IQueue<E> getQueue(const std::string& name) {
455  return clientImpl->getQueue<E>(name);
456  }
457 
466  template<typename E>
467  ISet<E> getSet(const std::string& name) {
468  return clientImpl->getSet<E>(name);
469  }
470 
478  template<typename E>
479  IList<E> getList(const std::string& name) {
480  return clientImpl->getList<E>(name);
481  }
482 
489  template<typename E>
490  ITopic<E> getTopic(const std::string& name) {
491  return clientImpl->getTopic<E>(name);
492  };
493 
500  template<typename E>
501  boost::shared_ptr<ReliableTopic<E> > getReliableTopic(const std::string& name) {
502  return clientImpl->getReliableTopic<E>(name);
503  }
504 
513  IdGenerator getIdGenerator(const std::string& name);
514 
522  IAtomicLong getIAtomicLong(const std::string& name);
523 
532  ICountDownLatch getICountDownLatch(const std::string& name);
533 
558  ILock getILock(const std::string& name);
559 
566  template <typename E>
567  boost::shared_ptr<Ringbuffer<E> > getRingbuffer(const std::string& name) {
568  return clientImpl->getRingbuffer<E>(name);
569  }
570 
578  ISemaphore getISemaphore(const std::string& name);
579 
584  ClientConfig& getClientConfig();
585 
591  TransactionContext newTransactionContext();
592 
599  TransactionContext newTransactionContext(const TransactionOptions& options);
600 
608  Cluster& getCluster();
609 
620  void addLifecycleListener(LifecycleListener *lifecycleListener);
621 
627  bool removeLifecycleListener(LifecycleListener *lifecycleListener);
628 
632  void shutdown();
633 
639  mixedtype::HazelcastClient &toMixedType() const;
640 
648  spi::LifecycleService &getLifecycleService();
649  private:
650  boost::shared_ptr<impl::HazelcastClientInstanceImpl> clientImpl;
651  };
652 
653  }
654 }
655 
656 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
657 #pragma warning(pop)
658 #endif
659 
660 #endif /* HAZELCAST_CLIENT */
Contains the configuration for a Hazelcast transaction.
Definition: TransactionOptions.h:67
Definition: HazelcastClient.h:39
Concurrent, blocking, distributed, observable, client queue.
Definition: IQueue.h:39
ITopic< E > getTopic(const std::string &name)
Returns the distributed topic instance with the specified name and entry type E.
Definition: HazelcastClient.h:490
Cluster-wide unique id generator.
Definition: IdGenerator.h:42
IQueue< E > getQueue(const std::string &name)
Returns the distributed queue instance with the specified name and entry type E.
Definition: HazelcastClient.h:454
IAtomicLong is a distributed atomic long implementation.
Definition: IAtomicLong.h:37
ICountDownLatch is a backed-up distributed alternative to the java.util.concurrent.CountDownLatch java.util.concurrent.CountDownLatch.
Definition: ICountDownLatch.h:61
MultiMap< K, V > getMultiMap(const std::string &name)
Returns the distributed multimap instance with the specified name.
Definition: HazelcastClient.h:443
boost::shared_ptr< ReliableTopic< E > > getReliableTopic(const std::string &name)
Returns the distributed topic instance with the specified name and entry type E.
Definition: HazelcastClient.h:501
IList< E > getList(const std::string &name)
Returns the distributed list instance with the specified name.
Definition: HazelcastClient.h:479
A specialized distributed map client whose keys can be associated with multiple values.
Definition: MultiMap.h:40
Re-entrant Lock, Distributed client implementation of Lock.
Definition: ILock.h:41
Concurrent, distributed , client implementation of std::list.
Definition: IList.h:42
Concurrent, distributed client implementation of std::unordered_set.
Definition: ISet.h:36
Hazelcast provides distribution mechanism for publishing messages that are delivered to multiple subs...
Definition: ITopic.h:41
boost::shared_ptr< Ringbuffer< E > > getRingbuffer(const std::string &name)
Returns the distributed Ringbuffer instance with the specified name.
Definition: HazelcastClient.h:567
Hazelcast cluster interface.
Definition: Cluster.h:40
ISet< E > getSet(const std::string &name)
Returns the distributed set instance with the specified name and entry type E.
Definition: HazelcastClient.h:467
Listener object for listening lifecycle events of hazelcast instance.
Definition: LifecycleListener.h:44
IMap< K, V > getMap(const std::string &name)
Returns the distributed map instance with the specified name.
Definition: HazelcastClient.h:432
Concurrent, distributed, observable and queryable map client.
Definition: IMap.h:66
Definition: MapEntryView.h:32
ISemaphore is a backed-up distributed alternative to the java.util.concurrent.Semaphore.
Definition: ISemaphore.h:57
HazelcastClient configuration class.
Definition: ClientConfig.h:55
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:394
Provides a context to do transactional operations; so beginning/committing transactions, but also retrieving transactional data-structures like the TransactionalMap.
Definition: TransactionContext.h:54
T getDistributedObject(const std::string &name)
Definition: HazelcastClient.h:418