Cursors

Classes that contain multiple data, like dballe::Message and dballe::DB, can be iterated via a Cursor subclass.

All cursors can be iterated in the same way, and each Cursor subclass provides access to the specific type of information being queried.

class Cursor

Base class for cursors that iterate over DB query results.

Subclassed by dballe::CursorData, dballe::CursorMessage, dballe::CursorStation, dballe::CursorStationData, dballe::CursorSummary

Public Functions

virtual bool has_value() const = 0

Check if the cursor points to a valid value.

Return

true if the cursor points to a valid accessible value, false if next() has not been called yet, or if at the end of iteration (i.e. next() returned false)

virtual int remaining() const = 0

Get the number of rows still to be fetched.

Return

The number of rows still to be queried. The value is undefined if no query has been successfully peformed yet using this cursor.

virtual bool next() = 0

Get a new item from the results of a query.

Return

true if a new record has been read, false if there is no more data to read

virtual void discard() = 0

Discard the results that have not been read yet.

virtual DBStation get_station() const = 0

Get the whole station data in a single call.

class CursorStation : public dballe::Cursor

Cursor iterating over stations.

Subclassed by dballe::impl::CursorStation

Public Functions

virtual DBValues get_values() const = 0

Get the station data values.

class CursorStationData : public dballe::Cursor

Cursor iterating over station data values.

Subclassed by dballe::impl::CursorStationData

Public Functions

virtual wreport::Varcode get_varcode() const = 0

Get the variable code.

virtual wreport::Var get_var() const = 0

Get the variable.

class CursorData : public dballe::Cursor

Cursor iterating over data values.

Subclassed by dballe::impl::CursorData

Public Functions

virtual wreport::Varcode get_varcode() const = 0

Get the variable code.

virtual wreport::Var get_var() const = 0

Get the variable.

virtual Level get_level() const = 0

Get the level.

virtual Trange get_trange() const = 0

Get the time range.

virtual Datetime get_datetime() const = 0

Get the datetime.

class CursorSummary : public dballe::Cursor

Cursor iterating over summary entries.

Subclassed by dballe::impl::CursorSummary

Public Functions

virtual Level get_level() const = 0

Get the level.

virtual Trange get_trange() const = 0

Get the time range.

virtual wreport::Varcode get_varcode() const = 0

Get the variable code.

virtual DatetimeRange get_datetimerange() const = 0

Get the datetime range.

virtual size_t get_count() const = 0

Get the count of elements.

class CursorMessage : public dballe::Cursor

Cursor iterating over messages.

Subclassed by dballe::impl::CursorMessage