Skip to content

Commit

Permalink
reverted to Store* in EntryVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Dec 20, 2024
1 parent 4ea6a5b commit b07fa9f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/fdb5/api/local/QueryVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef fdb5_api_local_QueryVisitor_H
#define fdb5_api_local_QueryVisitor_H

#include "fdb5/database/Store.h"
#include "fdb5/database/EntryVisitMechanism.h"

#include "eckit/container/Queue.h"
Expand Down
13 changes: 9 additions & 4 deletions src/fdb5/database/EntryVisitMechanism.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,26 @@ class FDBVisitException : public eckit::Exception {

//----------------------------------------------------------------------------------------------------------------------

EntryVisitor::~EntryVisitor() {}
EntryVisitor::~EntryVisitor() {
if (currentStore_) {
delete currentStore_;
}
}

EntryVisitor::EntryVisitor() : currentCatalogue_(nullptr), currentStore_(nullptr), currentIndex_(nullptr) {}

Store& EntryVisitor::store() const {
if (!currentStore_) {
ASSERT(currentCatalogue_);
currentStore_ = currentCatalogue_->buildStore();
currentStore_ = currentCatalogue_->buildStore().release();
ASSERT(currentStore_);
}
return *currentStore_;
}

bool EntryVisitor::visitDatabase(const Catalogue& catalogue) {
currentCatalogue_ = &catalogue;
currentStore_.reset();
currentStore_ = nullptr;
currentIndex_ = nullptr;
rule_ = nullptr;
return true;
Expand All @@ -59,7 +63,8 @@ void EntryVisitor::catalogueComplete(const Catalogue& catalogue) {
ASSERT(currentCatalogue_ == &catalogue);
}
currentCatalogue_ = nullptr;
currentStore_.reset();
delete currentStore_;
currentStore_ = nullptr;
currentIndex_ = nullptr;
rule_ = nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/database/EntryVisitMechanism.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class EntryVisitor : public eckit::NonCopyable {
/// Non-owning
const Catalogue* currentCatalogue_ = nullptr;
/// Owned store
mutable std::unique_ptr<Store> currentStore_ = nullptr;
mutable Store* currentStore_ = nullptr;
/// Non-owning
const Index* currentIndex_ = nullptr;
/// Non-owning
Expand Down

0 comments on commit b07fa9f

Please sign in to comment.