]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/accumulators/include/boost/accumulators/statistics/rolling_count.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / accumulators / include / boost / accumulators / statistics / rolling_count.hpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // rolling_count.hpp
3 //
4 // Copyright 2008 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 #ifndef BOOST_ACCUMULATORS_STATISTICS_ROLLING_COUNT_HPP_EAN_26_12_2008
9 #define BOOST_ACCUMULATORS_STATISTICS_ROLLING_COUNT_HPP_EAN_26_12_2008
10
11 #include <boost/mpl/placeholders.hpp>
12 #include <boost/accumulators/framework/accumulator_base.hpp>
13 #include <boost/accumulators/framework/extractor.hpp>
14 #include <boost/accumulators/numeric/functional.hpp>
15 #include <boost/accumulators/framework/parameters/sample.hpp>
16 #include <boost/accumulators/framework/depends_on.hpp>
17 #include <boost/accumulators/statistics_fwd.hpp>
18 #include <boost/accumulators/statistics/rolling_window.hpp>
19
20 namespace boost { namespace accumulators
21 {
22
23 namespace impl
24 {
25
26 ///////////////////////////////////////////////////////////////////////////////
27 // rolling_count_impl
28 // returns the count of elements in the rolling window
29 template<typename Sample>
30 struct rolling_count_impl
31 : accumulator_base
32 {
33 typedef std::size_t result_type;
34
35 rolling_count_impl(dont_care)
36 {}
37
38 template<typename Args>
39 result_type result(Args const &args) const
40 {
41 return static_cast<std::size_t>(rolling_window_plus1(args).size()) - is_rolling_window_plus1_full(args);
42 }
43 };
44
45 } // namespace impl
46
47 ///////////////////////////////////////////////////////////////////////////////
48 // tag::rolling_count
49 //
50 namespace tag
51 {
52 struct rolling_count
53 : depends_on< rolling_window_plus1 >
54 {
55 /// INTERNAL ONLY
56 ///
57 typedef accumulators::impl::rolling_count_impl< mpl::_1 > impl;
58
59 #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
60 /// tag::rolling_window::window_size named parameter
61 static boost::parameter::keyword<tag::rolling_window_size> const window_size;
62 #endif
63 };
64 } // namespace tag
65
66 ///////////////////////////////////////////////////////////////////////////////
67 // extract::rolling_count
68 //
69 namespace extract
70 {
71 extractor<tag::rolling_count> const rolling_count = {};
72
73 BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_count)
74 }
75
76 using extract::rolling_count;
77
78 }} // namespace boost::accumulators
79
80 #endif