diff options
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_first.cpp')
-rw-r--r-- | src/mongo/db/pipeline/accumulator_first.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/mongo/db/pipeline/accumulator_first.cpp b/src/mongo/db/pipeline/accumulator_first.cpp index ed49fe163f1..9425199793f 100644 --- a/src/mongo/db/pipeline/accumulator_first.cpp +++ b/src/mongo/db/pipeline/accumulator_first.cpp @@ -33,40 +33,38 @@ namespace mongo { - using boost::intrusive_ptr; +using boost::intrusive_ptr; - void AccumulatorFirst::processInternal(const Value& input, bool merging) { - /* only remember the first value seen */ - if (!_haveFirst) { - // can't use pValue.missing() since we want the first value even if missing - _haveFirst = true; - _first = input; - _memUsageBytes = sizeof(*this) + input.getApproximateSize() - sizeof(Value); - } +void AccumulatorFirst::processInternal(const Value& input, bool merging) { + /* only remember the first value seen */ + if (!_haveFirst) { + // can't use pValue.missing() since we want the first value even if missing + _haveFirst = true; + _first = input; + _memUsageBytes = sizeof(*this) + input.getApproximateSize() - sizeof(Value); } +} - Value AccumulatorFirst::getValue(bool toBeMerged) const { - return _first; - } +Value AccumulatorFirst::getValue(bool toBeMerged) const { + return _first; +} - AccumulatorFirst::AccumulatorFirst() - : _haveFirst(false) - { - _memUsageBytes = sizeof(*this); - } +AccumulatorFirst::AccumulatorFirst() : _haveFirst(false) { + _memUsageBytes = sizeof(*this); +} - void AccumulatorFirst::reset() { - _haveFirst = false; - _first = Value(); - _memUsageBytes = sizeof(*this); - } +void AccumulatorFirst::reset() { + _haveFirst = false; + _first = Value(); + _memUsageBytes = sizeof(*this); +} - intrusive_ptr<Accumulator> AccumulatorFirst::create() { - return new AccumulatorFirst(); - } +intrusive_ptr<Accumulator> AccumulatorFirst::create() { + return new AccumulatorFirst(); +} - const char *AccumulatorFirst::getOpName() const { - return "$first"; - } +const char* AccumulatorFirst::getOpName() const { + return "$first"; +} } |