17 #ifndef HPP_STATISTICS_BIN_HH
18 #define HPP_STATISTICS_BIN_HH
28 namespace statistics {
38 const std::size_t&
freq()
const {
return freq_; }
49 virtual std::ostream&
print(std::ostream& os)
const {
50 return printValue(os << freq() <<
" - ");
54 virtual std::ostream& printValue(std::ostream& os)
const = 0;
85 virtual std::size_t freq(
const T& bin)
const;
91 virtual Proba_t relativeFreq(
const T& bin)
const;
101 virtual std::ostream& print(std::ostream& os)
const;
103 const_iterator find(
const T& bin)
const;
105 template <
typename U>
106 const_iterator find(
const U& value)
const;
126 virtual T& increment(
const T& bin) __attribute__((deprecated));
131 virtual iterator insert(
const T& bin);
139 template <
typename T>
148 namespace statistics {
149 template <
typename T>
153 for (; it != bins_.end(); it++) {
155 if (!(*it == b)) it = bins_.insert(it, b);
160 it = bins_.insert(it, b);
165 template <
typename T>
169 for (; it != bins_.end(); it++) {
171 if (!(*it == b)) it = bins_.insert(it, b);
176 it = bins_.insert(it, b);
181 template <
typename T>
183 for (
const_iterator it = bins_.begin(); it != bins_.end(); it++) {
184 if (*it < b)
continue;
185 if (*it == b)
return it;
191 template <
typename T>
192 template <
typename U>
197 template <
typename T>
200 if (it == bins_.end()) {
206 template <
typename T>
209 if (it == bins_.end()) {
215 template <
typename T>
218 template <
typename T>
221 for (it = begin(); it != end(); it++) {
222 it->
print(os) << std::endl;
224 os <<
"Total number of observations: " << numberOfObservations();
228 template <
typename T>
236 #endif // HPP_STATISTICS_BIN_HH