diff --git a/src/fdb5/database/Key.cc b/src/fdb5/database/Key.cc index d88a74986..d3f73ed81 100644 --- a/src/fdb5/database/Key.cc +++ b/src/fdb5/database/Key.cc @@ -134,14 +134,6 @@ void BaseKey::popFrom(const BaseKey& other) { for (const auto& [keyword, value] : other) { pop(keyword); } } -void Key::pushFrom(const Key& other) { - for (const auto& [keyword, value] : Reverse(other)) { push(keyword, value); } -} - -void Key::popFrom(const Key& other) { - for (const auto& [keyword, value] : other) { pop(keyword); } -} - const std::string &BaseKey::get( const std::string &k ) const { eckit::StringDict::const_iterator i = keys_.find(k); if ( i == keys_.end() ) { diff --git a/src/fdb5/database/Key.h b/src/fdb5/database/Key.h index 9a7c1f9ca..2d5b436c9 100644 --- a/src/fdb5/database/Key.h +++ b/src/fdb5/database/Key.h @@ -68,8 +68,9 @@ class BaseKey { void push(const std::string &k, const std::string &v); void pop(const std::string &k); - void pushFrom(const Key& other); - void popFrom(const Key& other); + + void pushFrom(const BaseKey& other); + void popFrom(const BaseKey& other); const std::string& get( const std::string &k ) const; diff --git a/src/fdb5/rules/Matcher.cc b/src/fdb5/rules/Matcher.cc index ab332d3b9..7590e22ad 100644 --- a/src/fdb5/rules/Matcher.cc +++ b/src/fdb5/rules/Matcher.cc @@ -19,12 +19,6 @@ namespace fdb5 { //---------------------------------------------------------------------------------------------------------------------- -Matcher::Matcher() { -} - -Matcher::~Matcher() { -} - bool Matcher::optional() const { return false; } diff --git a/src/fdb5/rules/Matcher.h b/src/fdb5/rules/Matcher.h index 57b1b2f27..c61cc6c6c 100644 --- a/src/fdb5/rules/Matcher.h +++ b/src/fdb5/rules/Matcher.h @@ -31,7 +31,6 @@ namespace fdb5 { class Key; class TypedKey; -class Key; class TypesRegistry; //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/fdb5/rules/Schema.cc b/src/fdb5/rules/Schema.cc index d4cdbf133..c22827d47 100644 --- a/src/fdb5/rules/Schema.cc +++ b/src/fdb5/rules/Schema.cc @@ -53,21 +53,21 @@ Schema::~Schema() { //---------------------------------------------------------------------------------------------------------------------- -const Rule* Schema::matchingRule(const Key& dbKey, const Key& idxKey) const { +const RuleDatum& Schema::matchingRule(const Key& dbKey, const Key& idxKey) const { for (const auto& dbRule : rules_) { if (!dbRule.match(dbKey)) { continue; } for (const auto& idxRule : dbRule.rules()) { if (idxRule.match(idxKey)) { /// @note this assumes that there is only one datum per index - for (const auto& datumRule : idxRule.rules()) { return &datumRule; } + for (const auto& datumRule : idxRule.rules()) { return datumRule; } } } } - LOG_DEBUG_LIB(LibFdb5) << "No rule is matching dbKey=" << dbKey << " and idxKey=" << idxKey << std::endl; - - return nullptr; + std::ostringstream msg; + msg << "No rule is matching dbKey=" << dbKey << " and idxKey=" << idxKey << std::endl; + throw eckit::SeriousBug(msg.str(), Here()); } const RuleDatabase& Schema::matchingRule(const Key& dbKey) const { @@ -76,7 +76,7 @@ const RuleDatabase& Schema::matchingRule(const Key& dbKey) const { if (rule.match(dbKey)) { return rule; } } - std::stringstream msg; + std::ostringstream msg; msg << "No rule exists for key " << dbKey; throw eckit::SeriousBug(msg.str(), Here()); } diff --git a/src/fdb5/rules/Schema.h b/src/fdb5/rules/Schema.h index 8fccf5b3d..5e09346b0 100644 --- a/src/fdb5/rules/Schema.h +++ b/src/fdb5/rules/Schema.h @@ -70,8 +70,7 @@ class Schema : private eckit::NonCopyable { const RuleDatabase& matchingRule(const Key& dbKey) const; - /// @todo return RuleDatum - const Rule* matchingRule(const Key& dbKey, const Key& idxKey) const; + const RuleDatum& matchingRule(const Key& dbKey, const Key& idxKey) const; void load(const eckit::PathName& path, bool replace = false); diff --git a/src/fdb5/tools/fdb-overlay.cc b/src/fdb5/tools/fdb-overlay.cc index 6584e9cc8..5adb126c4 100644 --- a/src/fdb5/tools/fdb-overlay.cc +++ b/src/fdb5/tools/fdb-overlay.cc @@ -117,7 +117,7 @@ void FdbOverlay::execute(const CmdArgs& args) { } } - std::unique_ptr dbSource = DB::buildReader(source.canonical(), conf); + std::unique_ptr dbSource = DB::buildReader(source, conf); if (!dbSource->exists()) { std::stringstream ss; ss << "Source database not found: " << source << std::endl; @@ -130,7 +130,7 @@ void FdbOverlay::execute(const CmdArgs& args) { throw eckit::UserError(ss.str(), Here()); } - std::unique_ptr dbTarget = DB::buildReader(target.canonical(), conf); + std::unique_ptr dbTarget = DB::buildReader(target, conf); if (remove_) { if (!dbTarget->exists()) { diff --git a/src/fdb5/types/TypesRegistry.h b/src/fdb5/types/TypesRegistry.h index 9745a4f4e..e127b8bdb 100644 --- a/src/fdb5/types/TypesRegistry.h +++ b/src/fdb5/types/TypesRegistry.h @@ -16,13 +16,10 @@ #ifndef fdb5_TypesRegistry_H #define fdb5_TypesRegistry_H -#include +#include #include -#include #include -#include - -#include "eckit/memory/NonCopyable.h" +#include namespace fdb5 { @@ -30,12 +27,18 @@ class Type; //---------------------------------------------------------------------------------------------------------------------- -class TypesRegistry : private eckit::NonCopyable { +class TypesRegistry { public: // methods TypesRegistry(); + TypesRegistry(const TypesRegistry&) = delete; + TypesRegistry& operator=(const TypesRegistry&) = delete; + + TypesRegistry(TypesRegistry&&) = default; + TypesRegistry& operator=(TypesRegistry&&) = default; + ~TypesRegistry(); const Type &lookupType(const std::string &keyword) const; @@ -45,7 +48,6 @@ class TypesRegistry : private eckit::NonCopyable { void dump( std::ostream &out ) const; void dump( std::ostream &out, const std::string &keyword ) const; - private: // members typedef std::map TypeMap; @@ -57,8 +59,7 @@ class TypesRegistry : private eckit::NonCopyable { friend std::ostream &operator<<(std::ostream &s, const TypesRegistry &x); - void print( std::ostream &out ) const; - + void print(std::ostream& out) const; }; //----------------------------------------------------------------------------------------------------------------------