diff options
10 files changed, 15 insertions, 51 deletions
diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h index fdc3b369348..679fd0885dd 100644 --- a/document/src/vespa/document/base/fieldpath.h +++ b/document/src/vespa/document/base/fieldpath.h @@ -2,7 +2,6 @@ #pragma once #include "field.h" -#include <vespa/vespalib/objects/cloneable.h> #include <vespa/document/util/identifiableid.h> #include <vector> diff --git a/document/src/vespa/document/datatype/datatype.h b/document/src/vespa/document/datatype/datatype.h index 8d88ff11982..f3538956dfd 100644 --- a/document/src/vespa/document/datatype/datatype.h +++ b/document/src/vespa/document/datatype/datatype.h @@ -7,7 +7,6 @@ */ #pragma once -#include <vespa/vespalib/objects/cloneable.h> #include <vespa/vespalib/objects/identifiable.h> #include <vespa/document/util/identifiableid.h> @@ -23,8 +22,7 @@ class DocumentType; class WeightedSetDataType; class FieldPath; -class DataType : public vespalib::Cloneable, - public Printable, +class DataType : public Printable, public vespalib::Identifiable { int _dataTypeId; @@ -47,9 +45,8 @@ protected: public: ~DataType() override; - typedef std::unique_ptr<DataType> UP; - typedef std::shared_ptr<DataType> SP; - typedef vespalib::CloneablePtr<DataType> CP; + using UP = std::unique_ptr<DataType>; + using SP = std::shared_ptr<DataType>; /** * Enumeration of primitive data type identifiers. (Complex types uses @@ -110,7 +107,7 @@ public: * Create a field value using this datatype. */ virtual std::unique_ptr<FieldValue> createFieldValue() const = 0; - DataType* clone() const override = 0; + virtual DataType* clone() const = 0; /** * Whether another datatype is a supertype of this one. Document types may diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h index 15828c639ec..b0507a6c251 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.h +++ b/document/src/vespa/document/fieldvalue/fieldvalue.h @@ -15,7 +15,6 @@ #include "modificationstatus.h" #include <vespa/document/util/xmlserializable.h> #include <vespa/document/base/fieldpath.h> -#include <vespa/vespalib/objects/cloneable.h> #include <vespa/vespalib/objects/identifiable.h> #include <vespa/vespalib/util/polymorphicarraybase.h> diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h index 6eed7e4afa6..5283f0da455 100644 --- a/document/src/vespa/document/update/fieldpathupdate.h +++ b/document/src/vespa/document/update/fieldpathupdate.h @@ -17,8 +17,7 @@ class DataType; namespace select { class Node; } namespace fieldvalue { class IteratorHandler; } -class FieldPathUpdate : public vespalib::Cloneable, - public Printable, +class FieldPathUpdate : public Printable, public vespalib::Identifiable { protected: @@ -44,7 +43,7 @@ public: void applyTo(Document& doc) const; - FieldPathUpdate* clone() const override = 0; + virtual FieldPathUpdate* clone() const = 0; virtual bool operator==(const FieldPathUpdate& other) const; bool operator!=(const FieldPathUpdate& other) const { diff --git a/document/src/vespa/document/update/fieldupdate.cpp b/document/src/vespa/document/update/fieldupdate.cpp index 7cc9a4d392d..ff60c3b7994 100644 --- a/document/src/vespa/document/update/fieldupdate.cpp +++ b/document/src/vespa/document/update/fieldupdate.cpp @@ -70,7 +70,7 @@ FieldUpdate::applyTo(Document& doc) const const DataType& datatype = _field.getDataType(); FieldValue::UP value = doc.getValue(_field); - for (const ValueUpdate::CP & update : _updates) { + for (const auto & update : _updates) { if ( ! value) { // Avoid passing a null pointer to a value update. value = datatype.createFieldValue(); diff --git a/document/src/vespa/document/update/valueupdate.h b/document/src/vespa/document/update/valueupdate.h index dc7dcce785e..b2f4a1da609 100644 --- a/document/src/vespa/document/update/valueupdate.h +++ b/document/src/vespa/document/update/valueupdate.h @@ -30,7 +30,6 @@ class FieldValue; class ValueUpdate : public vespalib::Identifiable, public Printable, - public vespalib::Cloneable, public XmlSerializable { protected: @@ -60,9 +59,9 @@ public: }; ValueUpdate() - : Printable(), Cloneable(), XmlSerializable() {} + : Printable(), XmlSerializable() {} - virtual ~ValueUpdate() {} + virtual ~ValueUpdate() = default; virtual bool operator==(const ValueUpdate&) const = 0; bool operator != (const ValueUpdate & rhs) const { return ! (*this == rhs); } @@ -82,7 +81,7 @@ public: */ virtual bool applyTo(FieldValue& value) const = 0; - ValueUpdate* clone() const override = 0; + virtual ValueUpdate* clone() const = 0; /** * Deserializes the given stream into an instance of an update object. diff --git a/searchlib/src/vespa/searchlib/query/streaming/querynoderesultbase.h b/searchlib/src/vespa/searchlib/query/streaming/querynoderesultbase.h index 52beb570d49..4539f1668f4 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/querynoderesultbase.h +++ b/searchlib/src/vespa/searchlib/query/streaming/querynoderesultbase.h @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/objects/cloneable.h> #include <memory> namespace search::streaming { @@ -11,14 +10,16 @@ namespace search::streaming { The intention is to put stuff here that are search specific. Fx to differentiate between streamed and indexed variants. */ -class QueryNodeResultBase : public vespalib::Cloneable +class QueryNodeResultBase { public: + virtual ~QueryNodeResultBase() = default; + virtual QueryNodeResultBase * clone() const = 0; }; class QueryNodeResultFactory { public: - virtual ~QueryNodeResultFactory() { } + virtual ~QueryNodeResultFactory() = default; virtual bool getRewriteFloatTerms() const { return false; } virtual std::unique_ptr<QueryNodeResultBase> create() const { return std::unique_ptr<QueryNodeResultBase>(); } }; diff --git a/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp b/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp index f455e40be30..83f4410a520 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp @@ -2,7 +2,6 @@ #include "queryterm.h" #include <vespa/vespalib/objects/visit.h> -#include <vespa/vespalib/text/utf8.h> #include <cmath> namespace { diff --git a/searchlib/src/vespa/searchlib/query/streaming/queryterm.h b/searchlib/src/vespa/searchlib/query/streaming/queryterm.h index d160db9784e..25f2b598413 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/queryterm.h +++ b/searchlib/src/vespa/searchlib/query/streaming/queryterm.h @@ -9,7 +9,6 @@ #include <vespa/searchlib/query/weight.h> #include <vespa/vespalib/objects/objectvisitor.h> #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/memory.h> namespace search::streaming { @@ -87,7 +86,7 @@ public: void setIndex(const string & index_) override { _index = index_; } const string & getIndex() const override { return _index; } protected: - using QueryNodeResultBaseContainer = vespalib::CloneablePtr<QueryNodeResultBase>; + using QueryNodeResultBaseContainer = std::unique_ptr<QueryNodeResultBase>; string _index; EncodingBitMap _encoding; QueryNodeResultBaseContainer _result; diff --git a/staging_vespalib/src/vespa/vespalib/objects/cloneable.h b/staging_vespalib/src/vespa/vespalib/objects/cloneable.h deleted file mode 100644 index 0610f01155f..00000000000 --- a/staging_vespalib/src/vespa/vespalib/objects/cloneable.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -/** - * @class vespalib::Cloneable - * @brief Superclass for objects implementing clone() deep copy. - */ - -namespace vespalib { - -class Cloneable { -public: - /** - * @brief Creates a clone of this instance. - * - * Note that the caller takes ownership of the returned object. It - * is not an unique_ptr since that would not support covariant - * return types. A class T that inherits this interface should - * define T* clone() const, such that people cloning a T object - * don't need to cast it to get the correct type. - */ - virtual Cloneable* clone() const = 0; - virtual ~Cloneable() = default; -}; - -} // namespace vespalib - |