diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-05-30 16:22:49 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2013-06-18 12:51:15 -0400 |
commit | 4c30d0500b1da673840f0ea12a9277f3803a230f (patch) | |
tree | e8b9cb4fa87e6c2fe442eea56271260fdb7cd64e /src/mongo/db/pipeline/accumulator_last.cpp | |
parent | be4e909ad1ae382a073f456710052a65c2b5fd39 (diff) | |
download | mongo-4c30d0500b1da673840f0ea12a9277f3803a230f.tar.gz |
Accumulators are not Expressions so they shouldn't derive
There may be a place for a common parent of "tree-like" things, but
Expression is not the correct base. This commit keeps the public API of
accumulators the same so consumers don't need to be modified.
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_last.cpp')
-rw-r--r-- | src/mongo/db/pipeline/accumulator_last.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/db/pipeline/accumulator_last.cpp b/src/mongo/db/pipeline/accumulator_last.cpp index ea65094d04b..c6fbe859719 100644 --- a/src/mongo/db/pipeline/accumulator_last.cpp +++ b/src/mongo/db/pipeline/accumulator_last.cpp @@ -21,19 +21,17 @@ namespace mongo { - Value AccumulatorLast::evaluate(const Document& pDocument) const { - verify(vpOperand.size() == 1); - + void AccumulatorLast::processInternal(const Value& input) { /* always remember the last value seen */ - pValue = vpOperand[0]->evaluate(pDocument); - - return pValue; + _last = input; } - AccumulatorLast::AccumulatorLast(): - AccumulatorSingleValue() { + Value AccumulatorLast::getValue() const { + return _last; } + AccumulatorLast::AccumulatorLast() {} + intrusive_ptr<Accumulator> AccumulatorLast::create( const intrusive_ptr<ExpressionContext> &pCtx) { intrusive_ptr<AccumulatorLast> pAccumulator( |