diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-23 10:36:11 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-23 10:36:11 +0100 |
commit | d43c7880a63922d2ddf3f575512f6ee624c57432 (patch) | |
tree | 2a0fb57f8c4ee6efb9d931e51eb80412770e3024 /searchlib | |
parent | 4f4e4a45d5d5e9d002bce40c64259f10af2d9f30 (diff) |
Change interface to accomodate removing linkedptr later on.
Diffstat (limited to 'searchlib')
6 files changed, 15 insertions, 14 deletions
diff --git a/searchlib/src/vespa/searchlib/aggregation/aggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/aggregationresult.h index f78d5cfbea1..87689ae81d6 100644 --- a/searchlib/src/vespa/searchlib/aggregation/aggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/aggregationresult.h @@ -59,8 +59,8 @@ public: const ResultNode & getResult() const { return onGetRank(); } virtual ResultNode & getResult() { return const_cast<ResultNode &>(onGetRank()); } virtual AggregationResult * clone() const = 0; - const ExpressionNode * getExpression() const { return _expressionTree->getRoot().get(); } - ExpressionNode * getExpression() { return _expressionTree->getRoot().get(); } + const ExpressionNode * getExpression() const { return _expressionTree->getRoot(); } + ExpressionNode * getExpression() { return _expressionTree->getRoot(); } protected: AggregationResult(); private: diff --git a/searchlib/src/vespa/searchlib/aggregation/grouping.cpp b/searchlib/src/vespa/searchlib/aggregation/grouping.cpp index 4c59cad9215..11b354b4e9b 100644 --- a/searchlib/src/vespa/searchlib/aggregation/grouping.cpp +++ b/searchlib/src/vespa/searchlib/aggregation/grouping.cpp @@ -68,7 +68,7 @@ public: const EnumResultNode & er = static_cast<const EnumResultNode &>(group.getId()); const Grouping::GroupingLevelList &gll = _grouping.getLevels(); const GroupingLevel & gl = gll[_level]; - const ExpressionNode::LP & en = gl.getExpression().getRoot(); + const ExpressionNode * en = gl.getExpression().getRoot(); const AttributeNode & an = static_cast<const AttributeNode &>(*en); StringResultNode srn((static_cast<const StringAttribute *>(an.getAttribute()))->getFromEnum(er.getEnum())); group.setId(srn); diff --git a/searchlib/src/vespa/searchlib/aggregation/groupinglevel.h b/searchlib/src/vespa/searchlib/aggregation/groupinglevel.h index e14be23b889..03528965b90 100644 --- a/searchlib/src/vespa/searchlib/aggregation/groupinglevel.h +++ b/searchlib/src/vespa/searchlib/aggregation/groupinglevel.h @@ -104,6 +104,7 @@ public: bool isFrozen() const { return _frozen; } bool allowMoreGroups(size_t sz) const { return (!_frozen && (!_isOrdered || (sz < (uint64_t)_precision))); } const ExpressionTree & getExpression() const { return _classify; } + ExpressionTree & getExpression() { return _classify; } const Group &getGroupPrototype() const { return _collect; } void prepare(const Grouping * grouping, uint32_t level, bool isOrdered_); diff --git a/searchlib/src/vespa/searchlib/expression/expressionnode.h b/searchlib/src/vespa/searchlib/expression/expressionnode.h index d22601326ca..f29630b9fd6 100644 --- a/searchlib/src/vespa/searchlib/expression/expressionnode.h +++ b/searchlib/src/vespa/searchlib/expression/expressionnode.h @@ -39,7 +39,6 @@ public: DECLARE_ABSTRACT_EXPRESSIONNODE(ExpressionNode); typedef std::unique_ptr<ExpressionNode> UP; typedef vespalib::IdentifiablePtr<ExpressionNode> CP; - typedef vespalib::IdentifiableLinkedPtr<ExpressionNode> LP; virtual const ResultNode & getResult() const = 0; bool execute() const { return onExecute(); } ExpressionNode & prepare(bool preserveAccurateTypes) { onPrepare(preserveAccurateTypes); return *this; } diff --git a/searchlib/src/vespa/searchlib/expression/expressiontree.cpp b/searchlib/src/vespa/searchlib/expression/expressiontree.cpp index ad006005b7f..ad6090ab53d 100644 --- a/searchlib/src/vespa/searchlib/expression/expressiontree.cpp +++ b/searchlib/src/vespa/searchlib/expression/expressiontree.cpp @@ -18,7 +18,7 @@ IMPLEMENT_EXPRESSIONNODE(ExpressionTree, ExpressionNode); void ExpressionTree::Configure::execute(vespalib::Identifiable &obj) { ExpressionTree & e(static_cast<ExpressionTree &>(obj)); - if (e.getRoot().get()) { + if (e.getRoot()) { e.getRoot()->prepare(false); } e.prepare(false); @@ -53,8 +53,8 @@ class Gather : public vespalib::ObjectOperation, public vespalib::ObjectPredicat public: Gather(std::vector<NODE *> &list) : _list(list) { _list.clear(); } - void from(ExpressionNode::LP &root) { - root->select(*this, *this); + void from(ExpressionNode & root) { + root.select(*this, *this); } private: virtual void execute(vespalib::Identifiable &obj) { @@ -76,11 +76,11 @@ void ExpressionTree::onPrepare(bool preserveAccurateTypes) { (void) preserveAccurateTypes; if (_root.get() != NULL) { - gather(_attributeNodes).from(_root); - gather(_documentAccessorNodes).from(_root); - gather(_relevanceNodes).from(_root); - gather(_interpolatedLookupNodes).from(_root); - gather(_arrayAtLookupNodes).from(_root); + gather(_attributeNodes).from(*_root); + gather(_documentAccessorNodes).from(*_root); + gather(_relevanceNodes).from(*_root); + gather(_interpolatedLookupNodes).from(*_root); + gather(_arrayAtLookupNodes).from(*_root); } } diff --git a/searchlib/src/vespa/searchlib/expression/expressiontree.h b/searchlib/src/vespa/searchlib/expression/expressiontree.h index f768ae64eff..2a920d421c2 100644 --- a/searchlib/src/vespa/searchlib/expression/expressiontree.h +++ b/searchlib/src/vespa/searchlib/expression/expressiontree.h @@ -50,7 +50,8 @@ public: ExpressionTree & operator = (const ExpressionTree & rhs); bool execute(DocId docId, HitRank rank) const; bool execute(const document::Document & doc, HitRank rank) const; - const ExpressionNode::LP & getRoot() const { return _root; } + const ExpressionNode * getRoot() const { return _root.get(); } + ExpressionNode * getRoot() { return _root.get(); } virtual const ResultNode & getResult() const { return _root->getResult(); } friend vespalib::Serializer & operator << (vespalib::Serializer & os, const ExpressionTree & et); friend vespalib::Deserializer & operator >> (vespalib::Deserializer & is, ExpressionTree & et); @@ -67,7 +68,7 @@ private: typedef std::vector<InterpolatedLookup *> InterpolatedLookupList; typedef std::vector<ArrayAtLookup *> ArrayAtLookupList; - ExpressionNode::LP _root; + vespalib::IdentifiableLinkedPtr<ExpressionNode> _root; AttributeNodeList _attributeNodes; DocumentAccessorNodeList _documentAccessorNodes; RelevanceNodeList _relevanceNodes; |