Template Struct Cursor

Struct Documentation

template<typename Derived>
struct Cursor

Unsynchronized ordinal cursor, independent of elapsed time or grid cells.

A zero limit throws; the initial index must be below the limit. set_frame() wraps/clamps later selections. offset() is metadata, not added to index().

Public Functions

inline std::size_t offset() const noexcept

Declaration: [[nodiscard]]

Read metadata offset without adding it to the current ordinal.

See also

Detailed guide

inline std::size_t index() const noexcept

Declaration: [[nodiscard]]

Read the current sequence ordinal, not necessarily a grid-cell ID.

See also

Detailed guide

inline std::size_t limit() const noexcept

Declaration: [[nodiscard]]

Read the positive ordinal limit retained by this cursor.

See also

Detailed guide

inline IndexPolicy index_policy() const noexcept

Declaration: [[nodiscard]]

Read the wrapping/clamping rule used by later selections.

See also

Detailed guide

inline Derived &operator[](const std::size_t frame)

Apply set_frame() and return the derived cursor object.

See also

Detailed guide

Parameters:

frame – Requested ordinal, wrapped or clamped by policy.

Pre:

Derived inherits from this Cursor specialization. No duration-based advancement or resource lookup occurs.

inline void set_frame(const std::size_t frame) noexcept

Update the ordinal using modulo Wrap or last-entry Clamp policy.

See also

Detailed guide

Parameters:

frame – Requested ordinal, including values at/above limit. The derived type must preserve positive limit and valid policy. Offset metadata is unchanged and no timeline is advanced.

inline Cursor(std::size_t offset, std::size_t index, std::size_t limit, IndexPolicy index_policy = IndexPolicy::Wrap)

Store independent ordinal state for a nonempty sequence.

See also

Detailed guide

Parameters:
  • offset – Derived metadata retained without arithmetic or validation.

  • index – Initial ordinal; caller must ensure index < limit. It is not wrapped/clamped or checked here.

  • limit – Positive sequence length.

  • index_policy – Valid Wrap/Clamp policy for later selections.

Throws:

CE::Exceptions::bad_request – Only when limit is zero. No wall clock, grid, animation durations or resource ownership is created; mutation is unsynchronized.

Cursor(const Cursor&) = default

Copy ordinal, limit, policy and offset values; playback state becomes independent.

See also

Detailed guide

Cursor(Cursor&&) noexcept = default

Move the scalar state; this base retains no owned resource or clock.

See also

Detailed guide

Cursor &operator=(const Cursor&) = default

Copy cursor metadata/state without advancing either sequence.

See also

Detailed guide

Cursor &operator=(Cursor&&) noexcept = default

Move scalar cursor state; resource ownership belongs to the derived value.

See also

Detailed guide

Protected Functions

~Cursor() = default

Destroy the base cursor through its derived owner; destruction advances no timeline.

See also

Detailed guide

Protected Attributes

std::size_t offset_ = 0

Derived-type metadata offset; never automatically added to index().

std::size_t index_ = 0

Current ordinal; derived implementations preserve index_ < limit_.

std::size_t limit_ = 0

Nonzero sequence length after successful construction; preserve for all modulo/clamp operations.

IndexPolicy index_policy_

Valid wrapping or clamping choice for subsequent set_frame() calls.