Apache Ignite C++
query_fields_row.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_FIELDS_ROW
24 #define _IGNITE_CACHE_QUERY_FIELDS_ROW
25 
26 #include <vector>
27 
28 #include <ignite/common/concurrent.h>
29 
31 #include "ignite/ignite_error.h"
32 #include "ignite/impl/cache/query/query_fields_row_impl.h"
33 #include "ignite/impl/operations.h"
34 
35 namespace ignite
36 {
37  namespace cache
38  {
39  namespace query
40  {
45  {
46  public:
50  QueryFieldsRow() : impl(NULL)
51  {
52  // No-op.
53  }
54 
60  QueryFieldsRow(impl::cache::query::QueryFieldsRowImpl* impl) : impl(impl)
61  {
62  // No-op.
63  }
64 
70  bool HasNext()
71  {
72  IgniteError err;
73 
74  bool res = HasNext(err);
75 
77 
78  return res;
79  }
80 
87  bool HasNext(IgniteError& err)
88  {
89  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
90 
91  if (impl0)
92  return impl0->HasNext();
93  else
94  {
96  "Instance is not usable (did you check for error?).");
97 
98  return false;
99  }
100  }
101 
107  template<typename T>
109  {
110  IgniteError err;
111 
112  QueryFieldsRow res = GetNext<T>(err);
113 
115 
116  return res;
117  }
118 
125  template<typename T>
127  {
128  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
129 
130  if (impl0)
131  return impl0->GetNext<T>(err);
132  else
133  {
135  "Instance is not usable (did you check for error?).");
136 
137  return T();
138  }
139  }
140 
146  bool IsValid()
147  {
148  return impl.IsValid();
149  }
150 
151  private:
153  ignite::common::concurrent::SharedPointer<impl::cache::query::QueryFieldsRowImpl> impl;
154  };
155  }
156  }
157 }
158 
159 #endif
QueryFieldsRow()
Default constructor.
Definition: query_fields_row.h:50
QueryFieldsRow(impl::cache::query::QueryFieldsRowImpl *impl)
Constructor.
Definition: query_fields_row.h:60
bool HasNext()
Check whether next entry exists.
Definition: query_fields_row.h:70
T GetNext()
Get next entry.
Definition: query_fields_row.h:108
T GetNext(IgniteError &err)
Get next entry.
Definition: query_fields_row.h:126
static void ThrowIfNeeded(IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
Declares ignite::cache::CacheEntry class.
Ignite error information.
Definition: ignite_error.h:78
bool HasNext(IgniteError &err)
Check whether next entry exists.
Definition: query_fields_row.h:87
Query fields cursor.
Definition: query_fields_row.h:44
Apache Ignite API.
Definition: binary_consts.h:28
bool IsValid()
Check if the instance is valid.
Definition: query_fields_row.h:146
Declares ignite::IgniteError class.
static const int IGNITE_ERR_GENERIC
Generic Ignite error.
Definition: ignite_error.h:112