diff options
author | Henning Baldersheim <balder@oath.com> | 2018-07-25 12:51:35 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-07-25 12:51:35 +0200 |
commit | 5bf7c17054cab0f8953e72615b0c1ef3cb734ff8 (patch) | |
tree | 4daccffee35d2b6092ec475490e0d9d16a6b218b /searchcore | |
parent | e3af3d215feb1e416b27b92bbf421dde281f3a09 (diff) |
Nested namespaces
Diffstat (limited to 'searchcore')
5 files changed, 22 insertions, 39 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/i_match_loop_communicator.h b/searchcore/src/vespa/searchcore/proton/matching/i_match_loop_communicator.h index 04440831045..c22232d47db 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/i_match_loop_communicator.h +++ b/searchcore/src/vespa/searchcore/proton/matching/i_match_loop_communicator.h @@ -2,14 +2,12 @@ #pragma once -#include <vespa/searchlib/common/feature.h> #include <vespa/searchlib/queryeval/scores.h> #include <utility> #include <cstddef> #include <vector> -namespace proton { -namespace matching { +namespace proton::matching { struct IMatchLoopCommunicator { typedef search::feature_t feature_t; @@ -31,6 +29,4 @@ struct IMatchLoopCommunicator { virtual ~IMatchLoopCommunicator() {} }; -} // namespace matching -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp index fa41c73838b..c3c3895cfbe 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp @@ -3,15 +3,14 @@ #include "match_loop_communicator.h" #include <vespa/vespalib/util/priority_queue.h> -namespace proton { -namespace matching { +namespace proton:: matching { MatchLoopCommunicator::MatchLoopCommunicator(size_t threads, size_t topN) : _estimate_match_frequency(threads), _selectBest(threads, topN), _rangeCover(threads) {} -MatchLoopCommunicator::~MatchLoopCommunicator() {} +MatchLoopCommunicator::~MatchLoopCommunicator() = default; void MatchLoopCommunicator::EstimateMatchFrequency::mingle() @@ -72,5 +71,4 @@ MatchLoopCommunicator::RangeCover::mingle() } } -} // namespace matching -} // namespace proton +}
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h index 3b83cb471f7..c1eec37299f 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h @@ -5,8 +5,7 @@ #include "i_match_loop_communicator.h" #include <vespa/vespalib/util/rendezvous.h> -namespace proton { -namespace matching { +namespace proton::matching { class MatchLoopCommunicator : public IMatchLoopCommunicator { @@ -14,13 +13,13 @@ private: struct EstimateMatchFrequency : vespalib::Rendezvous<Matches, double> { EstimateMatchFrequency(size_t n) : vespalib::Rendezvous<Matches, double>(n) {} - virtual void mingle() override; + void mingle() override; }; struct SelectBest : vespalib::Rendezvous<std::vector<feature_t>, size_t> { size_t topN; SelectBest(size_t n, size_t topN_in) : vespalib::Rendezvous<std::vector<feature_t>, size_t>(n), topN(topN_in) {} - virtual void mingle() override; + void mingle() override; bool cmp(const uint32_t &a, const uint32_t &b) { return (in(a)[out(a)] > in(b)[out(b)]); } @@ -34,8 +33,7 @@ private: }; struct RangeCover : vespalib::Rendezvous<RangePair, RangePair> { RangeCover(size_t n) - : vespalib::Rendezvous<RangePair, RangePair>(n) {} - virtual void mingle() override; + : vespalib::Rendezvous<RangePair, RangePair>(n) {}void mingle() override; }; EstimateMatchFrequency _estimate_match_frequency; SelectBest _selectBest; @@ -45,17 +43,15 @@ public: MatchLoopCommunicator(size_t threads, size_t topN); ~MatchLoopCommunicator(); - virtual double estimate_match_frequency(const Matches &matches) override { + double estimate_match_frequency(const Matches &matches) override { return _estimate_match_frequency.rendezvous(matches); } - virtual size_t selectBest(const std::vector<feature_t> &sortedScores) override { + size_t selectBest(const std::vector<feature_t> &sortedScores) override { return _selectBest.rendezvous(sortedScores); } - virtual RangePair rangeCover(const RangePair &ranges) override { + RangePair rangeCover(const RangePair &ranges) override { return _rangeCover.rendezvous(ranges); } }; -} // namespace matching -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp index 370c4b930e1..0eb49aec754 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp @@ -10,8 +10,7 @@ #include <vespa/log/log.h> LOG_SETUP(".proton.matching.match_master"); -namespace proton { -namespace matching { +namespace proton::matching { using namespace search::fef; using search::queryeval::SearchIterator; @@ -23,15 +22,15 @@ struct TimedMatchLoopCommunicator : IMatchLoopCommunicator { IMatchLoopCommunicator &communicator; fastos::StopWatch rerank_time; TimedMatchLoopCommunicator(IMatchLoopCommunicator &com) : communicator(com) {} - virtual double estimate_match_frequency(const Matches &matches) override { + double estimate_match_frequency(const Matches &matches) override { return communicator.estimate_match_frequency(matches); } - virtual size_t selectBest(const std::vector<feature_t> &sortedScores) override { + size_t selectBest(const std::vector<feature_t> &sortedScores) override { size_t result = communicator.selectBest(sortedScores); rerank_time.start(); return result; } - virtual RangePair rangeCover(const RangePair &ranges) override { + RangePair rangeCover(const RangePair &ranges) override { RangePair result = communicator.rangeCover(ranges); rerank_time.stop(); return result; @@ -131,18 +130,15 @@ MatchMaster::getFeatureSet(const MatchToolsFactory &matchToolsFactory, if (search.seek(docs[i])) { uint32_t docId = search.getDocId(); search.unpack(docId); - search::feature_t * f = fs.getFeaturesByIndex( - fs.addDocId(docId)); + search::feature_t * f = fs.getFeaturesByIndex(fs.addDocId(docId)); for (uint32_t j = 0; j < featureNames.size(); ++j) { f[j] = resolver.resolve(j).as_number(docId); } } else { - LOG(debug, "getFeatureSet: Did not find hit for docid '%u'. " - "Skipping hit", docs[i]); + LOG(debug, "getFeatureSet: Did not find hit for docid '%u'. Skipping hit", docs[i]); } } return retval; } -} // namespace proton::matching -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.h b/searchcore/src/vespa/searchcore/proton/matching/match_master.h index b9980023259..4c6463cf75d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_master.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.h @@ -8,8 +8,7 @@ namespace vespalib { class ThreadBundle; } namespace search { class FeatureSet; } -namespace proton { -namespace matching { +namespace proton::matching { class MatchToolsFactory; class MatchParams; @@ -37,6 +36,4 @@ public: static MatchingStats getStats(MatchMaster && rhs) { return std::move(rhs._stats); } }; -} // namespace proton::matching -} // namespace proton - +} |