| Apache Ignite C++

continuous_query_client.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
23 #ifndef _IGNITE_THIN_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_CLIENT
24 #define _IGNITE_THIN_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_CLIENT
25
26 #include <ignite/reference.h>
27
28 #include <ignite/thin/cache/event/cache_entry_event_listener.h>
29
30 namespace ignite
31 {
32 namespace thin
33 {
34 namespace cache
35 {
36 namespace query
37 {
38 namespace continuous
39 {
52 template<typename K, typename V>
53 class ContinuousQueryClient
54 {
55 public:
59 enum { DEFAULT_BUFFER_SIZE = 1 };
60
64 enum { DEFAULT_TIME_INTERVAL = 0 };
65
69 ~ContinuousQueryClient()
70 {
71 // No-op.
72 }
73
80 explicit ContinuousQueryClient(Reference<event::CacheEntryEventListener<K, V> > lsnr) :
81 bufferSize(DEFAULT_BUFFER_SIZE),
82 timeInterval(DEFAULT_TIME_INTERVAL),
83 includeExpired(false),
84 listener(lsnr)
85 {
86 // No-op.
87 }
88
98 void SetBufferSize(int32_t val)
99 {
100 bufferSize = val;
101 }
102
112 int32_t GetBufferSize() const
113 {
114 return bufferSize;
115 }
116
129 void SetTimeInterval(int64_t val)
130 {
131 timeInterval = val;
132 }
133
146 int64_t GetTimeInterval() const
147 {
148 return timeInterval;
149 }
150
161 void SetIncludeExpired(bool val)
162 {
163 includeExpired = val;
164 }
165
176 bool GetIncludeExpired() const
177 {
178 return includeExpired;
179 }
180
188 void SetListener(Reference<event::CacheEntryEventListener<K, V> > lsnr)
189 {
190 listener = lsnr;
191 }
192
198 const event::CacheEntryEventListener<K, V>& GetListener() const
199 {
200 return *listener.Get();
201 }
202
208 event::CacheEntryEventListener<K, V>& GetListener()
209 {
210 return *listener.Get();
211 }
212
213 private:
215 int32_t bufferSize;
216
218 int64_t timeInterval;
219
221 bool includeExpired;
222
224 Reference<event::CacheEntryEventListener<K, V> > listener;
225 };
226 }
227 }
228 }
229 }
230 }
231
232 #endif //_IGNITE_THIN_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_CLIENT
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetTimeInterval
int64_t GetTimeInterval() const
Get time interval.
Definition: continuous_query_client.h:146
cache_entry_event_listener.h
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetIncludeExpired
void SetIncludeExpired(bool val)
Sets a value indicating whether to notify about Expired events.
Definition: continuous_query_client.h:161
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetBufferSize
int32_t GetBufferSize() const
Get buffer size.
Definition: continuous_query_client.h:112
ignite::thin::cache::event::CacheEntryEventListener
Cache entry event listener.
Definition: thin-client/include/ignite/thin/cache/event/cache_entry_event_listener.h:42
ignite::thin::cache::query::continuous::ContinuousQueryClient
Continuous query client.
Definition: continuous_query_client.h:53
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetTimeInterval
void SetTimeInterval(int64_t val)
Set time interval.
Definition: continuous_query_client.h:129
ignite::thin::cache::query::continuous::ContinuousQueryClient::ContinuousQueryClient
ContinuousQueryClient(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Constructor.
Definition: continuous_query_client.h:80
ignite::thin::cache::query::continuous::ContinuousQueryClient::~ContinuousQueryClient
~ContinuousQueryClient()
Destructor.
Definition: continuous_query_client.h:69
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetListener
event::CacheEntryEventListener< K, V > & GetListener()
Get cache entry event listener.
Definition: continuous_query_client.h:208
reference.h
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetBufferSize
void SetBufferSize(int32_t val)
Set buffer size.
Definition: continuous_query_client.h:98
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetListener
const event::CacheEntryEventListener< K, V > & GetListener() const
Get cache entry event listener.
Definition: continuous_query_client.h:198
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetListener
void SetListener(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Set cache entry event listener.
Definition: continuous_query_client.h:188
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetIncludeExpired
bool GetIncludeExpired() const
Gets a value indicating whether to notify about Expired events.
Definition: continuous_query_client.h:176
ignite::Reference
Reference class.
Definition: reference.h:35