| Apache Ignite C++

core/include/ignite/cache/query/continuous/continuous_query_handle.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_HANDLE
24 #define _IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_HANDLE
25
26 #include <ignite/impl/cache/query/continuous/continuous_query_handle_impl.h>
27
28 namespace ignite
29 {
30 namespace cache
31 {
32 namespace query
33 {
34 namespace continuous
35 {
39 template<typename K, typename V>
40 class ContinuousQueryHandle
41 {
42 public:
46 ContinuousQueryHandle() :
47 impl()
48 {
49 // No-op.
50 }
51
59 ContinuousQueryHandle(impl::cache::query::continuous::ContinuousQueryHandleImpl* impl) :
60 impl(impl)
61 {
62 // No-op.
63 }
64
72 QueryCursor<K, V> GetInitialQueryCursor()
73 {
74 IgniteError err;
75
76 QueryCursor<K, V> res = GetInitialQueryCursor(err);
77
78 IgniteError::ThrowIfNeeded(err);
79
80 return res;
81 }
82
91 QueryCursor<K, V> GetInitialQueryCursor(IgniteError& err)
92 {
93 impl::cache::query::continuous::ContinuousQueryHandleImpl* impl0 = impl.Get();
94
95 if (impl0)
96 return QueryCursor<K, V>(impl0->GetInitialQueryCursor(err));
97 else
98 {
99 err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
100 "Instance is not usable (did you check for error?).");
101
102 return QueryCursor<K, V>();
103 }
104 }
105
117 bool IsValid() const
118 {
119 return impl.IsValid();
120 }
121
122 private:
123 typedef impl::cache::query::continuous::ContinuousQueryHandleImpl ContinuousQueryHandleImpl;
124
126 common::concurrent::SharedPointer<ContinuousQueryHandleImpl> impl;
127 };
128 }
129 }
130 }
131 }
132
133 #endif //_IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_HANDLE
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::cache::query::continuous::ContinuousQueryHandle::GetInitialQueryCursor
QueryCursor< K, V > GetInitialQueryCursor(IgniteError &err)
Gets the cursor for initial query.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:91
ignite::cache::query::continuous::ContinuousQueryHandle::GetInitialQueryCursor
QueryCursor< K, V > GetInitialQueryCursor()
Gets the cursor for initial query.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:72
ignite::cache::query::QueryCursor
Query cursor class template.
Definition: query_cursor.h:54
ignite::cache::query::continuous::ContinuousQueryHandle::ContinuousQueryHandle
ContinuousQueryHandle()
Default constructor.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:46
ignite::IgniteError::IGNITE_ERR_GENERIC
static const int IGNITE_ERR_GENERIC
Generic Ignite error.
Definition: ignite_error.h:131
ignite::cache::query::continuous::ContinuousQueryHandle::ContinuousQueryHandle
ContinuousQueryHandle(impl::cache::query::continuous::ContinuousQueryHandleImpl *impl)
Constructor.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:59
ignite::cache::query::continuous::ContinuousQueryHandle::IsValid
bool IsValid() const
Check if the instance is valid.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:117
ignite::IgniteError::ThrowIfNeeded
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:94
ignite::cache::query::continuous::ContinuousQueryHandle
Continuous query handle.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:40