From 1527a67262baf2d80776f86d4af0e42d53aa3eec Mon Sep 17 00:00:00 2001 From: Charlie Swanson Date: Wed, 1 Jul 2015 16:47:20 -0400 Subject: SERVER-19105 Add macro to register Accumulators, move REGISTER_EXPRESSION to header --- src/mongo/db/pipeline/accumulator_min_max.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/mongo/db/pipeline/accumulator_min_max.cpp') diff --git a/src/mongo/db/pipeline/accumulator_min_max.cpp b/src/mongo/db/pipeline/accumulator_min_max.cpp index da4f280f797..9bfbf7b380b 100644 --- a/src/mongo/db/pipeline/accumulator_min_max.cpp +++ b/src/mongo/db/pipeline/accumulator_min_max.cpp @@ -35,6 +35,15 @@ namespace mongo { using boost::intrusive_ptr; +REGISTER_ACCUMULATOR(max, AccumulatorMinMax::createMax); +REGISTER_ACCUMULATOR(min, AccumulatorMinMax::createMin); + +const char* AccumulatorMinMax::getOpName() const { + if (_sense == 1) + return "$min"; + return "$max"; +} + void AccumulatorMinMax::processInternal(const Value& input, bool merging) { // nullish values should have no impact on result if (!input.nullish()) { @@ -67,10 +76,4 @@ intrusive_ptr AccumulatorMinMax::createMin() { intrusive_ptr AccumulatorMinMax::createMax() { return new AccumulatorMinMax(Sense::MAX); } - -const char* AccumulatorMinMax::getOpName() const { - if (_sense == 1) - return "$min"; - return "$max"; -} } -- cgit v1.2.1