diff options
21 files changed, 223 insertions, 353 deletions
diff --git a/document/src/vespa/document/fieldvalue/document.h b/document/src/vespa/document/fieldvalue/document.h index 46bf655d971..d55730e0046 100644 --- a/document/src/vespa/document/fieldvalue/document.h +++ b/document/src/vespa/document/fieldvalue/document.h @@ -93,8 +93,8 @@ public: const StructFieldValue& getFields() const { return _fields; } StructFieldValue& getFields() { return _fields; } - const Field& getField(const vespalib::stringref & name) const { return _fields.getField(name); } - bool hasField(const vespalib::stringref & name) const { return _fields.hasField(name); } + const Field& getField(const vespalib::stringref & name) const override { return _fields.getField(name); } + bool hasField(const vespalib::stringref & name) const override { return _fields.hasField(name); } void clear() override; @@ -142,7 +142,7 @@ public: /** Undo fieldvalue's toXml override for document. */ std::string toXml(const std::string& indent = "") const override; - bool empty() const { return _fields.empty(); } + bool empty() const override { return _fields.empty(); } uint32_t calculateChecksum() const; diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp index 78840b8ce85..555a50cdb47 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp @@ -278,8 +278,8 @@ class FieldValueFactory : public ComplexArrayT<FieldValue>::Factory { public: FieldValueFactory(DataType::UP dataType) : _dataType(dataType.release()) { } - FieldValue * create() { return _dataType->createFieldValue().release(); } - virtual FieldValueFactory * clone() const { return new FieldValueFactory(*this); } + FieldValue * create() override { return _dataType->createFieldValue().release(); } + FieldValueFactory * clone() const override { return new FieldValueFactory(*this); } private: DataType::CP _dataType; }; diff --git a/document/src/vespa/document/fieldvalue/mapfieldvalue.h b/document/src/vespa/document/fieldvalue/mapfieldvalue.h index a137baede6d..4538ea0ff81 100644 --- a/document/src/vespa/document/fieldvalue/mapfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/mapfieldvalue.h @@ -29,9 +29,9 @@ private: FieldValue::IteratorHandler::ModificationStatus status, bool wasModified, std::vector<const FieldValue*>& keysToRemove) const; - virtual IteratorHandler::ModificationStatus onIterateNested( + IteratorHandler::ModificationStatus onIterateNested( FieldPath::const_iterator start, FieldPath::const_iterator end, - IteratorHandler & handler) const; + IteratorHandler & handler) const override; // Utility method to avoid constant explicit casting const MapDataType& getMapType() const { return *_type; } @@ -127,14 +127,13 @@ public: const FieldValue& complexFieldValue) const; // FieldValue implementation - virtual FieldValue& assign(const FieldValue&); - virtual MapFieldValue* clone() const { return new MapFieldValue(*this); } - virtual int compare(const FieldValue&) const; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const; - virtual bool hasChanged() const; - virtual const DataType *getDataType() const { return _type; } - - virtual void printXml(XmlOutputStream& out) const; + FieldValue& assign(const FieldValue&) override; + MapFieldValue* clone() const override { return new MapFieldValue(*this); } + int compare(const FieldValue&) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + bool hasChanged() const override; + const DataType *getDataType() const override { return _type; } + void printXml(XmlOutputStream& out) const override; const_iterator begin() const { return const_iterator(*this, 0); } iterator begin() { return iterator(*this, 0); } diff --git a/document/src/vespa/document/fieldvalue/rawfieldvalue.h b/document/src/vespa/document/fieldvalue/rawfieldvalue.h index e98d5a9de91..38e1f31efec 100644 --- a/document/src/vespa/document/fieldvalue/rawfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/rawfieldvalue.h @@ -7,7 +7,7 @@ */ #pragma once -#include <vespa/document/fieldvalue/literalfieldvalue.h> +#include "literalfieldvalue.h" #include <memory> namespace document { @@ -32,14 +32,11 @@ public: void accept(FieldValueVisitor &visitor) override { visitor.visit(*this); } void accept(ConstFieldValueVisitor &visitor) const override { visitor.visit(*this); } - virtual RawFieldValue* clone() const - { return new RawFieldValue(*this); } - virtual void printXml(XmlOutputStream& out) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + RawFieldValue* clone() const override { return new RawFieldValue(*this); } + void printXml(XmlOutputStream& out) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - RawFieldValue& operator=(const string& value) - { setValue(value); return *this; } + RawFieldValue& operator=(const string& value) { setValue(value); return *this; } DECLARE_IDENTIFIABLE(RawFieldValue); }; diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.h b/document/src/vespa/document/fieldvalue/structfieldvalue.h index 4ddd93469a5..a46a36c477d 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h @@ -112,7 +112,7 @@ public: void printXml(XmlOutputStream& out) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - bool empty() const; + bool empty() const override; bool hasChanged() const override { return _hasChanged; } diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h index ae888f3e262..90de961a603 100644 --- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h @@ -99,7 +99,7 @@ public: DECLARE_IDENTIFIABLE_ABSTRACT(StructuredFieldValue); - virtual StructuredFieldValue* clone() const = 0; + virtual StructuredFieldValue* clone() const override = 0; const DataType *getDataType() const override { return _type; } /** Wrapper for DataType's hasField() function. */ diff --git a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h index 0963726307a..83ceb1f1238 100644 --- a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h @@ -30,13 +30,13 @@ private: bool _altered; void verifyKey(const FieldValue & key); - virtual bool addValue(const FieldValue& fval) { return add(fval, 1); } - virtual bool containsValue(const FieldValue& val) const; - virtual bool removeValue(const FieldValue& val); - virtual IteratorHandler::ModificationStatus onIterateNested( + bool addValue(const FieldValue& fval) override { return add(fval, 1); } + bool containsValue(const FieldValue& val) const override; + bool removeValue(const FieldValue& val) override; + IteratorHandler::ModificationStatus onIterateNested( FieldPath::const_iterator start, FieldPath::const_iterator end, - IteratorHandler& handler) const; + IteratorHandler& handler) const override; public: typedef std::unique_ptr<WeightedSetFieldValue> UP; @@ -68,10 +68,9 @@ public: { increment(fval, -1*val); } int32_t get(const FieldValue&, int32_t defaultValue = 0) const; - // CollectionFieldValue implementation - virtual bool isEmpty() const { return _map.isEmpty(); } - virtual size_t size() const { return _map.size(); } - virtual void clear() { _map.clear(); } + bool isEmpty() const override { return _map.isEmpty(); } + size_t size() const override { return _map.size(); } + void clear() override { _map.clear(); } void reserve(size_t sz) { _map.reserve(sz); } void resize(size_t sz) { _map.resize(sz); } @@ -79,11 +78,11 @@ public: virtual FieldValue& assign(const FieldValue&); virtual WeightedSetFieldValue* clone() const { return new WeightedSetFieldValue(*this); } - virtual int compare(const FieldValue&) const; - virtual void printXml(XmlOutputStream& out) const; + virtual int compare(const FieldValue&) const override; + virtual void printXml(XmlOutputStream& out) const override; virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual bool hasChanged() const; + const std::string& indent) const override; + virtual bool hasChanged() const override; // Implements iterating through internal content. typedef WeightedFieldValueMap::const_iterator const_iterator; diff --git a/document/src/vespa/document/select/compare.h b/document/src/vespa/document/select/compare.h index 63c93027759..beeddd5e098 100644 --- a/document/src/vespa/document/select/compare.h +++ b/document/src/vespa/document/select/compare.h @@ -30,36 +30,26 @@ private: const Operator& _operator; const BucketIdFactory& _bucketIdFactory; - bool isLeafNode() const { return false; } + bool isLeafNode() const override { return false; } public: Compare(std::unique_ptr<ValueNode> left, const Operator& op, std::unique_ptr<ValueNode> right, const BucketIdFactory& bucketidfactory); - virtual ~Compare(); + ~Compare(); - virtual ResultList - contains(const Context &context) const; - - virtual ResultList - trace(const Context &context, - std::ostream& trace) const; - - virtual void print(std::ostream&, bool verbose, - const std::string& indent) const; - virtual void visit(Visitor& v) const; + ResultList contains(const Context &context) const override; + ResultList trace(const Context &context, std::ostream& trace) const override; + void print(std::ostream&, bool verbose, const std::string& indent) const override; + void visit(Visitor& v) const override; const Operator& getOperator() const { return _operator; } const ValueNode& getLeft() const { return *_left; } const ValueNode& getRight() const { return *_right; } - Node::UP clone() const; + Node::UP clone() const override; - const BucketIdFactory & - getBucketIdFactory(void) const - { - return _bucketIdFactory; - } + const BucketIdFactory &getBucketIdFactory(void) const { return _bucketIdFactory; } }; } // select diff --git a/document/src/vespa/document/select/constant.h b/document/src/vespa/document/select/constant.h index 1fec81d2f49..efc3d875fef 100644 --- a/document/src/vespa/document/select/constant.h +++ b/document/src/vespa/document/select/constant.h @@ -25,21 +25,15 @@ private: public: explicit Constant(const vespalib::stringref & value); - virtual ResultList - contains(const Context&) const - { + ResultList contains(const Context&) const override { return ResultList(Result::get(_value)); } - virtual ResultList - trace(const Context&, std::ostream& trace) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void visit(Visitor& v) const; - + ResultList trace(const Context&, std::ostream& trace) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& v) const override; bool getConstantValue() const { return _value; } - - Node::UP clone() const { return wrapParens(new Constant(_name)); } + Node::UP clone() const override { return wrapParens(new Constant(_name)); } }; diff --git a/document/src/vespa/document/select/doctype.h b/document/src/vespa/document/select/doctype.h index d96c3719cde..6a033c8ace3 100644 --- a/document/src/vespa/document/select/doctype.h +++ b/document/src/vespa/document/select/doctype.h @@ -12,7 +12,6 @@ #pragma once -#include <vespa/document/datatype/documenttype.h> #include "node.h" namespace document { @@ -26,13 +25,12 @@ private: public: DocType(const vespalib::stringref& doctype); - virtual ResultList contains(const Context&) const; - virtual ResultList trace(const Context&, std::ostream& trace) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void visit(Visitor& v) const; + ResultList contains(const Context&) const override; + ResultList trace(const Context&, std::ostream& trace) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& v) const override; - Node::UP clone() const { return wrapParens(new DocType(_doctype)); } + Node::UP clone() const override { return wrapParens(new DocType(_doctype)); } }; diff --git a/document/src/vespa/document/select/operator.h b/document/src/vespa/document/select/operator.h index 9a22929ded8..8d057e8f428 100644 --- a/document/src/vespa/document/select/operator.h +++ b/document/src/vespa/document/select/operator.h @@ -40,8 +40,7 @@ public: bool operator!=(const Operator& op) const { return (_name != op._name); } - virtual void print(std::ostream&, bool verbose, - const std::string& indent) const; + void print(std::ostream&, bool verbose, const std::string& indent) const override; }; class FunctionOperator : public Operator { @@ -53,8 +52,8 @@ public: ResultList (Value::*comparator)(const Value&) const) : Operator(name), _comparator(comparator) {} - virtual ResultList compare(const Value& a, const Value& b) const; - virtual ResultList trace(const Value&, const Value&, std::ostream& trace) const; + ResultList compare(const Value& a, const Value& b) const override; + ResultList trace(const Value&, const Value&, std::ostream& trace) const override; static const FunctionOperator GT; static const FunctionOperator GEQ; @@ -69,8 +68,8 @@ public: RegexOperator(const vespalib::stringref & name); // Delegates to Value::regexCompare - virtual ResultList compare(const Value& a, const Value& b) const; - virtual ResultList trace(const Value&, const Value&, std::ostream& trace) const; + ResultList compare(const Value& a, const Value& b) const override; + ResultList trace(const Value&, const Value&, std::ostream& trace) const override; ResultList match(const vespalib::string & val, const vespalib::stringref & expr) const; static const RegexOperator REGEX; @@ -88,8 +87,8 @@ public: GlobOperator(const vespalib::stringref & name); // Delegates to Value::globCompare - virtual ResultList compare(const Value& a, const Value& b) const; - virtual ResultList trace(const Value&, const Value&, std::ostream& trace) const; + ResultList compare(const Value& a, const Value& b) const override; + ResultList trace(const Value&, const Value&, std::ostream& trace) const override; vespalib::string convertToRegex(const vespalib::stringref & globpattern) const; static bool containsVariables(const vespalib::stringref & expression); diff --git a/document/src/vespa/document/select/value.h b/document/src/vespa/document/select/value.h index dc9e8289ea9..15856648985 100644 --- a/document/src/vespa/document/select/value.h +++ b/document/src/vespa/document/select/value.h @@ -65,13 +65,10 @@ class InvalidValue : public Value public: InvalidValue() : Value(Invalid) {} - virtual ResultList operator<(const Value&) const; - virtual ResultList operator==(const Value&) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - Value::UP clone() const { return Value::UP(new InvalidValue()); } - + ResultList operator<(const Value&) const override; + ResultList operator==(const Value&) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + Value::UP clone() const override { return Value::UP(new InvalidValue()); } }; class NullValue : public Value @@ -79,22 +76,13 @@ class NullValue : public Value public: NullValue() : Value(Null) {} - virtual ResultList operator<(const Value&) const; - virtual ResultList operator==(const Value&) const; - - virtual ResultList - operator>(const Value &) const; - - virtual ResultList - operator>=(const Value &) const; - - virtual ResultList - operator<=(const Value &) const; - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - Value::UP clone() const { return Value::UP(new NullValue()); } + ResultList operator<(const Value&) const override; + ResultList operator==(const Value&) const override; + ResultList operator>(const Value &) const override; + ResultList operator>=(const Value &) const override; + ResultList operator<=(const Value &) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + Value::UP clone() const override { return Value::UP(new NullValue()); } }; class StringValue : public Value @@ -105,13 +93,10 @@ public: StringValue(const vespalib::stringref & val); const vespalib::string& getValue() const { return _value; } - - virtual ResultList operator<(const Value& value) const; - virtual ResultList operator==(const Value& value) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - Value::UP clone() const { return Value::UP(new StringValue(_value)); } + ResultList operator<(const Value& value) const override; + ResultList operator==(const Value& value) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + Value::UP clone() const override { return Value::UP(new StringValue(_value)); } }; class IntegerValue; @@ -126,10 +111,10 @@ public: virtual CommonValueType getCommonValue() const = 0; - virtual ResultList operator<(const Value& value) const = 0; + virtual ResultList operator<(const Value& value) const override = 0; virtual ResultList operator>(const IntegerValue& value) const = 0; virtual ResultList operator>(const FloatValue& value) const = 0; - virtual ResultList operator==(const Value& value) const = 0; + virtual ResultList operator==(const Value& value) const override = 0; virtual ResultList operator==(const IntegerValue& value) const = 0; virtual ResultList operator==(const FloatValue& value) const = 0; }; @@ -142,19 +127,18 @@ public: IntegerValue(ValueType value, bool isBucketValue); ValueType getValue() const { return _value; } - CommonValueType getCommonValue() const { return _value; } + CommonValueType getCommonValue() const override { return _value; } - virtual ResultList operator<(const Value& value) const; - virtual ResultList operator==(const Value& value) const; + ResultList operator<(const Value& value) const override; + ResultList operator==(const Value& value) const override; - virtual ResultList operator>(const IntegerValue& value) const; - virtual ResultList operator>(const FloatValue& value) const; - virtual ResultList operator==(const IntegerValue& value) const; - virtual ResultList operator==(const FloatValue& value) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + ResultList operator>(const IntegerValue& value) const override; + ResultList operator>(const FloatValue& value) const override; + ResultList operator==(const IntegerValue& value) const override; + ResultList operator==(const FloatValue& value) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const { + Value::UP clone() const override { return Value::UP(new IntegerValue(_value, getType() == Value::Bucket)); } private: @@ -169,19 +153,18 @@ public: FloatValue(ValueType val); ValueType getValue() const { return _value; } - CommonValueType getCommonValue() const { return _value; } + CommonValueType getCommonValue() const override { return _value; } - virtual ResultList operator<(const Value& value) const; - virtual ResultList operator==(const Value& value) const; + ResultList operator<(const Value& value) const override; + ResultList operator==(const Value& value) const override; - virtual ResultList operator>(const IntegerValue& value) const; - virtual ResultList operator>(const FloatValue& value) const; - virtual ResultList operator==(const IntegerValue& value) const; - virtual ResultList operator==(const FloatValue& value) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + ResultList operator>(const IntegerValue& value) const override; + ResultList operator>(const FloatValue& value) const override; + ResultList operator==(const IntegerValue& value) const override; + ResultList operator==(const FloatValue& value) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const { return Value::UP(new FloatValue(_value)); } + Value::UP clone() const override { return Value::UP(new FloatValue(_value)); } private: ValueType _value; }; @@ -211,24 +194,23 @@ public: ArrayValue(const std::vector<VariableValue>& values); - virtual ResultList operator<(const Value& value) const; - virtual ResultList operator>(const Value& value) const; - virtual ResultList operator==(const Value& value) const; - virtual ResultList operator!=(const Value& value) const; - virtual ResultList operator>=(const Value& value) const; - virtual ResultList operator<=(const Value& value) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + ResultList operator<(const Value& value) const override; + ResultList operator>(const Value& value) const override; + ResultList operator==(const Value& value) const override; + ResultList operator!=(const Value& value) const override; + ResultList operator>=(const Value& value) const override; + ResultList operator<=(const Value& value) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual ResultList globCompare(const Value& value) const; - virtual ResultList regexCompare(const Value& value) const; - virtual ResultList globTrace(const Value& value, std::ostream& trace) const; - virtual ResultList regexTrace(const Value& value, std::ostream& trace) const; + ResultList globCompare(const Value& value) const override; + ResultList regexCompare(const Value& value) const override; + ResultList globTrace(const Value& value, std::ostream& trace) const override; + ResultList regexTrace(const Value& value, std::ostream& trace) const override; template <typename Predicate> ResultList doCompare(const Value& value, const Predicate& cmp) const; - Value::UP clone() const { return Value::UP(new ArrayValue(_values)); } + Value::UP clone() const override { return Value::UP(new ArrayValue(_values)); } private: struct EqualsComparator; @@ -249,12 +231,11 @@ public: typedef std::map<vespalib::string, Value::SP> ValueMap; StructValue(const ValueMap & values); - virtual ResultList operator<(const Value& value) const; - virtual ResultList operator==(const Value& value) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + ResultList operator<(const Value& value) const override; + ResultList operator==(const Value& value) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - Value::UP clone() const { return Value::UP(new StructValue(_values)); } + Value::UP clone() const override { return Value::UP(new StructValue(_values)); } private: ValueMap _values; }; diff --git a/document/src/vespa/document/select/valuenode.h b/document/src/vespa/document/select/valuenode.h index 77e430c4ec6..96bc03fee8d 100644 --- a/document/src/vespa/document/select/valuenode.h +++ b/document/src/vespa/document/select/valuenode.h @@ -55,9 +55,7 @@ public: return defaultTrace(getValue(context), out); } - virtual void - print(std::ostream& out, bool verbose, - const std::string& indent) const = 0; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override = 0; virtual void visit(Visitor&) const = 0; @@ -85,23 +83,17 @@ protected: class InvalidValueNode : public ValueNode { vespalib::string _name; - public: InvalidValueNode(const vespalib::stringref & name); - virtual std::unique_ptr<Value> - getValue(const Context&) const - { + std::unique_ptr<Value> getValue(const Context&) const override { return std::unique_ptr<Value>(new InvalidValue()); } - virtual void - print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - virtual void visit(Visitor& visitor) const; - - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new InvalidValueNode(_name)); } }; @@ -109,19 +101,18 @@ public: class NullValueNode : public ValueNode { vespalib::string _name; - public: NullValueNode(const vespalib::stringref & name); - virtual std::unique_ptr<Value> getValue(const Context&) const - { return std::unique_ptr<Value>(new NullValue()); } + std::unique_ptr<Value> getValue(const Context&) const override { + return std::unique_ptr<Value>(new NullValue()); + } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void visit(Visitor& visitor) const; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new NullValueNode(_name)); } }; @@ -134,15 +125,14 @@ public: const vespalib::string& getValue() const { return _value; } - virtual std::unique_ptr<Value> getValue(const Context&) const - { return std::unique_ptr<Value>(new StringValue(_value)); } - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + std::unique_ptr<Value> getValue(const Context&) const override { + return std::unique_ptr<Value>(new StringValue(_value)); + } - virtual void visit(Visitor& visitor) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new StringValueNode(_value)); } }; @@ -157,18 +147,15 @@ public: int64_t getValue() const { return _value; } - virtual std::unique_ptr<Value> getValue(const Context&) const { + virtual std::unique_ptr<Value> getValue(const Context&) const override { return std::unique_ptr<Value>(new IntegerValue(_value, _isBucketValue)); } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - virtual void visit(Visitor& visitor) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { - return wrapParens(new IntegerValueNode(_value, - _isBucketValue)); + ValueNode::UP clone() const override { + return wrapParens(new IntegerValueNode(_value, _isBucketValue)); } }; @@ -177,16 +164,14 @@ class CurrentTimeValueNode : public ValueNode public: int64_t getValue() const; - virtual std::unique_ptr<Value> getValue(const Context&) const { + std::unique_ptr<Value> getValue(const Context&) const override { return std::unique_ptr<Value>(new IntegerValue(getValue(), false)); } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - virtual void visit(Visitor& visitor) const; - - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new CurrentTimeValueNode); } }; @@ -199,14 +184,11 @@ public: const vespalib::string& getVariableName() const { return _value; } - virtual std::unique_ptr<Value> getValue(const Context& context) const; - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - virtual void visit(Visitor& visitor) const; + std::unique_ptr<Value> getValue(const Context& context) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new VariableValueNode(_value)); } }; @@ -219,15 +201,14 @@ public: double getValue() const { return _value; } - virtual std::unique_ptr<Value> getValue(const Context&) const - { return std::unique_ptr<Value>(new FloatValue(_value)); } - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + std::unique_ptr<Value> getValue(const Context&) const override { + return std::unique_ptr<Value>(new FloatValue(_value)); + } - virtual void visit(Visitor& visitor) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new FloatValueNode(_value)); } }; @@ -249,17 +230,12 @@ public: const vespalib::string& getFieldName() const { return _fieldExpression; } - virtual std::unique_ptr<Value> getValue(const Context& context) const; - - virtual std::unique_ptr<Value> traceValue(const Context &context, - std::ostream& out) const; - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - virtual void visit(Visitor& visitor) const; + std::unique_ptr<Value> getValue(const Context& context) const override; + std::unique_ptr<Value> traceValue(const Context &context, std::ostream& out) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new FieldValueNode(_doctype, _fieldExpression)); } @@ -298,31 +274,20 @@ public: Type getType() const { return _type; } - virtual std::unique_ptr<Value> - getValue(const Context& context) const; + std::unique_ptr<Value> getValue(const Context& context) const override; - std::unique_ptr<Value> - getValue(const DocumentId& id) const; + std::unique_ptr<Value> getValue(const DocumentId& id) const; - virtual std::unique_ptr<Value> - traceValue(const Context& context, - std::ostream &out) const; + std::unique_ptr<Value> traceValue(const Context& context, std::ostream &out) const override; - std::unique_ptr<Value> - traceValue(const DocumentId& val, - std::ostream& out) const; + std::unique_ptr<Value> traceValue(const DocumentId& val, std::ostream& out) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void visit(Visitor& visitor) const; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { - return wrapParens(new IdValueNode(_bucketIdFactory, - _id, - _typestring, - _widthBits, - _divisionBits)); + ValueNode::UP clone() const override { + return wrapParens(new IdValueNode(_bucketIdFactory, _id, _typestring, _widthBits, _divisionBits)); } int getWidthBits() const { return _widthBits; } @@ -346,31 +311,17 @@ public: int getColumns() { return _numColumns; } - virtual std::unique_ptr<Value> - getValue(const Context& context) const; - - std::unique_ptr<Value> - getValue(const DocumentId& id) const; - - virtual std::unique_ptr<Value> - traceValue(const Context& context, - std::ostream &out) const; - - std::unique_ptr<Value> - traceValue(const DocumentId& val, - std::ostream& out) const; + std::unique_ptr<Value> getValue(const Context& context) const override; + std::unique_ptr<Value> getValue(const DocumentId& id) const; + std::unique_ptr<Value> traceValue(const Context& context, std::ostream &out) const override; + std::unique_ptr<Value> traceValue(const DocumentId& val, std::ostream& out) const; int64_t getValue(const BucketId& bucketId) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - virtual void visit(Visitor& visitor) const; - - ValueNode::UP clone() const { - return wrapParens(new SearchColumnValueNode(_bucketIdFactory, - _id, - _numColumns)); + ValueNode::UP clone() const override { + return wrapParens(new SearchColumnValueNode(_bucketIdFactory, _id, _numColumns)); } private: @@ -388,33 +339,21 @@ public: FunctionValueNode(const vespalib::stringref & name, std::unique_ptr<ValueNode> src); Function getFunction() const { return _function; } + const vespalib::string &getFunctionName(void) const { return _funcname; } - const vespalib::string & - getFunctionName(void) const - { - return _funcname; - } - - virtual std::unique_ptr<Value> - getValue(const Context& context) const - { + std::unique_ptr<Value> getValue(const Context& context) const override { return getValue(_source->getValue(context)); } - virtual std::unique_ptr<Value> traceValue(const Context &context, - std::ostream& out) const - { + std::unique_ptr<Value> traceValue(const Context &context, std::ostream& out) const override { return traceValue(_source->getValue(context), out); } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - virtual void visit(Visitor& visitor) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { - return wrapParens(new FunctionValueNode(_funcname, - _source->clone())); + ValueNode::UP clone() const override { + return wrapParens(new FunctionValueNode(_funcname, _source->clone())); } const ValueNode& getChild() const { return *_source; } @@ -441,26 +380,20 @@ public: Operator getOperator() const { return _operator; } const char* getOperatorName() const; - virtual std::unique_ptr<Value> - getValue(const Context& context) const - { + std::unique_ptr<Value> + getValue(const Context& context) const override { return getValue(_left->getValue(context), _right->getValue(context)); } - virtual std::unique_ptr<Value> - traceValue(const Context &context, - std::ostream& out) const - { - return traceValue(_left->getValue(context), - _right->getValue(context), out); + std::unique_ptr<Value> + traceValue(const Context &context, std::ostream& out) const override { + return traceValue(_left->getValue(context), _right->getValue(context), out); } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - - virtual void visit(Visitor& visitor) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& visitor) const override; - ValueNode::UP clone() const { + ValueNode::UP clone() const override { return wrapParens(new ArithmeticValueNode(_left->clone(), getOperatorName(), _right->clone())); diff --git a/document/src/vespa/document/serialization/slime_output_to_vector.h b/document/src/vespa/document/serialization/slime_output_to_vector.h index eac460d062f..cfe14c31354 100644 --- a/document/src/vespa/document/serialization/slime_output_to_vector.h +++ b/document/src/vespa/document/serialization/slime_output_to_vector.h @@ -16,7 +16,7 @@ public: SlimeOutputToVector(); ~SlimeOutputToVector(); - vespalib::WritableMemory reserve(size_t reserve) { + vespalib::WritableMemory reserve(size_t reserve) override { if (_size + reserve > _buf.size()) { _buf.resize(_size + reserve); } diff --git a/document/src/vespa/document/update/addvalueupdate.h b/document/src/vespa/document/update/addvalueupdate.h index e112d6a504a..4263e48f9e0 100644 --- a/document/src/vespa/document/update/addvalueupdate.h +++ b/document/src/vespa/document/update/addvalueupdate.h @@ -65,15 +65,13 @@ public: } // ValueUpdate implementation - virtual void checkCompatibility(const Field& field) const; - virtual bool applyTo(FieldValue& value) const; - virtual void printXml(XmlOutputStream& xos) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void deserialize(const DocumentTypeRepo& repo, - const DataType& type, - ByteBuffer& buffer, uint16_t version); - virtual AddValueUpdate* clone() const { return new AddValueUpdate(*this); } + void checkCompatibility(const Field& field) const override; + bool applyTo(FieldValue& value) const override; + void printXml(XmlOutputStream& xos) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void deserialize(const DocumentTypeRepo& repo, const DataType& type, + ByteBuffer& buffer, uint16_t version) override; + AddValueUpdate* clone() const override { return new AddValueUpdate(*this); } DECLARE_IDENTIFIABLE(AddValueUpdate); diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.h b/document/src/vespa/document/update/arithmeticvalueupdate.h index a335b09c650..7ce7ca7b9e8 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.h +++ b/document/src/vespa/document/update/arithmeticvalueupdate.h @@ -55,7 +55,7 @@ public: _operator(update._operator), _operand(update._operand) {} - virtual bool operator==(const ValueUpdate& other) const; + bool operator==(const ValueUpdate& other) const override; /** @return the operator of this arithmetic update. */ Operator getOperator() const { return _operator; } @@ -88,16 +88,13 @@ public: long applyTo(int64_t value) const; // ValueUpdate implementation - virtual void checkCompatibility(const Field& field) const; - virtual bool applyTo(FieldValue& value) const; - virtual void printXml(XmlOutputStream& xos) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void deserialize(const DocumentTypeRepo& repo, - const DataType& type, - ByteBuffer& buffer, uint16_t version); - virtual ArithmeticValueUpdate* clone() const - { return new ArithmeticValueUpdate(*this); } + void checkCompatibility(const Field& field) const override; + bool applyTo(FieldValue& value) const override; + void printXml(XmlOutputStream& xos) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void deserialize(const DocumentTypeRepo& repo, const DataType& type, + ByteBuffer& buffer, uint16_t version) override; + ArithmeticValueUpdate* clone() const override { return new ArithmeticValueUpdate(*this); } DECLARE_IDENTIFIABLE(ArithmeticValueUpdate); diff --git a/staging_vespalib/src/vespa/vespalib/util/polymorphicarrays.h b/staging_vespalib/src/vespa/vespalib/util/polymorphicarrays.h index 696c55f9ae3..636586f839e 100644 --- a/staging_vespalib/src/vespa/vespalib/util/polymorphicarrays.h +++ b/staging_vespalib/src/vespa/vespalib/util/polymorphicarrays.h @@ -77,16 +77,16 @@ class PrimitiveArrayT : public IArrayT<B> using typename IArrayT<B>::iterator; public: PrimitiveArrayT() : _array() { } - virtual ~PrimitiveArrayT() { } - virtual const T & operator [] (size_t i) const { return _array[i]; } - virtual T & operator [] (size_t i) { return _array[i]; } - virtual void resize(size_t sz) { _array.resize(sz); } - virtual void reserve(size_t sz) { _array.reserve(sz); } - virtual void clear() { _array.clear(); } - virtual IArrayT<B> * clone() const { return new PrimitiveArrayT<T, B>(*this); } - virtual size_t size() const { return _array.size(); } - virtual iterator erase(iterator it) { _array.erase(_array.begin() + (it - this->begin())); return it; } - virtual void push_back(const B & v) { + ~PrimitiveArrayT() { } + const T & operator [] (size_t i) const override { return _array[i]; } + T & operator [] (size_t i) override { return _array[i]; } + void resize(size_t sz) override { _array.resize(sz); } + void reserve(size_t sz) override { _array.reserve(sz); } + void clear() override { _array.clear(); } + IArrayT<B> * clone() const override { return new PrimitiveArrayT<T, B>(*this); } + size_t size() const override { return _array.size(); } + iterator erase(iterator it) override { _array.erase(_array.begin() + (it - this->begin())); return it; } + void push_back(const B & v) override { size_t sz(_array.size()); _array.resize(sz + 1); _array[sz].assign(v); diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h index 7eea530e229..41fb819ae68 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h @@ -122,7 +122,7 @@ public: // vespalib::Printable implementation virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const = 0; + const std::string& indent) const override = 0; }; class MemoryManager : public vespalib::Printable, @@ -138,28 +138,20 @@ public: MemoryManager(AllocationLogic::UP); ~MemoryManager(); - virtual void setMaximumMemoryUsage(uint64_t max); + void setMaximumMemoryUsage(uint64_t max) override; virtual void getState(MemoryState& state, bool resetMax = false); - virtual const MemoryAllocationType& - registerAllocationType(const MemoryAllocationType& type); + const MemoryAllocationType®isterAllocationType(const MemoryAllocationType& type) override; + const MemoryAllocationType&getAllocationType(const std::string& name) const override; - virtual const MemoryAllocationType& - getAllocationType(const std::string& name) const; + std::vector<const MemoryAllocationType*> getAllocationTypes() const override; - virtual std::vector<const MemoryAllocationType*> getAllocationTypes() const; - - MemoryToken::UP allocate( - const MemoryAllocationType&, - uint64_t min, - uint64_t max, - uint8_t p, - ReduceMemoryUsageInterface* = 0); + MemoryToken::UP allocate(const MemoryAllocationType&, uint64_t min, uint64_t max, + uint8_t p, ReduceMemoryUsageInterface* = 0) override; - virtual uint64_t getMemorySizeFreeForPriority(uint8_t priority) const; + uint64_t getMemorySizeFreeForPriority(uint8_t priority) const override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.h index f78927da6ce..e84e864d435 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.h @@ -68,8 +68,7 @@ public: SnapShot() : vespalib::Printable() { clear(); } SnapShot(const SnapShot& o) : vespalib::Printable() { (*this) = o; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; void clear() { _usedMemory = 0; @@ -104,8 +103,7 @@ private: public: MemoryState(Clock& clock, uint64_t maxMemory); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; void setMaximumMemoryUsage(uint64_t max) { _maxMemory = max; } void setMinJumpToUpdateMax(uint32_t bytes) { _minJumpToUpdateMax = bytes; } diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h index eda78bcc13b..7f88977bbc5 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h @@ -24,18 +24,14 @@ public: ThreadPoolImpl(Clock&); ~ThreadPoolImpl(); - Thread::UP startThread(Runnable&, - vespalib::stringref id, - uint64_t waitTimeMs, - uint64_t maxProcessTime, - int ticksBeforeWait); - void visitThreads(ThreadVisitor&) const; + Thread::UP startThread(Runnable&, vespalib::stringref id, uint64_t waitTimeMs, + uint64_t maxProcessTime, int ticksBeforeWait) override; + void visitThreads(ThreadVisitor&) const override; void registerThread(ThreadImpl&); void unregisterThread(ThreadImpl&); FastOS_ThreadPool& getThreadPool() { return _backendThreadPool; } Clock& getClock() { return _clock; } - }; } // defaultimplementation diff --git a/storageframework/src/vespa/storageframework/generic/component/component.h b/storageframework/src/vespa/storageframework/generic/component/component.h index 8bbf0dc192a..5f55bb30397 100644 --- a/storageframework/src/vespa/storageframework/generic/component/component.h +++ b/storageframework/src/vespa/storageframework/generic/component/component.h @@ -105,9 +105,8 @@ class Component : private ManagedComponent } // ManagedComponent implementation - metrics::Metric* getMetric() { return _metric; } - std::pair<MetricUpdateHook*, SecondTime> getMetricUpdateHook() - { return _metricUpdateHook; } + metrics::Metric* getMetric() override { return _metric; } + std::pair<MetricUpdateHook*, SecondTime> getMetricUpdateHook() override { return _metricUpdateHook; } const StatusReporter* getStatusReporter() { return _status; } void setMetricRegistrator(MetricRegistrator& mr); void setMemoryManager(MemoryManagerInterface& mm) { _memoryManager = &mm; } |