Hazelcast C++ Client
HazelcastClient.h
1 /*
2  * Copyright (c) 2008-2019, 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:
400  HazelcastClient();
401 
407  HazelcastClient(const ClientConfig &config);
408 
414  const std::string &getName() const;
415 
422  template<typename T>
423  T getDistributedObject(const std::string& name) {
424  return clientImpl->getDistributedObject<T>(name);
425  }
426 
436  template<typename K, typename V>
437  IMap<K, V> getMap(const std::string &name) {
438  return clientImpl->getMap<K, V>(name);
439  }
440 
447  template<typename K, typename V>
448  MultiMap<K, V> getMultiMap(const std::string& name) {
449  return clientImpl->getMultiMap<K, V>(name);
450  }
451 
452  template<typename K, typename V>
453  boost::shared_ptr<ReplicatedMap<K, V> > getReplicatedMap(const std::string &name) {
454  return clientImpl->getReplicatedMap<K, V>(name);
455  }
456 
463  template<typename E>
464  IQueue<E> getQueue(const std::string& name) {
465  return clientImpl->getQueue<E>(name);
466  }
467 
476  template<typename E>
477  ISet<E> getSet(const std::string& name) {
478  return clientImpl->getSet<E>(name);
479  }
480 
488  template<typename E>
489  IList<E> getList(const std::string& name) {
490  return clientImpl->getList<E>(name);
491  }
492 
499  template<typename E>
500  ITopic<E> getTopic(const std::string& name) {
501  return clientImpl->getTopic<E>(name);
502  };
503 
510  template<typename E>
511  boost::shared_ptr<ReliableTopic<E> > getReliableTopic(const std::string& name) {
512  return clientImpl->getReliableTopic<E>(name);
513  }
514 
523  IdGenerator getIdGenerator(const std::string& name);
524 
543  FlakeIdGenerator getFlakeIdGenerator(const std::string& name);
544 
552  IAtomicLong getIAtomicLong(const std::string& name);
553 
566  boost::shared_ptr<crdt::pncounter::PNCounter> getPNCounter(const std::string& name);
567 
576  ICountDownLatch getICountDownLatch(const std::string& name);
577 
602  ILock getILock(const std::string& name);
603 
610  template <typename E>
611  boost::shared_ptr<Ringbuffer<E> > getRingbuffer(const std::string& name) {
612  return clientImpl->getRingbuffer<E>(name);
613  }
614 
622  ISemaphore getISemaphore(const std::string& name);
623 
635  boost::shared_ptr<IExecutorService> getExecutorService(const std::string &name);
636 
641  ClientConfig& getClientConfig();
642 
648  TransactionContext newTransactionContext();
649 
656  TransactionContext newTransactionContext(const TransactionOptions& options);
657 
665  Cluster& getCluster();
666 
674  Client getLocalEndpoint() const;
675 
686  void addLifecycleListener(LifecycleListener *lifecycleListener);
687 
693  bool removeLifecycleListener(LifecycleListener *lifecycleListener);
694 
698  void shutdown();
699 
705  mixedtype::HazelcastClient &toMixedType() const;
706 
714  spi::LifecycleService &getLifecycleService();
715  private:
716  boost::shared_ptr<impl::HazelcastClientInstanceImpl> clientImpl;
717  };
718 
719  }
720 }
721 
722 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
723 #pragma warning(pop)
724 #endif
725 
726 #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:500
Definition: IdGenerator.h:44
The Client interface allows to get information about a connected client&#39;s socket address, type and UUID.
Definition: Client.h:33
IQueue< E > getQueue(const std::string &name)
Returns the distributed queue instance with the specified name and entry type E.
Definition: HazelcastClient.h:464
IAtomicLong is a redundant and highly available distributed alternative to the java.util.concurrent.atomic.AtomicLong.
Definition: IAtomicLong.h:55
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:448
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:511
IList< E > getList(const std::string &name)
Returns the distributed list instance with the specified name.
Definition: HazelcastClient.h:489
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:611
Hazelcast cluster interface.
Definition: Cluster.h:40
A cluster-wide unique ID generator.
Definition: FlakeIdGenerator.h:53
ISet< E > getSet(const std::string &name)
Returns the distributed set instance with the specified name and entry type E.
Definition: HazelcastClient.h:477
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:437
Concurrent, distributed, observable and queryable map client.
Definition: IMap.h:66
PN (Positive-Negative) CRDT counter.
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:59
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:423