17 #ifndef HPP_STATISTICS_BIN_HH
18 # define HPP_STATISTICS_BIN_HH
28 namespace statistics {
39 const std::size_t&
freq ()
const
46 std::size_t operator ++()
53 std::size_t operator ++(
int)
59 virtual std::ostream&
print (std::ostream& os)
const
61 return printValue (os << freq () <<
" - ");
65 virtual std::ostream& printValue (std::ostream& os)
const = 0;
84 template <
typename T >
96 virtual std::size_t freq (
const T& bin)
const;
102 virtual Proba_t relativeFreq (
const T& bin)
const;
114 return bins_.size ();
118 virtual std::ostream& print (std::ostream& os)
const;
120 const_iterator find (
const T& bin)
const;
122 template <
typename U > const_iterator find (
const U& value)
const;
128 return bins_.begin();
151 virtual T& increment (
const T& bin) __attribute__ ((deprecated));
156 virtual iterator insert (
const T& bin);
164 template <
typename T >
172 namespace statistics {
173 template <
typename T >
178 for (; it != bins_.end (); it++) {
181 it = bins_.insert (it, b);
186 it = bins_.insert (it, b);
191 template <
typename T >
196 for (; it != bins_.end (); it++) {
199 it = bins_.insert (it, b);
204 it = bins_.insert (it, b);
209 template <
typename T>
213 it != bins_.end (); it++) {
223 template <
typename T>
template <
typename U >
229 template <
typename T >
233 if (it == bins_.end ()) {
239 template <
typename T >
243 if (it == bins_.end ()) {
249 template <
typename T >
253 template <
typename T >
257 for (it = begin(); it != end(); it++) {
258 it->print (os) << std::endl;
260 os <<
"Total number of observations: " << numberOfObservations ();
264 template <
typename T >
267 return ss.
print (os);
272 #endif // HPP_STATISTICS_BIN_HH