Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::ModelFrame< T > Class Template Reference

One immutable model revision retained by the frame owner for all its views. Obtain once before WidgetTree::frame, pass the same value to every view, and retain it until borrowed rendering finishes. Different models require application transactions. More...

#include <model.hpp>

Public Member Functions

 ModelFrame (const ModelFrame &other)=default
 Retain the same immutable ownership.
 ModelFrame (ModelFrame &&other) noexcept=default
 Transfer ownership without releasing old storage.
ModelFrame & operator= (ModelFrame other) noexcept
 Replace all fields before releasing old storage, whose destructor may reenter.
std::uint64_t revision () const noexcept
 UI publication revision, including range readiness.
std::uint64_t dataRevision () const noexcept
 Provider data revision.
std::shared_ptr< const ModelSnapshot< T > > snapshot () const noexcept
 Retain the immutable base source without reading rows or transferring this UI frame.
std::uint64_t rowCount () const noexcept
 Logical rows.
std::expected< ModelRange< T >, TreeError > range (ModelRangeId id) const
 Read a consumer's exact result; stale/foreign consumer returns STALE_NODE. No spatial merge.
std::expected< ModelRange< T >, TreeError > read (RowRange range) const
 Direct bounded read from the base snapshot, without asynchronous requests or overlays.
std::expected< RowLookup, TreeError > locateRow (RowId id) const
 Resolve identity against the same retained snapshot as this frame's base rows.

Friends

template<class>
class Model
template<class>
class VirtualList
template<class>
class VirtualTable
template<class>
class Chart

Detailed Description

template<class T>
class portals::ModelFrame< T >

One immutable model revision retained by the frame owner for all its views. Obtain once before WidgetTree::frame, pass the same value to every view, and retain it until borrowed rendering finishes. Different models require application transactions.

Template Parameters
TDomain row value type; snapshot-owned reachable data must remain immutable and support destruction on the final owner's thread. Library range/frame/request operations do not copy T values.

Constructor & Destructor Documentation

◆ ModelFrame() [1/2]

template<class T>
portals::ModelFrame< T >::ModelFrame ( const ModelFrame< T > & other)
default

Retain the same immutable ownership.

Parameters
otherOwner whose immutable storage and metadata are shared; domain rows are not copied.

◆ ModelFrame() [2/2]

template<class T>
portals::ModelFrame< T >::ModelFrame ( ModelFrame< T > && other)
defaultnoexcept

Transfer ownership without releasing old storage.

Parameters
otherOwner whose storage is transferred; do not read moved-from borrowed data.

Member Function Documentation

◆ dataRevision()

template<class T>
std::uint64_t portals::ModelFrame< T >::dataRevision ( ) const
inlinenoexcept

Provider data revision.

Returns
Provider data revision retained by this frame.

◆ locateRow()

template<class T>
std::expected< RowLookup, TreeError > portals::ModelFrame< T >::locateRow ( RowId id) const
inline

Resolve identity against the same retained snapshot as this frame's base rows.

Parameters
idFull nonzero row identity to locate; no ownership is transferred.
Returns
Owning capability/result, INVALID_ARGUMENT for invalid identity/result or out-of-bounds index, NO_MEMORY for allocation failure, or CALLBACK_FAILED for other provider exceptions.
Note
UI preparation only, outside a tree frame. No requests or tree invalidation are performed.

◆ operator=()

template<class T>
ModelFrame & portals::ModelFrame< T >::operator= ( ModelFrame< T > other)
inlinenoexcept

Replace all fields before releasing old storage, whose destructor may reenter.

Parameters
otherReplacement owner passed by value; old storage is released after all fields are replaced.
Returns
This owner; do not use the reference if reentrant destruction of old storage destroyed this object.

◆ range()

template<class T>
std::expected< ModelRange< T >, TreeError > portals::ModelFrame< T >::range ( ModelRangeId id) const
inline

Read a consumer's exact result; stale/foreign consumer returns STALE_NODE. No spatial merge.

Parameters
idConsumer identity looked up in this immutable table; older pins can retain retired consumers.
Returns
That consumer's independent result owner, or STALE_NODE if absent from this table.

◆ read()

template<class T>
std::expected< ModelRange< T >, TreeError > portals::ModelFrame< T >::read ( RowRange range) const
inline

Direct bounded read from the base snapshot, without asynchronous requests or overlays.

Parameters
rangeInterval read from the pinned base snapshot under this model's row limit.
Returns
Independent range owner, INVALID_ARGUMENT for bounds/result shape, NO_MEMORY, or CALLBACK_FAILED.

◆ revision()

template<class T>
std::uint64_t portals::ModelFrame< T >::revision ( ) const
inlinenoexcept

UI publication revision, including range readiness.

Returns
UI publication revision, including range request/readiness changes.

◆ rowCount()

template<class T>
std::uint64_t portals::ModelFrame< T >::rowCount ( ) const
inlinenoexcept

Logical rows.

Returns
Logical row count of the pinned base snapshot.

◆ snapshot()

template<class T>
std::shared_ptr< const ModelSnapshot< T > > portals::ModelFrame< T >::snapshot ( ) const
inlinenoexcept

Retain the immutable base source without reading rows or transferring this UI frame.

Returns
Shared base snapshot owner; range-readiness overlays are not included. A worker may use ModelRange<T>::read with its own finite bounds. The provider snapshot, its reachable storage and final-owner destruction must satisfy ModelSnapshot<T>'s contract.

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