| Apache Ignite C++

continuous_query.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_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
24 #define _IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
25
26 #include <ignite/impl/cache/query/continuous/continuous_query_impl.h>
27
28 #include <ignite/cache/event/cache_entry_event_listener.h>
29 #include <ignite/cache/event/cache_entry_event_filter.h>
30 #include <ignite/cache/event/java_cache_entry_event_filter.h>
31
32 namespace ignite
33 {
34 namespace cache
35 {
36 // Forward-declaration.
37 template<typename K, typename V>
38 class IGNITE_IMPORT_EXPORT Cache;
39
40 namespace query
41 {
42 namespace continuous
43 {
58 template<typename K, typename V>
59 class ContinuousQuery
60 {
61 friend class Cache<K, V>;
62 public:
63
67 enum { DEFAULT_BUFFER_SIZE = 1 };
68
72 enum { DEFAULT_TIME_INTERVAL = 0 };
73
77 ~ContinuousQuery()
78 {
79 // No-op.
80 }
81
88 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr) :
89 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false))
90 {
91 // No-op.
92 }
93
101 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr, bool loc) :
102 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, loc))
103 {
104 // No-op.
105 }
106
114 template<typename F>
115 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
116 const Reference<F>& remoteFilter) :
117 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false, remoteFilter))
118 {
119 // No-op.
120 }
121
130 template<typename F>
131 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
132 const Reference<F>& remoteFilter, bool loc) :
133 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, loc, remoteFilter))
134 {
135 // No-op.
136 }
137
145 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
146 const event::JavaCacheEntryEventFilter& remoteFilter) :
147 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false, remoteFilter))
148 {
149 // No-op.
150 }
151
160 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
161 const event::JavaCacheEntryEventFilter& remoteFilter, bool loc) :
162 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, loc, remoteFilter))
163 {
164 // No-op.
165 }
166
174 void SetLocal(bool val)
175 {
176 impl.Get()->SetLocal(val);
177 }
178
186 bool GetLocal() const
187 {
188 return impl.Get()->GetLocal();
189 }
190
201 void SetBufferSize(int32_t val)
202 {
203 impl.Get()->SetBufferSize(val);
204 }
205
216 int32_t GetBufferSize() const
217 {
218 return impl.Get()->GetBufferSize();
219 }
220
236 void SetTimeInterval(int64_t val)
237 {
238 impl.Get()->SetTimeInterval(val);
239 }
240
256 int64_t GetTimeInterval() const
257 {
258 return impl.Get()->GetTimeInterval();
259 }
260
268 void SetListener(Reference<event::CacheEntryEventListener<K, V> > lsnr)
269 {
270 impl.Get()->SetListener(lsnr);
271 }
272
278 const event::CacheEntryEventListener<K, V>& GetListener() const
279 {
280 return impl.Get()->GetListener();
281 }
282
288 event::CacheEntryEventListener<K, V>& GetListener()
289 {
290 return impl.Get()->GetListener();
291 }
292
293 private:
295 common::concurrent::SharedPointer<impl::cache::query::continuous::ContinuousQueryImpl<K, V> > impl;
296 };
297 }
298 }
299 }
300 }
301
302 #endif //_IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
ignite::cache::query::continuous::ContinuousQuery::SetBufferSize
void SetBufferSize(int32_t val)
Set buffer size.
Definition: continuous_query.h:201
cache_entry_event_listener.h
ignite::cache::query::continuous::ContinuousQuery::GetListener
event::CacheEntryEventListener< K, V > & GetListener()
Get cache entry event listener.
Definition: continuous_query.h:288
ignite::cache::query::continuous::ContinuousQuery::~ContinuousQuery
~ContinuousQuery()
Destructor.
Definition: continuous_query.h:77
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::cache::query::continuous::ContinuousQuery::GetListener
const event::CacheEntryEventListener< K, V > & GetListener() const
Get cache entry event listener.
Definition: continuous_query.h:278
java_cache_entry_event_filter.h
cache_entry_event_filter.h
ignite::cache::Cache
Main entry point for all Data Grid APIs.
Definition: cache.h:68
ignite::cache::query::continuous::ContinuousQuery::GetLocal
bool GetLocal() const
Get local flag.
Definition: continuous_query.h:186
ignite::cache::event::JavaCacheEntryEventFilter
Java cache entry event filter.
Definition: core/include/ignite/cache/event/java_cache_entry_event_filter.h:55
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, bool loc)
Constructor.
Definition: continuous_query.h:101
ignite::cache::query::continuous::ContinuousQuery::SetLocal
void SetLocal(bool val)
Set local flag.
Definition: continuous_query.h:174
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, const event::JavaCacheEntryEventFilter &remoteFilter, bool loc)
Constructor.
Definition: continuous_query.h:160
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Constructor.
Definition: continuous_query.h:88
ignite::cache::query::continuous::ContinuousQuery::SetListener
void SetListener(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Set cache entry event listener.
Definition: continuous_query.h:268
ignite::cache::query::continuous::ContinuousQuery
Continuous query.
Definition: continuous_query.h:59
ignite::cache::query::continuous::ContinuousQuery::GetTimeInterval
int64_t GetTimeInterval() const
Get time interval.
Definition: continuous_query.h:256
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, const Reference< F > &remoteFilter)
Constructor.
Definition: continuous_query.h:115
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, const event::JavaCacheEntryEventFilter &remoteFilter)
Constructor.
Definition: continuous_query.h:145
ignite::Reference
Reference class.
Definition: reference.h:35
ignite::cache::query::continuous::ContinuousQuery::SetTimeInterval
void SetTimeInterval(int64_t val)
Set time interval.
Definition: continuous_query.h:236
ignite::cache::event::CacheEntryEventListener
Cache entry event listener.
Definition: core/include/ignite/cache/event/cache_entry_event_listener.h:40
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, const Reference< F > &remoteFilter, bool loc)
Constructor.
Definition: continuous_query.h:131
ignite::cache::query::continuous::ContinuousQuery::GetBufferSize
int32_t GetBufferSize() const
Get buffer size.
Definition: continuous_query.h:216