blob: a7d3c7c6507bff222c9641c22052ed805bc38331 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "aggregationrefnode.h"
#include <vespa/vespalib/util/stringfmt.h>
#include <stdexcept>
namespace search {
namespace expression {
using namespace vespalib;
IMPLEMENT_EXPRESSIONNODE(AggregationRefNode, ExpressionNode);
AggregationRefNode::AggregationRefNode(const AggregationRefNode & rhs) :
ExpressionNode(),
_index(rhs._index),
_expressionNode(NULL)
{
}
AggregationRefNode & AggregationRefNode::operator = (const AggregationRefNode & expr)
{
if (this != &expr) {
_index = expr._index;
_expressionNode = NULL;
}
return *this;
}
bool AggregationRefNode::onExecute() const
{
if (_expressionNode != NULL) {
return _expressionNode->execute();
}
return false;
}
void AggregationRefNode::locateExpression(ExpressionNodeArray & exprVec) const
{
if (_expressionNode == NULL) {
_expressionNode = static_cast<ExpressionNode *>(exprVec[_index].get());
if (_expressionNode == NULL) {
throw std::runtime_error(make_string("Failed locating expression for index '%d'", _index));
}
}
}
Serializer & AggregationRefNode::onSerialize(Serializer & os) const
{
return os << _index;
}
Deserializer & AggregationRefNode::onDeserialize(Deserializer & is)
{
return is >> _index;
}
void
AggregationRefNode::visitMembers(vespalib::ObjectVisitor &visitor) const
{
visit(visitor, "index", _index);
}
}
}
// this function was added by ../../forcelink.sh
void forcelink_file_searchlib_expression_expressionrefnode() {}
|