summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/accumulator_std_dev.cpp
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2015-07-01 16:47:20 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2015-07-13 17:41:39 -0400
commit1527a67262baf2d80776f86d4af0e42d53aa3eec (patch)
tree802170077582f8d30a12e548b2e6ce6578275443 /src/mongo/db/pipeline/accumulator_std_dev.cpp
parent908313432e597623361df39339cee452176fd7b2 (diff)
downloadmongo-1527a67262baf2d80776f86d4af0e42d53aa3eec.tar.gz
SERVER-19105 Add macro to register Accumulators, move REGISTER_EXPRESSION to header
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_std_dev.cpp')
-rw-r--r--src/mongo/db/pipeline/accumulator_std_dev.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/accumulator_std_dev.cpp b/src/mongo/db/pipeline/accumulator_std_dev.cpp
index b51a21bbe6f..00922345ed9 100644
--- a/src/mongo/db/pipeline/accumulator_std_dev.cpp
+++ b/src/mongo/db/pipeline/accumulator_std_dev.cpp
@@ -36,6 +36,13 @@
namespace mongo {
using boost::intrusive_ptr;
+REGISTER_ACCUMULATOR(stdDevPop, AccumulatorStdDev::createPop);
+REGISTER_ACCUMULATOR(stdDevSamp, AccumulatorStdDev::createSamp);
+
+const char* AccumulatorStdDev::getOpName() const {
+ return (_isSamp ? "$stdDevSamp" : "$stdDevPop");
+}
+
void AccumulatorStdDev::processInternal(const Value& input, bool merging) {
if (!merging) {
// non numeric types have no impact on standard deviation
@@ -101,8 +108,4 @@ void AccumulatorStdDev::reset() {
_mean = 0;
_m2 = 0;
}
-
-const char* AccumulatorStdDev::getOpName() const {
- return (_isSamp ? "$stdDevSamp" : "$stdDevPop");
-}
}