Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
impeller::CapturePlaybackList< Type > Class Template Reference

#include <capture.h>

Public Member Functions

 CapturePlaybackList ()=default
 
 ~CapturePlaybackList ()
 
void Rewind ()
 
size_t Count ()
 
std::shared_ptr< TypeGetNext (std::shared_ptr< Type > captured, bool force_overwrite)
 
std::shared_ptr< TypeFindFirstByLabel (const std::string &label)
 
void Iterate (std::function< void(Type &)> iterator) const
 

Detailed Description

template<typename Type>
class impeller::CapturePlaybackList< Type >

Definition at line 134 of file capture.h.

Constructor & Destructor Documentation

◆ CapturePlaybackList()

template<typename Type >
impeller::CapturePlaybackList< Type >::CapturePlaybackList ( )
default

◆ ~CapturePlaybackList()

template<typename Type >
impeller::CapturePlaybackList< Type >::~CapturePlaybackList ( )
inline

Definition at line 138 of file capture.h.

138 {
139 // Force the list element type to inherit the CRTP type. We can't enforce
140 // this as a template requirement directly because `CaptureElement` has a
141 // recursive `CaptureCursorList<CaptureElement>` property, and so the
142 // compiler fails the check due to the type being incomplete.
143 static_assert(std::is_base_of_v<CaptureCursorListElement<Type>, Type>);
144 }

Member Function Documentation

◆ Count()

template<typename Type >
size_t impeller::CapturePlaybackList< Type >::Count ( )
inline

Definition at line 148 of file capture.h.

148{ return values_.size(); }

◆ FindFirstByLabel()

template<typename Type >
std::shared_ptr< Type > impeller::CapturePlaybackList< Type >::FindFirstByLabel ( const std::string &  label)
inline

Definition at line 173 of file capture.h.

173 {
174 for (std::shared_ptr<Type>& value : values_) {
175 if (value->label == label) {
176 return value;
177 }
178 }
179 return nullptr;
180 }
uint8_t value

◆ GetNext()

template<typename Type >
std::shared_ptr< Type > impeller::CapturePlaybackList< Type >::GetNext ( std::shared_ptr< Type captured,
bool  force_overwrite 
)
inline

Definition at line 150 of file capture.h.

151 {
152 if (cursor_ < values_.size()) {
153 std::shared_ptr<Type>& result = values_[cursor_];
154
155 if (result->MatchesCloselyEnough(*captured)) {
156 if (force_overwrite) {
157 values_[cursor_] = captured;
158 }
159 // Safe playback is possible.
160 ++cursor_;
161 return result;
162 }
163 // The data has changed too much from the last capture to safely continue
164 // playback. Discard this and all subsequent elements to re-record.
165 values_.resize(cursor_);
166 }
167
168 ++cursor_;
169 values_.push_back(captured);
170 return captured;
171 }
GAsyncResult * result

◆ Iterate()

template<typename Type >
void impeller::CapturePlaybackList< Type >::Iterate ( std::function< void(Type &)>  iterator) const
inline

Definition at line 182 of file capture.h.

182 {
183 for (auto& value : values_) {
184 iterator(*value);
185 }
186 }

◆ Rewind()

template<typename Type >
void impeller::CapturePlaybackList< Type >::Rewind ( )
inline

Definition at line 146 of file capture.h.

146{ cursor_ = 0; }

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