| Apache Ignite C++

Public Member Functions | List of all members
ignite::cache::query::QueryCursor< K, V > Class Template Reference

Query cursor class template. More...

`#include <query_cursor.h>`

## Public Member Functions
| QueryCursor ()
| Default constructor. More...
| QueryCursor (impl::cache::query::QueryCursorImpl *impl)
| Constructor. More...
bool | HasNext ()
| Check whether next entry exists. More...
bool | HasNext (IgniteError &err)
| Check whether next entry exists. More...
CacheEntry< K, V > | GetNext ()
| Get next entry. More...
CacheEntry< K, V > | GetNext (IgniteError &err)
| Get next entry. More...
void | GetAll (std::vector< CacheEntry< K, V > > &res)
| Get all entries. More...
void | GetAll (std::vector< CacheEntry< K, V > > &res, IgniteError &err)
| Get all entries. More...
template<typename OutIter >
void | GetAll (OutIter iter)
| Get all entries. More...
bool | IsValid () const
| Check if the instance is valid. More...

## Detailed Description

### template<typename K, typename V>
class ignite::cache::query::QueryCursor< K, V >

Query cursor class template.

Both key and value types should be default-constructable, copy-constructable and assignable. Also BinaryType class template should be specialized for both types.

This class is implemented as a reference to an implementation so copying of this class instance will only create another reference to the same underlying object. Underlying object will be released automatically once all the instances are destructed.

## Constructor & Destructor Documentation

## ◆ QueryCursor() [1/2]

template<typename K , typename V >

ignite::cache::query::QueryCursor< K, V >::QueryCursor | ( |  | ) |
| inline

Default constructor.

Constructed instance is not valid and thus can not be used as a cursor.

## ◆ QueryCursor() [2/2]

template<typename K , typename V >

ignite::cache::query::QueryCursor< K, V >::QueryCursor | ( | impl::cache::query::QueryCursorImpl * | impl | ) |
| inline

Constructor.

Internal method. Should not be used by user.

Parameters

  impl | Implementation.

## Member Function Documentation

## ◆ GetAll() [1/3]

template<typename K , typename V >
template<typename OutIter >

void ignite::cache::query::QueryCursor< K, V >::GetAll | ( | OutIter | iter | ) |
| inline

Get all entries.

This method should only be used on the valid instance.

Parameters

  iter | Output iterator.

## ◆ GetAll() [2/3]

template<typename K , typename V >

void ignite::cache::query::QueryCursor< K, V >::GetAll | ( | std::vector< CacheEntry< K, V > > & | res | ) |
| inline

Get all entries.

This method should only be used on the valid instance.

Parameters

  res | Vector where query entries will be stored.

Exceptions

  IgniteError | class instance in case of failure.

## ◆ GetAll() [3/3]

template<typename K , typename V >

void ignite::cache::query::QueryCursor< K, V >::GetAll | ( | std::vector< CacheEntry< K, V > > & | res,
|  | IgniteError & | err
| ) |  |
| inline

Get all entries.

Properly sets error param in case of failure.

This method should only be used on the valid instance.

Parameters

  res | Vector where query entries will be stored.
  err | Used to set operation result.

## ◆ GetNext() [1/2]

template<typename K , typename V >

CacheEntry<K, V> ignite::cache::query::QueryCursor< K, V >::GetNext | ( |  | ) |
| inline

Get next entry.

This method should only be used on the valid instance.

Returns
  Next entry.

Exceptions

  IgniteError | class instance in case of failure.

## ◆ GetNext() [2/2]

template<typename K , typename V >

CacheEntry<K, V> ignite::cache::query::QueryCursor< K, V >::GetNext | ( | IgniteError & | err | ) |
| inline

Get next entry.

Properly sets error param in case of failure.

This method should only be used on the valid instance.

Parameters

  err | Used to set operation result.

Returns
  Next entry on success and default-constructed entry on failure. Default-constructed entry contains default-constructed instances of both key and value types.

## ◆ HasNext() [1/2]

template<typename K , typename V >

bool ignite::cache::query::QueryCursor< K, V >::HasNext | ( |  | ) |
| inline

Check whether next entry exists.

This method should only be used on the valid instance.

Returns
  True if next entry exists.

Exceptions

  IgniteError | class instance in case of failure.

## ◆ HasNext() [2/2]

template<typename K , typename V >

bool ignite::cache::query::QueryCursor< K, V >::HasNext | ( | IgniteError & | err | ) |
| inline

Check whether next entry exists.

Properly sets error param in case of failure.

This method should only be used on the valid instance.

Parameters

  err | Used to set operation result.

Returns
  True if next entry exists and operation resulted in success. Returns false on failure.

## ◆ IsValid()

template<typename K , typename V >

bool ignite::cache::query::QueryCursor< K, V >::IsValid | ( |  | ) | const
| inline

Check if the instance is valid.

Invalid instance can be returned if some of the previous operations have resulted in a failure. For example invalid instance can be returned by not-throwing version of method in case of error. Invalid instances also often can be created using default constructor.

Returns
  True if the instance is valid and can be used.

The documentation for this class was generated from the following file:

- query_cursor.h