Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::RenderingInstanceView Struct Reference

A view containing a list of components::RenderingInstanceComponent which can be iterated over. More...

#include "donner/svg/renderer/common/RenderingInstanceView.h"

Classes

struct  SavedState
 Opaque iterator state returned by save and consumed by restore. More...

Public Types

using StorageType = entt::storage<components::RenderingInstanceComponent>
 The type of the storage used to store the components.

Public Member Functions

 RenderingInstanceView (Registry &registry)
 Constructor, takes a registry and snapshots every entity that currently has a components::RenderingInstanceComponent, in storage iteration order.
 RenderingInstanceView (Registry &registry, std::span< const Entity > entities)
 Constructor taking an explicit ordered list of entities to iterate.
 ~RenderingInstanceView ()=default
 Destructor.
 RenderingInstanceView (const RenderingInstanceView &)=default
 Copy constructor.
 RenderingInstanceView (RenderingInstanceView &&)=default
 Move constructor.
RenderingInstanceViewoperator= (const RenderingInstanceView &)=delete
RenderingInstanceViewoperator= (RenderingInstanceView &&)=delete
bool done () const
 Returns true if the view has no more elements.
void advance ()
 Advances the view to the next element.
Entity currentEntity () const
 Returns the current entity.
SavedState save () const
 Saves the current state.
void restore (const SavedState &state)
 Restores the state.
const components::RenderingInstanceComponentget () const
 Returns the current component.

Detailed Description

A view containing a list of components::RenderingInstanceComponent which can be iterated over.

The view snapshots the entity IDs it will visit at construction time. This lets the caller safely mutate the underlying components::RenderingInstanceComponent storage during iteration — for example, a filter-graph pre-pass that calls RenderingContext::createFeImageShadowTree, which emplaces new rendering instances and sorts the whole pool. Iterating over live entt iterators across such mutation would be undefined behaviour; iterating a snapshot of entity IDs is stable, and each component access re-reads from storage using storage.get(entity).


Class Documentation

◆ donner::svg::RenderingInstanceView::SavedState

struct donner::svg::RenderingInstanceView::SavedState

Opaque iterator state returned by save and consumed by restore.

Class Members
size_t current Saved index into the snapshot entity list.

Constructor & Destructor Documentation

◆ RenderingInstanceView() [1/2]

donner::svg::RenderingInstanceView::RenderingInstanceView ( Registry & registry)
inlineexplicit

Constructor, takes a registry and snapshots every entity that currently has a components::RenderingInstanceComponent, in storage iteration order.

Parameters
registryThe registry to use.

◆ RenderingInstanceView() [2/2]

donner::svg::RenderingInstanceView::RenderingInstanceView ( Registry & registry,
std::span< const Entity > entities )
inline

Constructor taking an explicit ordered list of entities to iterate.

The view copies the list; subsequent storage mutations do not affect iteration. Entities must all currently have a components::RenderingInstanceComponentget() will dereference via storage lookup.

Parameters
registryThe registry to use.
entitiesOrdered entity list to iterate.

Member Function Documentation

◆ advance()

void donner::svg::RenderingInstanceView::advance ( )
inline

Advances the view to the next element.

Precondition
List has elements remaining done() is false.

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