diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-09-13 13:03:31 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-09-13 13:03:31 +0000 |
commit | 1d234f9778e73fbd8cbc6211757300416ef19b3f (patch) | |
tree | d92d3e7b9c5f4a8b78a0e35c2cd5531d7180372a /searchlib/src | |
parent | f6e8fb32ebd8859f9ac181f138e8f5d1b4cba700 (diff) |
Style changes and function renaming in enum store dictionary.
Diffstat (limited to 'searchlib/src')
7 files changed, 33 insertions, 44 deletions
diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index fe4b6ca1685..7ad3227917b 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -140,7 +140,7 @@ testUniques(const StringEnumStore& ses, const std::vector<std::string>& unique) { const auto* enumDict = dynamic_cast<const EnumStoreDictionary<DictionaryT>*>(&ses.get_dictionary()); assert(enumDict != nullptr); - const DictionaryT& dict = enumDict->getDictionary(); + const DictionaryT& dict = enumDict->get_raw_dictionary(); uint32_t i = 0; EnumIndex idx; for (typename DictionaryT::Iterator iter = dict.begin(); diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp index e490a0547e3..2a544814710 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp @@ -46,15 +46,8 @@ template <typename DictionaryT> EnumStoreDictionary<DictionaryT>::~EnumStoreDictionary() = default; template <typename DictionaryT> -uint32_t -EnumStoreDictionary<DictionaryT>::getNumUniques() const -{ - return this->_dict.size(); -} - -template <typename DictionaryT> void -EnumStoreDictionary<DictionaryT>::set_ref_counts(const EnumVector &hist) +EnumStoreDictionary<DictionaryT>::set_ref_counts(const EnumVector& hist) { _enumStore.set_ref_counts(hist, this->_dict); } @@ -86,8 +79,8 @@ EnumStoreDictionary<DictionaryT>::free_unused_values(const IndexSet& to_remove, template <typename DictionaryT> bool -EnumStoreDictionary<DictionaryT>::findIndex(const datastore::EntryComparator& cmp, - Index& idx) const +EnumStoreDictionary<DictionaryT>::find_index(const datastore::EntryComparator& cmp, + Index& idx) const { auto itr = this->_dict.find(Index(), cmp); if (!itr.valid()) { @@ -99,8 +92,8 @@ EnumStoreDictionary<DictionaryT>::findIndex(const datastore::EntryComparator& cm template <typename DictionaryT> bool -EnumStoreDictionary<DictionaryT>::findFrozenIndex(const datastore::EntryComparator& cmp, - Index& idx) const +EnumStoreDictionary<DictionaryT>::find_frozen_index(const datastore::EntryComparator& cmp, + Index& idx) const { auto itr = this->_dict.getFrozenView().find(Index(), cmp); if (!itr.valid()) { @@ -112,7 +105,7 @@ EnumStoreDictionary<DictionaryT>::findFrozenIndex(const datastore::EntryComparat template <typename DictionaryT> std::vector<IEnumStore::EnumHandle> -EnumStoreDictionary<DictionaryT>::findMatchingEnums(const datastore::EntryComparator& cmp) const +EnumStoreDictionary<DictionaryT>::find_matching_enums(const datastore::EntryComparator& cmp) const { std::vector<IEnumStore::EnumHandle> result; auto itr = this->_dict.getFrozenView().find(Index(), cmp); @@ -125,28 +118,28 @@ EnumStoreDictionary<DictionaryT>::findMatchingEnums(const datastore::EntryCompar template <> EnumPostingTree & -EnumStoreDictionary<EnumTree>::getPostingDictionary() +EnumStoreDictionary<EnumTree>::get_posting_dictionary() { LOG_ABORT("should not be reached"); } template <> EnumPostingTree & -EnumStoreDictionary<EnumPostingTree>::getPostingDictionary() +EnumStoreDictionary<EnumPostingTree>::get_posting_dictionary() { return _dict; } template <> const EnumPostingTree & -EnumStoreDictionary<EnumTree>::getPostingDictionary() const +EnumStoreDictionary<EnumTree>::get_posting_dictionary() const { LOG_ABORT("should not be reached"); } template <> const EnumPostingTree & -EnumStoreDictionary<EnumPostingTree>::getPostingDictionary() const +EnumStoreDictionary<EnumPostingTree>::get_posting_dictionary() const { return _dict; } @@ -160,7 +153,7 @@ EnumStoreFoldedDictionary::EnumStoreFoldedDictionary(IEnumStore& enumStore, std: EnumStoreFoldedDictionary::~EnumStoreFoldedDictionary() = default; UniqueStoreAddResult -EnumStoreFoldedDictionary::add(const EntryComparator &comp, std::function<EntryRef(void)> insertEntry) +EnumStoreFoldedDictionary::add(const EntryComparator& comp, std::function<EntryRef(void)> insertEntry) { auto it = _dict.lowerBound(EntryRef(), comp); if (it.valid() && !comp(EntryRef(), it.getKey())) { @@ -183,7 +176,7 @@ EnumStoreFoldedDictionary::add(const EntryComparator &comp, std::function<EntryR } void -EnumStoreFoldedDictionary::remove(const EntryComparator &comp, EntryRef ref) +EnumStoreFoldedDictionary::remove(const EntryComparator& comp, EntryRef ref) { assert(ref.valid()); auto it = _dict.lowerBound(ref, comp); diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h index bc109085758..5e7a63e68b4 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.h @@ -32,24 +32,22 @@ public: ~EnumStoreDictionary() override; - const DictionaryT &getDictionary() const { return this->_dict; } - DictionaryT &getDictionary() { return this->_dict; } + const DictionaryT& get_raw_dictionary() const { return this->_dict; } - uint32_t getNumUniques() const override; - void set_ref_counts(const EnumVector &hist) override; + void set_ref_counts(const EnumVector& hist) override; void free_unused_values(const datastore::EntryComparator& cmp) override; void free_unused_values(const IndexSet& to_remove, const datastore::EntryComparator& cmp) override; - bool findIndex(const datastore::EntryComparator& cmp, Index& idx) const override; - bool findFrozenIndex(const datastore::EntryComparator& cmp, Index& idx) const override; + bool find_index(const datastore::EntryComparator& cmp, Index& idx) const override; + bool find_frozen_index(const datastore::EntryComparator& cmp, Index& idx) const override; std::vector<attribute::IAttributeVector::EnumHandle> - findMatchingEnums(const datastore::EntryComparator& cmp) const override; + find_matching_enums(const datastore::EntryComparator& cmp) const override; - EnumPostingTree & getPostingDictionary() override; - const EnumPostingTree & getPostingDictionary() const override; + EnumPostingTree& get_posting_dictionary() override; + const EnumPostingTree& get_posting_dictionary() const override; }; /** diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h index 5e76780dc67..3c5f43f05ff 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h @@ -83,7 +83,7 @@ public: get_entry_base(idx).set_ref_count(ref_count); } - uint32_t get_num_uniques() const override { return _dict->getNumUniques(); } + uint32_t get_num_uniques() const override { return _dict->get_num_uniques(); } vespalib::MemoryUsage get_values_memory_usage() const override { return _store.get_allocator().get_data_store().getMemoryUsage(); } vespalib::MemoryUsage get_dictionary_memory_usage() const override { return _dict->get_memory_usage(); } @@ -100,8 +100,8 @@ public: IEnumStoreDictionary& get_dictionary() override { return *_dict; } const IEnumStoreDictionary& get_dictionary() const override { return *_dict; } - EnumPostingTree& get_posting_dictionary() { return _dict->getPostingDictionary(); } - const EnumPostingTree& get_posting_dictionary() const { return _dict->getPostingDictionary(); } + EnumPostingTree& get_posting_dictionary() { return _dict->get_posting_dictionary(); } + const EnumPostingTree& get_posting_dictionary() const { return _dict->get_posting_dictionary(); } bool get_value(Index idx, EntryType& value) const; EntryType get_value(uint32_t idx) const { return get_value(Index(EntryRef(idx))); } diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp index c8f5a916ceb..e39ecc17aac 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp @@ -169,7 +169,7 @@ EnumStoreT<EntryT>::find_enum(EntryType value, IEnumStore::EnumHandle& e) const { auto cmp = make_comparator(value); Index idx; - if (_dict->findFrozenIndex(cmp, idx)) { + if (_dict->find_frozen_index(cmp, idx)) { e = idx.ref(); return true; } @@ -181,7 +181,7 @@ std::vector<IEnumStore::EnumHandle> EnumStoreT<EntryT>::find_folded_enums(EntryType value) const { auto cmp = make_folded_comparator(value); - return _dict->findMatchingEnums(cmp); + return _dict->find_matching_enums(cmp); } template <typename EntryT> @@ -189,7 +189,7 @@ bool EnumStoreT<EntryT>::find_index(EntryType value, Index& idx) const { auto cmp = make_comparator(value); - return _dict->findIndex(cmp, idx); + return _dict->find_index(cmp, idx); } template <typename EntryT> diff --git a/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h b/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h index 837a866fcb5..a7784036a54 100644 --- a/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h +++ b/searchlib/src/vespa/searchlib/attribute/i_enum_store_dictionary.h @@ -37,19 +37,17 @@ public: public: virtual ~IEnumStoreDictionary() = default; - virtual uint32_t getNumUniques() const = 0; - virtual void set_ref_counts(const EnumVector& hist) = 0; virtual void free_unused_values(const datastore::EntryComparator& cmp) = 0; virtual void free_unused_values(const IndexSet& to_remove, const datastore::EntryComparator& cmp) = 0; - virtual bool findIndex(const datastore::EntryComparator& cmp, Index& idx) const = 0; - virtual bool findFrozenIndex(const datastore::EntryComparator& cmp, Index& idx) const = 0; + virtual bool find_index(const datastore::EntryComparator& cmp, Index& idx) const = 0; + virtual bool find_frozen_index(const datastore::EntryComparator& cmp, Index& idx) const = 0; virtual std::vector<attribute::IAttributeVector::EnumHandle> - findMatchingEnums(const datastore::EntryComparator& cmp) const = 0; + find_matching_enums(const datastore::EntryComparator& cmp) const = 0; - virtual EnumPostingTree& getPostingDictionary() = 0; - virtual const EnumPostingTree& getPostingDictionary() const = 0; + virtual EnumPostingTree& get_posting_dictionary() = 0; + virtual const EnumPostingTree& get_posting_dictionary() const = 0; }; } diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp index 4646ada7044..21bbec729df 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp @@ -14,10 +14,10 @@ PostingListAttributeBase<P>:: PostingListAttributeBase(AttributeVector &attr, IEnumStore &enumStore) : attribute::IPostingListAttributeBase(), - _postingList(enumStore.get_dictionary().getPostingDictionary(), attr.getStatus(), + _postingList(enumStore.get_dictionary().get_posting_dictionary(), attr.getStatus(), attr.getConfig()), _attr(attr), - _dict(enumStore.get_dictionary().getPostingDictionary()), + _dict(enumStore.get_dictionary().get_posting_dictionary()), _esb(enumStore) { } |