Rename ItOnNonConstValidFrames -> ValidFramesInvalidator

This commit is contained in:
jeremy 2022-11-29 10:38:01 +01:00
parent 11119e5406
commit 7c37ed2313
2 changed files with 18 additions and 18 deletions

View File

@ -80,7 +80,7 @@ void MultiFrame::DefragmentValidFrames() noexcept {
ValidFramesReader MultiFrame::GetValidFramesReader() { return ValidFramesReader(*this); }
ItOnNonConstValidFrames MultiFrame::GetItOnNonConstValidFrames() { return ItOnNonConstValidFrames(*this); }
ValidFramesInvalidator MultiFrame::GetValidFramesInvalidator() { return ValidFramesInvalidator(*this); }
ItOnNonConstInvalidFrames MultiFrame::GetItOnNonConstInvalidFrames() { return ItOnNonConstInvalidFrames(*this); }
@ -93,17 +93,17 @@ ValidFramesReader::Iterator ValidFramesReader::end() {
return Iterator(&multiframe_.frames_[multiframe_.frames_.size()], *this);
}
ItOnNonConstValidFrames::ItOnNonConstValidFrames(MultiFrame &multiframe) : multiframe_(multiframe) {}
ValidFramesInvalidator::ValidFramesInvalidator(MultiFrame &multiframe) : multiframe_(multiframe) {}
ItOnNonConstValidFrames::~ItOnNonConstValidFrames() {
ValidFramesInvalidator::~ValidFramesInvalidator() {
// #NoCommit possible optimisation: only DefragmentValidFrames if one frame has been invalidated? Only if does not
// cost too much to store it
multiframe_.DefragmentValidFrames();
}
ItOnNonConstValidFrames::Iterator ItOnNonConstValidFrames::begin() { return Iterator(&multiframe_.frames_[0], *this); }
ValidFramesInvalidator::Iterator ValidFramesInvalidator::begin() { return Iterator(&multiframe_.frames_[0], *this); }
ItOnNonConstValidFrames::Iterator ItOnNonConstValidFrames::end() {
ValidFramesInvalidator::Iterator ValidFramesInvalidator::end() {
return Iterator(&multiframe_.frames_[multiframe_.frames_.size()], *this);
}

View File

@ -19,13 +19,13 @@ namespace memgraph::query::v2 {
constexpr unsigned long kNumberOfFramesInMultiframe = 1000; // #NoCommit have it configurable
class ValidFramesReader;
class ItOnNonConstValidFrames;
class ValidFramesInvalidator;
class ItOnNonConstInvalidFrames;
class MultiFrame {
public:
friend class ValidFramesReader;
friend class ItOnNonConstValidFrames;
friend class ValidFramesInvalidator;
friend class ItOnNonConstInvalidFrames;
MultiFrame(FrameWithValidity default_frame, size_t number_of_frames, utils::MemoryResource *execution_memory);
@ -49,9 +49,9 @@ class MultiFrame {
state in the multiframe.
Iteration goes in a deterministic order.
One can modify the validity of the frame with this implementation.
If you do not plan to modify the validity of the frames, use GetReader instead as this is faster.
If you do not plan to modify the validity of the frames, use GetValidFramesReader instead as this is faster.
*/
ItOnNonConstValidFrames GetItOnNonConstValidFrames();
ValidFramesInvalidator GetValidFramesInvalidator();
/*!
Returns a object on which one can iterate in a for-loop. By doing so, you will only get frames that are in an invalid
@ -122,15 +122,15 @@ class ValidFramesReader {
MultiFrame &multiframe_;
};
class ItOnNonConstValidFrames {
class ValidFramesInvalidator {
public:
ItOnNonConstValidFrames(MultiFrame &multiframe);
ValidFramesInvalidator(MultiFrame &multiframe);
~ItOnNonConstValidFrames();
ItOnNonConstValidFrames(const ItOnNonConstValidFrames &other) = delete; // copy constructor
ItOnNonConstValidFrames(ItOnNonConstValidFrames &&other) noexcept = delete; // move constructor
ItOnNonConstValidFrames &operator=(const ItOnNonConstValidFrames &other) = delete; // copy assignment
ItOnNonConstValidFrames &operator=(ItOnNonConstValidFrames &&other) noexcept = delete; // move assignment
~ValidFramesInvalidator();
ValidFramesInvalidator(const ValidFramesInvalidator &other) = delete; // copy constructor
ValidFramesInvalidator(ValidFramesInvalidator &&other) noexcept = delete; // move constructor
ValidFramesInvalidator &operator=(const ValidFramesInvalidator &other) = delete; // copy assignment
ValidFramesInvalidator &operator=(ValidFramesInvalidator &&other) noexcept = delete; // move assignment
struct Iterator {
using iterator_category = std::forward_iterator_tag;
@ -140,7 +140,7 @@ class ItOnNonConstValidFrames {
using reference = FrameWithValidity &;
using internal_ptr = FrameWithValidity *;
Iterator(internal_ptr ptr, ItOnNonConstValidFrames &iterator_wrapper)
Iterator(internal_ptr ptr, ValidFramesInvalidator &iterator_wrapper)
: ptr_(ptr), iterator_wrapper_(iterator_wrapper) {}
reference operator*() const { return *ptr_; }
@ -160,7 +160,7 @@ class ItOnNonConstValidFrames {
private:
internal_ptr ptr_;
ItOnNonConstValidFrames &iterator_wrapper_;
ValidFramesInvalidator &iterator_wrapper_;
};
Iterator begin();