diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-17 01:56:14 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-17 01:56:14 +0000 |
commit | 44893be74613750170805584db4c30794ba84018 (patch) | |
tree | 69f5f55dae9ed94ce788a98ea7e463ea67b26196 /document | |
parent | 3ca3a4654c8f54d6a6a88fcc2ff08660a9940f10 (diff) |
Add vector as gcc 6 provides less by default.
Diffstat (limited to 'document')
-rw-r--r-- | document/src/vespa/document/select/resultset.h | 84 |
1 files changed, 19 insertions, 65 deletions
diff --git a/document/src/vespa/document/select/resultset.h b/document/src/vespa/document/select/resultset.h index 91f3e1c34a9..b3e4d8c4066 100644 --- a/document/src/vespa/document/select/resultset.h +++ b/document/src/vespa/document/select/resultset.h @@ -2,12 +2,11 @@ #pragma once #include <string> +#include <vector> #include "result.h" -namespace document -{ -namespace select -{ +namespace document { +namespace select { /* * Contains possible values of operations returning a Result. @@ -23,101 +22,56 @@ class ResultSet static std::vector<ResultSet> _ors; static std::vector<ResultSet> _nots; public: - ResultSet(void) - : _val(0u) - { - } + ResultSet() : _val(0u) { } - static uint32_t - enumToMask(uint32_t rhs) - { + static uint32_t enumToMask(uint32_t rhs) { return 1u << rhs; } - static uint32_t - illegalMask(void) - { + static uint32_t illegalMask() { return (1u << Result::enumRange()); } - void - add(const Result &rhs) - { + void add(const Result &rhs) { _val |= enumToMask(rhs.toEnum()); } - bool - hasEnum(uint32_t rhs) const - { + bool hasEnum(uint32_t rhs) const { return (_val & enumToMask(rhs)) != 0u; } - bool - hasResult(const Result &rhs) const - { + bool hasResult(const Result &rhs) const { return hasEnum(rhs.toEnum()); } - bool - operator==(const ResultSet &rhs) const - { + bool operator==(const ResultSet &rhs) const { return _val == rhs._val; } - bool - operator!=(const ResultSet &rhs) const - { + bool operator!=(const ResultSet &rhs) const { return _val != rhs._val; } // calculcate set of results emitted by document selection and operator. - ResultSet - calcAnd(const ResultSet &rhs) const - { + ResultSet calcAnd(const ResultSet &rhs) const { return _ands[(_val << Result::enumRange()) | rhs._val]; } // calculcate set of results emitted by document selection or operator. - ResultSet - calcOr(const ResultSet &rhs) const - { + ResultSet calcOr(const ResultSet &rhs) const { return _ors[(_val << Result::enumRange()) | rhs._val]; } // calculcate set of results emitted by document selection not operator. - ResultSet - calcNot(void) const - { - return _nots[_val]; - } - - void - clear(void) - { - _val = 0; - } + ResultSet calcNot(void) const { return _nots[_val]; } - void - fill(void) - { - _val = illegalMask() - 1; - } - - static void - preCalc(void); + void clear(void) { _val = 0; } + void fill(void) { _val = illegalMask() - 1; } + static void preCalc(void); private: // precalc helper methods - void - pcnext(void) - { - ++_val; - } - - bool - pcvalid(void) const - { - return _val < illegalMask(); - } + void pcnext(void) { ++_val; } + bool pcvalid(void) const { return _val < illegalMask(); } }; } // select |