aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-10-23 12:20:37 +0200
committerTor Egge <Tor.Egge@broadpark.no>2019-10-23 12:20:37 +0200
commit54d302f21a82c3b8a3e8c286c20c4b577cfe8a0a (patch)
treec13cacec88d322512f5207c52437f0669531127d /searchlib
parent29b1475210960916b2e11d67345fba57f13096cf (diff)
Use std::unique_ptr<vsm::FieldSearcher> to store field searhers.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/query/CMakeLists.txt1
-rw-r--r--searchlib/src/vespa/searchlib/query/base.cpp13
-rw-r--r--searchlib/src/vespa/searchlib/query/base.h55
3 files changed, 0 insertions, 69 deletions
diff --git a/searchlib/src/vespa/searchlib/query/CMakeLists.txt b/searchlib/src/vespa/searchlib/query/CMakeLists.txt
index 8ec737657b7..f1f9e64e8d2 100644
--- a/searchlib/src/vespa/searchlib/query/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/query/CMakeLists.txt
@@ -3,7 +3,6 @@ vespa_add_library(searchlib_query OBJECT
SOURCES
queryterm.cpp
querynode.cpp
- base.cpp
query.cpp
query_term_decoder.cpp
querynoderesultbase.cpp
diff --git a/searchlib/src/vespa/searchlib/query/base.cpp b/searchlib/src/vespa/searchlib/query/base.cpp
deleted file mode 100644
index 213fbbb7679..00000000000
--- a/searchlib/src/vespa/searchlib/query/base.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "base.h"
-
-namespace search {
-
-Object::~Object() { }
-
-vespalib::string Object::toString() const
-{
- return vespalib::string("");
-}
-
-}
diff --git a/searchlib/src/vespa/searchlib/query/base.h b/searchlib/src/vespa/searchlib/query/base.h
index c6e0661f82c..da0b815383a 100644
--- a/searchlib/src/vespa/searchlib/query/base.h
+++ b/searchlib/src/vespa/searchlib/query/base.h
@@ -48,60 +48,5 @@ typedef std::vector<DocumentIdT> DocumentIdList;
/// A macro that gives you number of elements in an array.
#define NELEMS(a) (sizeof(a)/sizeof(a[0]))
-/// A macro used in descendants of Object to instantiate the duplicate method.
-#define DUPLICATE(a) a * duplicate() const override;
-#define IMPLEMENT_DUPLICATE(a) a * a::duplicate() const { return new a(*this); }
-
-/**
- This is a base class that ensures that all descendants can be duplicated.
- This implies also that they have a copy constructor.
- It also makes them streamable to an std:ostream.
-*/
-class Object
-{
- public:
- virtual ~Object();
- /// Returns an allocated(new) object that is identical to this one.
- virtual Object * duplicate() const = 0;
- /// Gives you streamability of the object. Object does nothing.
- virtual vespalib::string toString() const;
-};
-
-/**
- This is a template that can hold any objects of any descendants of T.
- It does take a copy of the object. Very nice for holding different descendants
- and not have to worry about what happens on copy, assignment, destruction.
- No references, just simple copy.
- It gives you the -> and * operator so you can use it as a pointer to T.
- Very convenient.
-*/
-template <typename T>
-class ObjectContainer
-{
- public:
- ObjectContainer() : _p(NULL) { }
- ObjectContainer(std::unique_ptr<T> &&org) : _p(org.release()) { }
- ObjectContainer(const T & org) : _p(static_cast<T*>(org.duplicate())) { }
- ObjectContainer(const T * org) : _p(org ? static_cast<T*>(org->duplicate()) : NULL) { }
- ObjectContainer(const ObjectContainer & org) : _p(NULL) { *this = org; }
- ObjectContainer(ObjectContainer && org) : _p(org._p) { org._p = nullptr; }
- ObjectContainer & operator = (const T * org) { cleanUp(); if (org) { _p = static_cast<T*>(org->duplicate()); } return *this; }
- ObjectContainer & operator = (const T & org) { cleanUp(); _p = static_cast<T*>(org.duplicate()); return *this; }
- ObjectContainer & operator = (const ObjectContainer & org) { if (this != & org) { cleanUp(); if (org._p) { _p = static_cast<T*>(org._p->duplicate());} } return *this; }
- ObjectContainer & operator = (ObjectContainer && org) { if (this != & org) { cleanUp(); _p = org._p; org._p = nullptr; } return *this; }
- virtual ~ObjectContainer() { cleanUp(); }
- bool valid() const { return (_p != NULL); }
- T *operator->() { return _p; }
- T &operator*() { return *_p; }
- const T *operator->() const { return _p; }
- const T &operator*() const { return *_p; }
- operator T & () const { return *_p; }
- operator T * () const { return _p; }
-
- private:
- void cleanUp() { delete _p; _p = NULL; }
- T * _p;
-};
-
}