Red Hat Data Grid HotRod C++ Client  7.2.0
ContinuousQueryListener.h
Go to the documentation of this file.
1 /*
2  * ContinuousQueryListener.h
3  *
4  * Created on: Aug 3, 2016
5  * Author: rigazilla
6  */
7 
8 #ifndef INCLUDE_INFINISPAN_HOTROD_CONTINUOUSQUERYLISTENER_H_
9 #define INCLUDE_INFINISPAN_HOTROD_CONTINUOUSQUERYLISTENER_H_
10 #ifndef SWIGCSHARP
15 #include <tuple>
16 #include <vector>
17 #include <list>
18 #include <functional>
19 
20 using namespace infinispan::hotrod;
21 using namespace infinispan::hotrod::event;
22 
23 namespace infinispan {
24 namespace hotrod {
25 
26 namespace protocol {
27 class Codec20;
28 }
29 template <class K, class V>
30 class RemoteCache;
31 
32 namespace event {
33 template <class K, class V> class CacheClientListener;
34 template <typename... Params> class ContinuousQueryListener;
35 
36 template <class K, class V>
37 class ContinuousQueryListener<K,V>
38 {
39 public:
40  ContinuousQueryListener(RemoteCache<K,V>& rc, const std::string& query)
41  : cl(rc), query(query) {}
42  const std::function<void(K, V)>& getJoiningListener() const {
43  return joiningListener;
44  }
45 
46  void setJoiningListener(const std::function<void(K, V)>& joiningListener) {
47  this->joiningListener = joiningListener;
48  }
49 
50  const std::function<void(K, V)>& getLeavingListener() const {
51  return leavingListener;
52  }
53 
54  void setLeavingListener(const std::function<void(K, V)>& leavingListener) {
55  this->leavingListener = leavingListener;
56  }
57 
58  const std::function<void(K, V)>& getUpdatedListener() const {
59  return updatedListener;
60  }
61 
62  void setUpdatedListener(const std::function<void(K, V)>& updatedListener) {
63  this->updatedListener = updatedListener;
64  }
65 
66  const std::function<void()>& getFailoverListener() const {
67  return failoverListener;
68  }
69 
70  void setFailoverListener(const std::function<void()>& failoverListener) {
71  this->failoverListener = failoverListener;
72  }
73 
74  const std::string& getQuery() const {
75  return query;
76  }
77  std::function<void(ClientCacheEntryCustomEvent)> listenerCustomEvent;
79 
80 private:
81  std::string query;
82  std::function<void(K, V)> joiningListener;
83  std::function<void(K, V)> leavingListener;
84  std::function<void(K, V)> updatedListener;
85  std::function<void()> failoverListener;
86 };
87 
88 template <class K, class V, typename... Params>
89 class ContinuousQueryListener<K, V, Params...>
90 {
91 public:
92  ContinuousQueryListener(RemoteCache<K,V>& rc, const std::string& query)
93  : cl(rc), query(query) {}
94 
95  const std::function<void(K, std::tuple<Params...>)>& getJoiningListener() const {
96  return joiningListener;
97  }
98 
99  void setJoiningListener(const std::function<void(K, std::tuple<Params...>)>& joiningListener) {
100  this->joiningListener = joiningListener;
101  }
102 
103  const std::function<void(K, std::tuple<Params...>)>& getLeavingListener() const {
104  return leavingListener;
105  }
106 
107  void setLeavingListener(const std::function<void(K, std::tuple<Params...>)>& leavingListener) {
108  this->leavingListener = leavingListener;
109  }
110 
111  const std::function<void(K, std::tuple<Params...>)>& getUpdatedListener() const {
112  return updatedListener;
113  }
114 
115  void setUpdatedListener(const std::function<void(K, std::tuple<Params...>)>& updatedListener) {
116  this->updatedListener = updatedListener;
117  }
118 
119  const std::function<void()>& getFailoverListener() const {
120  return failoverListener;
121  }
122 
123  void setFailoverListener(const std::function<void()>& failoverListener) {
124  this->failoverListener = failoverListener;
125  }
126 
127  const std::string& getQuery() const {
128  return query;
129  }
130  std::function<void(ClientCacheEntryCustomEvent)> listenerCustomEvent;
132 
133 private:
134  std::string query;
135  std::function<void(K, std::tuple<Params...>)> joiningListener;
136  std::function<void(K, std::tuple<Params...>)> leavingListener;
137  std::function<void(K, std::tuple<Params...>)> updatedListener;
138  std::function<void()> failoverListener;
139 };
140 }}}
141 
142 #endif
143 #endif /* INCLUDE_INFINISPAN_HOTROD_CONTINUOUSQUERYLISTENER_H_ */
Definition: CacheClientListener.h:30
Definition: CacheClientListener.h:28
Definition: AuthenticationConfiguration.h:10
Definition: AuthenticationConfiguration.h:11
Definition: CacheClientListener.h:33
Definition: ContinuousQueryListener.h:34