linkahead/result_set.h

namespace linkahead
namespace transaction

Creation and execution of transactions.

Author

Timm Fitschen

Date

2021-08-05

class AbstractMultiResultSet : public linkahead::transaction::ResultSet

Subclassed by linkahead::transaction::MultiResultSet

Public Functions

inline AbstractMultiResultSet(const AbstractMultiResultSet &original)

Copy Constructor.

Copies the underlying collection of entities.

virtual ~AbstractMultiResultSet() = default
inline explicit AbstractMultiResultSet(std::vector<std::unique_ptr<Entity>> result_set)
inline virtual auto size() const noexcept -> size_t override
inline virtual auto at(const int index) const -> const Entity& override
inline virtual auto mutable_at(int index) const -> Entity* override
inline virtual auto release_at(int index) -> Entity* override

Return the Entity at the given index.

This method releases the entity from the underlying collection and thus leaves the ResultSet in a corrupted state.

This method can be called only once for each index.

inline auto clear() noexcept -> void

Remove all entities from this result set.

Protected Attributes

std::vector<std::unique_ptr<Entity>> items
class MultiResultSet : public linkahead::transaction::AbstractMultiResultSet
#include <result_set.h>

Container with results of a transaction.

Public Functions

~MultiResultSet() = default
explicit MultiResultSet(std::vector<std::unique_ptr<Entity>> result_set)
class ResultSet
#include <result_set.h>

Abstract base class for the results of a Transaction.

Subclassed by linkahead::transaction::AbstractMultiResultSet

Public Functions

virtual ~ResultSet() = default
virtual auto size() const noexcept -> size_t = 0
virtual auto at(const int index) const -> const Entity& = 0
virtual auto mutable_at(int index) const -> Entity* = 0
virtual auto release_at(int index) -> Entity* = 0

Return the Entity at the given index.

This method releases the entity from the underlying collection and thus leaves the ResultSet in a corrupted state.

This method can be called only once for each index.

auto begin() const -> iterator
auto end() const -> iterator
class iterator

Public Types

using iterator_category = std::output_iterator_tag
using value_type = Entity
using difference_type = std::ptrdiff_t
using pointer = Entity*
using reference = Entity&

Public Functions

explicit iterator(const ResultSet *result_set, int index = 0)
auto operator*() const -> const Entity&
auto operator++() -> iterator&
auto operator++(int) -> iterator
auto operator!=(const iterator &rhs) const -> bool

Private Members

int current_index = 0
const ResultSet *result_set