morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::table::RowSnapshot Class Referenceabstract

An immutable view of a table's rows at one moment. More...

#include <data_source.hpp>

Inheritance diagram for morph::table::RowSnapshot:
morph::table::RowsSnapshot< Row > morph::table::TableSnapshot

Public Member Functions

virtual std::size_t rowCount () const =0
 The number of rows.
virtual RowId rowId (std::size_t row) const =0
 A row's key.
virtual Cell cell (std::size_t row, std::size_t column) const =0
 One cell.
virtual void readColumn (std::size_t column, ColumnSink &sink, std::size_t first, std::size_t last) const
 Hands rows [first, last) of column to sink.

Protected Member Functions

 RowSnapshot (RowSnapshot const &)=default
 Copies the base of a snapshot: a derived snapshot makes a changed copy of itself this way.
 RowSnapshot (RowSnapshot &&)=default
 Moves the base of a snapshot.
RowSnapshot & operator= (RowSnapshot const &)=default
 Copy-assigns the base of a snapshot.
RowSnapshot & operator= (RowSnapshot &&)=default
 Move-assigns the base of a snapshot.

Detailed Description

An immutable view of a table's rows at one moment.

Nothing changes a snapshot after it is published, so it is safe to read from any thread, concurrently, for as long as it is held.

Definition at line 457 of file data_source.hpp.

Member Function Documentation

◆ rowCount()

virtual std::size_t morph::table::RowSnapshot::rowCount ( ) const
nodiscardpure virtual

The number of rows.

Returns
Row count.

Implemented in morph::table::RowsSnapshot< Row >, and morph::table::TableSnapshot.

◆ rowId()

virtual RowId morph::table::RowSnapshot::rowId ( std::size_t row) const
nodiscardpure virtual

A row's key.

Parameters
rowRow index, below rowCount().
Returns
The row's RowId.

Implemented in morph::table::RowsSnapshot< Row >, and morph::table::TableSnapshot.

◆ cell()

virtual Cell morph::table::RowSnapshot::cell ( std::size_t row,
std::size_t column ) const
nodiscardpure virtual

One cell.

Parameters
rowRow index, below rowCount().
columnColumn index, below the source's column count.
Returns
The cell, by value.

Implemented in morph::table::RowsSnapshot< Row >, and morph::table::TableSnapshot.

◆ readColumn()

virtual void morph::table::RowSnapshot::readColumn ( std::size_t column,
ColumnSink & sink,
std::size_t first,
std::size_t last ) const
inlinevirtual

Hands rows [first, last) of column to sink.

The default calls cell per row. A snapshot that stores cells contiguously overrides it to hand whole runs, which is how the engine reads a column of 100,000 rows without as many virtual calls.

Parameters
columnColumn index.
sinkReceives the cells.
firstFirst row.
lastOne past the last row.

Reimplemented in morph::table::RowsSnapshot< Row >, and morph::table::TableSnapshot.

Definition at line 486 of file data_source.hpp.

◆ operator=() [1/2]

RowSnapshot & morph::table::RowSnapshot::operator= ( RowSnapshot const & )
protecteddefault

Copy-assigns the base of a snapshot.

Returns
*this.

◆ operator=() [2/2]

RowSnapshot & morph::table::RowSnapshot::operator= ( RowSnapshot && )
protecteddefault

Move-assigns the base of a snapshot.

Returns
*this.

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