diff options
-rw-r--r-- | searchlib/src/vespa/searchlib/grouping/collect.cpp | 11 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/grouping/collect.h | 18 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/data/memorydatastore.h | 1 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/objects/nbostream.h | 8 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/rcuvector.h | 2 |
5 files changed, 16 insertions, 24 deletions
diff --git a/searchlib/src/vespa/searchlib/grouping/collect.cpp b/searchlib/src/vespa/searchlib/grouping/collect.cpp index d0a9a38bf7d..464362602f2 100644 --- a/searchlib/src/vespa/searchlib/grouping/collect.cpp +++ b/searchlib/src/vespa/searchlib/grouping/collect.cpp @@ -1,7 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "collect.h" -#include <vespa/vespalib/util/array.hpp> #include <cassert> using namespace search::expression; @@ -48,8 +47,7 @@ Collect::~Collect() assert((_aggrBacking.size() % _aggregatorSize) == 0); for (size_t i(0), m(_aggrBacking.size()/_aggregatorSize); i < m; i++) { uint8_t * base(&_aggrBacking[ i * _aggregatorSize]); - for (size_t j(0), k(_aggregator.size()); j < k; j++) { - ResultAccessor & r = _aggregator[j]; + for (auto & r : _aggregator) { r.destroy(base); } } @@ -74,8 +72,8 @@ void Collect::collect(GroupRef gr, uint32_t docId, double rank) { uint8_t * base(&_aggrBacking[getAggrBase(gr)]); - for (size_t i(0), m(_aggregator.size()); i < m; i++) { - _aggregator[i].aggregate(base, docId, rank); + for (auto & i : _aggregator) { + i.aggregate(base, docId, rank); } } @@ -86,8 +84,7 @@ Collect::createCollectors(GroupRef gr) if (offset == _aggrBacking.size()) { _aggrBacking.resize(getAggrBase(GroupRef(gr.getRef() + 1))); uint8_t * base(&_aggrBacking[offset]); - for (size_t i(0), m(_aggregator.size()); i < m; i++) { - ResultAccessor & r = _aggregator[i]; + for (auto & r : _aggregator) { r.create(base); } } diff --git a/searchlib/src/vespa/searchlib/grouping/collect.h b/searchlib/src/vespa/searchlib/grouping/collect.h index 3566d21f821..932cf559156 100644 --- a/searchlib/src/vespa/searchlib/grouping/collect.h +++ b/searchlib/src/vespa/searchlib/grouping/collect.h @@ -13,7 +13,7 @@ public: Collect(const Collect &) = delete; Collect & operator = (const Collect &) = delete; protected: - Collect(const aggregation::Group & protoType); + explicit Collect(const aggregation::Group & protoType); ~Collect(); void preFill(GroupRef gr, const aggregation::Group & r); void createCollectors(GroupRef gr); @@ -55,9 +55,9 @@ private: */ class ResultAccessor { public: - ResultAccessor() : _bluePrint(NULL), _aggregator(NULL), _offset(0) { } + ResultAccessor() noexcept : _bluePrint(nullptr), _aggregator(nullptr), _offset(0) { } ResultAccessor(const aggregation::AggregationResult & aggregator, size_t offset); - void setResult(const expression::ResultNode & result, uint8_t * base) { + void setResult(const expression::ResultNode & result, uint8_t * base) const { result.encode(base+_offset); } const expression::ResultNode & getResult(expression::ResultNode & result, const uint8_t * base) const { @@ -86,8 +86,8 @@ private: mutable vespalib::IdentifiablePtr<aggregation::AggregationResult> _aggregator; uint32_t _offset; }; - using AggregatorBacking = vespalib::Array<uint8_t>; - using ResultAccessorList = vespalib::Array<ResultAccessor>; + using AggregatorBacking = std::vector<uint8_t>; + using ResultAccessorList = std::vector<ResultAccessor>; class SortInfo { public: SortInfo() noexcept : _index(0), _sign(1) { } @@ -98,10 +98,10 @@ private: uint8_t _index; // Which index in the aggragators should be used for sorting this level. int8_t _sign; // And which way. positive number -> ascending, negative number descending. }; - size_t _aggregatorSize; // This is the bytesize required to store the aggrgate values per bucket. - ResultAccessorList _aggregator; // These are the accessors to use when accessing the results. - AggregatorBacking _aggrBacking; // This is the storage for the accessors. - std::vector<SortInfo> _sortInfo; // Generated cheap sortInfo, to avoid accessing more complicated data. + size_t _aggregatorSize; // This is the bytesize required to store the aggrgate values per bucket. + ResultAccessorList _aggregator; // These are the accessors to use when accessing the results. + AggregatorBacking _aggrBacking; // This is the storage for the accessors. + std::vector<SortInfo> _sortInfo; // Generated cheap sortInfo, to avoid accessing more complicated data. }; } diff --git a/vespalib/src/vespa/vespalib/data/memorydatastore.h b/vespalib/src/vespa/vespalib/data/memorydatastore.h index 0bf2becf7c3..3682e3629e3 100644 --- a/vespalib/src/vespa/vespalib/data/memorydatastore.h +++ b/vespalib/src/vespa/vespalib/data/memorydatastore.h @@ -2,7 +2,6 @@ #pragma once #include <vespa/vespalib/util/alloc.h> -#include <vespa/vespalib/util/array.h> #include <vector> #include <mutex> diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h index ab02e7c1f05..f66c261ae91 100644 --- a/vespalib/src/vespa/vespalib/objects/nbostream.h +++ b/vespalib/src/vespa/vespalib/objects/nbostream.h @@ -107,17 +107,13 @@ public: } template <typename T, typename U> - nbostream & - operator<<(const std::pair<T, U> &val) - { + nbostream & operator<<(const std::pair<T, U> &val) { *this << val.first << val.second; return *this; } template <typename T, typename U> - nbostream & - operator>>(std::pair<T, U> &val) - { + nbostream & operator>>(std::pair<T, U> &val) { *this >> val.first >> val.second; return *this; } diff --git a/vespalib/src/vespa/vespalib/util/rcuvector.h b/vespalib/src/vespa/vespalib/util/rcuvector.h index dcd3fcd8052..787fb2d00c6 100644 --- a/vespalib/src/vespa/vespalib/util/rcuvector.h +++ b/vespalib/src/vespa/vespalib/util/rcuvector.h @@ -19,7 +19,7 @@ class RcuVectorHeld : public GenerationHeldBase public: RcuVectorHeld(size_t size, T&& data); - ~RcuVectorHeld(); + ~RcuVectorHeld() override; }; |