GridGain C++ Client Library
query_fields_row.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) GridGain Systems. All Rights Reserved.
3  * _________ _____ __________________ _____
4  * __ ____/___________(_)______ /__ ____/______ ____(_)_______
5  * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
6  * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
7  * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
8  */
9 
15 #ifndef _GRIDGAIN_CACHE_QUERY_FIELDS_ROW
16 #define _GRIDGAIN_CACHE_QUERY_FIELDS_ROW
17 
18 #include <vector>
19 
20 #include <ignite/common/concurrent.h>
21 
23 #include "gridgain/grid_error.h"
24 #include "gridgain/impl/cache/query/query_fields_row_impl.h"
25 #include "gridgain/impl/operations.h"
26 
27 namespace gridgain
28 {
29  namespace cache
30  {
31  namespace query
32  {
37  {
38  public:
42  QueryFieldsRow() : impl(NULL)
43  {
44  // No-op.
45  }
46 
52  QueryFieldsRow(impl::cache::query::QueryFieldsRowImpl* impl) : impl(impl)
53  {
54  // No-op.
55  }
56 
62  bool HasNext()
63  {
64  GridError err;
65 
66  bool res = HasNext(err);
67 
69 
70  return res;
71  }
72 
79  bool HasNext(GridError& err)
80  {
81  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
82 
83  if (impl0)
84  return impl0->HasNext();
85  else
86  {
88  "Instance is not usable (did you check for error?).");
89 
90  return false;
91  }
92  }
93 
99  template<typename T>
101  {
102  GridError err;
103 
104  QueryFieldsRow res = GetNext<T>(err);
105 
107 
108  return res;
109  }
110 
117  template<typename T>
119  {
120  impl::cache::query::QueryFieldsRowImpl* impl0 = impl.Get();
121 
122  if (impl0)
123  return impl0->GetNext<T>(err);
124  else
125  {
127  "Instance is not usable (did you check for error?).");
128 
129  return T();
130  }
131  }
132 
138  bool IsValid()
139  {
140  return impl.IsValid();
141  }
142 
143  private:
145  ignite::common::concurrent::SharedPointer<impl::cache::query::QueryFieldsRowImpl> impl;
146  };
147  }
148  }
149 }
150 
151 #endif
T GetNext(GridError &err)
Get next entry.
Definition: query_fields_row.h:118
Query fields cursor.
Definition: query_fields_row.h:36
static const int GG_ERR_GENERIC
Generic GridGain error.
Definition: grid_error.h:104
bool HasNext(GridError &err)
Check whether next entry exists.
Definition: query_fields_row.h:79
bool IsValid()
Check if the instance is valid.
Definition: query_fields_row.h:138
Declares gridgain::GridError class.
bool HasNext()
Check whether next entry exists.
Definition: query_fields_row.h:62
T GetNext()
Get next entry.
Definition: query_fields_row.h:100
Declares gridgain::cache::CacheEntry class.
QueryFieldsRow(impl::cache::query::QueryFieldsRowImpl *impl)
Constructor.
Definition: query_fields_row.h:52
static void ThrowIfNeeded(GridError &err)
Throw an error if code is not GG_SUCCESS.
Definition: grid_error.cpp:22
QueryFieldsRow()
Default constructor.
Definition: query_fields_row.h:42
GridGain API.
Definition: cache.h:35
Grid error information.
Definition: grid_error.h:70