Updated OnceCursor
This commit is contained in:
parent
e5d892683c
commit
23bfd7f4fc
@ -41,6 +41,11 @@ MultiFrame::MultiFrame(const MultiFrame &other) {
|
||||
// NOLINTNEXTLINE (bugprone-exception-escape)
|
||||
MultiFrame::MultiFrame(MultiFrame &&other) noexcept : frames_(std::move(other.frames_)) {}
|
||||
|
||||
FrameWithValidity &MultiFrame::GetFirstFrame() {
|
||||
MG_ASSERT(!frames_.empty());
|
||||
return frames_.front();
|
||||
}
|
||||
|
||||
void MultiFrame::MakeAllFramesInvalid() noexcept {
|
||||
std::for_each(frames_.begin(), frames_.end(), [](auto &frame) { frame.MakeInvalid(); });
|
||||
}
|
||||
|
@ -71,6 +71,13 @@ class MultiFrame {
|
||||
*/
|
||||
InvalidFramesPopulator GetInvalidFramesPopulator();
|
||||
|
||||
/**
|
||||
* Return the first Frame of the MultiFrame. This is only meant to be used in very specific cases. Please consider
|
||||
* using the iterators instead.
|
||||
* The Frame can be valid or invalid.
|
||||
*/
|
||||
FrameWithValidity &GetFirstFrame();
|
||||
|
||||
void MakeAllFramesInvalid() noexcept;
|
||||
|
||||
bool HasValidFrame() const noexcept;
|
||||
|
@ -267,14 +267,11 @@ bool Once::OnceCursor::Pull(Frame &, ExecutionContext &context) {
|
||||
void Once::OnceCursor::PullMultiple(MultiFrame &multi_frame, ExecutionContext &context) {
|
||||
SCOPED_PROFILE_OP("OnceMF");
|
||||
|
||||
auto iterator_for_valid_frame_only = multi_frame.GetValidFramesConsumer();
|
||||
auto first_it = iterator_for_valid_frame_only.begin();
|
||||
MG_ASSERT(first_it != iterator_for_valid_frame_only.end());
|
||||
if (!did_pull_) {
|
||||
auto *memory_resource = multi_frame.GetMemoryResource();
|
||||
auto &frame = *first_it;
|
||||
frame.MakeValid();
|
||||
for (auto &value : frame.elems()) {
|
||||
auto &first_frame = multi_frame.GetFirstFrame();
|
||||
auto *memory_resource = first_frame.GetMemoryResource();
|
||||
first_frame.MakeValid();
|
||||
for (auto &value : first_frame.elems()) {
|
||||
value = TypedValue{memory_resource};
|
||||
}
|
||||
did_pull_ = true;
|
||||
|
Loading…
Reference in New Issue
Block a user