/////////////////////////////////////////////////////////////////////////////// // rolling_mean.hpp // // Copyright 2008 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008 #define BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008 #include #include #include #include #include #include #include #include #include namespace boost { namespace accumulators { namespace impl { /////////////////////////////////////////////////////////////////////////////// // rolling_mean_impl // returns the unshifted results from the shifted rolling window template struct rolling_mean_impl : accumulator_base { typedef typename numeric::functional::average::result_type result_type; rolling_mean_impl(dont_care) {} template result_type result(Args const &args) const { return numeric::average(rolling_sum(args), rolling_count(args)); } }; } // namespace impl /////////////////////////////////////////////////////////////////////////////// // tag::rolling_mean // namespace tag { struct rolling_mean : depends_on< rolling_sum, rolling_count > { /// INTERNAL ONLY /// typedef accumulators::impl::rolling_mean_impl< mpl::_1 > impl; #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED /// tag::rolling_window::window_size named parameter static boost::parameter::keyword const window_size; #endif }; } // namespace tag /////////////////////////////////////////////////////////////////////////////// // extract::rolling_mean // namespace extract { extractor const rolling_mean = {}; BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_mean) } using extract::rolling_mean; }} // namespace boost::accumulators #endif