GridGain C++
core/include/ignite/cache/query/query_fields_row.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 GridGain Systems, Inc. and Contributors.
3  *
4  * Licensed under the GridGain Community Edition License (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  * https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
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 
22 #ifndef _IGNITE_CACHE_QUERY_QUERY_FIELDS_ROW
23 #define _IGNITE_CACHE_QUERY_QUERY_FIELDS_ROW
24 
25 #include <vector>
26 
27 #include <ignite/common/concurrent.h>
28 #include <ignite/ignite_error.h>
29 
31 #include "ignite/impl/cache/query/query_fields_row_impl.h"
32 #include "ignite/impl/operations.h"
33 
34 namespace ignite
35 {
36  namespace cache
37  {
38  namespace query
39  {
49  {
50  public:
56  QueryFieldsRow() : impl(0)
57  {
58  // No-op.
59  }
60 
68  QueryFieldsRow(impl::cache::query::QueryFieldsRowImpl* impl) : impl(impl)
69  {
70  // No-op.
71  }
72 
82  bool HasNext()
83  {
84  IgniteError err;
85 
86  bool res = HasNext(err);
87 
89 
90  return res;
91  }
92 
103  bool HasNext(IgniteError& err)
104  {
105  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
106 
107  if (impl0)
108  return impl0->HasNext();
109  else
110  {
112  "Instance is not usable (did you check for error?).");
113 
114  return false;
115  }
116  }
117 
131  template<typename T>
133  {
134  IgniteError err;
135 
136  T res = GetNext<T>(err);
137 
139 
140  return res;
141  }
142 
157  template<typename T>
159  {
160  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
161 
162  if (impl0)
163  return impl0->GetNext<T>(err);
164  else
165  {
167  "Instance is not usable (did you check for error?).");
168 
169  return T();
170  }
171  }
172 
188  int32_t GetNextInt8Array(int8_t* dst, int32_t len)
189  {
190  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
191 
192  if (impl0)
193  return impl0->GetNextInt8Array(dst, len);
194  else
195  {
197  "Instance is not usable (did you check for error?).");
198  }
199  }
200 
212  bool IsValid() const
213  {
214  return impl.IsValid();
215  }
216 
217  private:
219  ignite::common::concurrent::SharedPointer<impl::cache::query::QueryFieldsRowImpl> impl;
220  };
221  }
222  }
223 }
224 
225 #endif //_IGNITE_CACHE_QUERY_QUERY_FIELDS_ROW
ignite::cache::query::QueryFieldsRow::GetNextInt8Array
int32_t GetNextInt8Array(int8_t *dst, int32_t len)
Get next entry assuming it's an array of 8-byte signed integers.
Definition: core/include/ignite/cache/query/query_fields_row.h:188
ignite::cache::query::QueryFieldsRow::QueryFieldsRow
QueryFieldsRow()
Default constructor.
Definition: core/include/ignite/cache/query/query_fields_row.h:56
ignite
Ignite API.
Definition: cache.h:47
ignite::cache::query::QueryFieldsRow::GetNext
T GetNext(IgniteError &err)
Get next entry.
Definition: core/include/ignite/cache/query/query_fields_row.h:158
ignite::cache::query::QueryFieldsRow::HasNext
bool HasNext(IgniteError &err)
Check whether next entry exists.
Definition: core/include/ignite/cache/query/query_fields_row.h:103
ignite::cache::query::QueryFieldsRow::QueryFieldsRow
QueryFieldsRow(impl::cache::query::QueryFieldsRowImpl *impl)
Constructor.
Definition: core/include/ignite/cache/query/query_fields_row.h:68
ignite::cache::query::QueryFieldsRow::GetNext
T GetNext()
Get next entry.
Definition: core/include/ignite/cache/query/query_fields_row.h:132
ignite::cache::query::QueryFieldsRow::IsValid
bool IsValid() const
Check if the instance is valid.
Definition: core/include/ignite/cache/query/query_fields_row.h:212
ignite::IgniteError::IGNITE_ERR_GENERIC
static const int IGNITE_ERR_GENERIC
Generic Ignite error.
Definition: ignite_error.h:130
cache_entry.h
ignite::cache::query::QueryFieldsRow::HasNext
bool HasNext()
Check whether next entry exists.
Definition: core/include/ignite/cache/query/query_fields_row.h:82
ignite::IgniteError::ThrowIfNeeded
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:26
ignite::cache::query::QueryFieldsRow
Query fields cursor.
Definition: core/include/ignite/cache/query/query_fields_row.h:48
ignite_error.h
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:93