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;
84 virtual std::size_t freq(
const T& bin)
const;
90 virtual Proba_t relativeFreq(
const T& bin)
const;
100 virtual std::ostream& print(std::ostream& os)
const;
102 const_iterator find(
const T& bin)
const;
104 template <
typename U>
105 const_iterator find(
const U& value)
const;
125 virtual T& increment(
const T& bin) __attribute__((deprecated));
130 virtual iterator insert(
const T& bin);
138 template <
typename T>
147 namespace statistics {
148 template <
typename T>
152 for (; it != bins_.end(); it++) {
154 if (!(*it == b)) it = bins_.insert(it, b);
159 it = bins_.insert(it, b);
164 template <
typename T>
168 for (; it != bins_.end(); it++) {
170 if (!(*it == b)) it = bins_.insert(it, b);
175 it = bins_.insert(it, b);
180 template <
typename T>
182 for (
const_iterator it = bins_.begin(); it != bins_.end(); it++) {
183 if (*it < b)
continue;
184 if (*it == b)
return it;
190 template <
typename T>
191 template <
typename U>
196 template <
typename T>
199 if (it == bins_.end()) {
205 template <
typename T>
208 if (it == bins_.end()) {
214 template <
typename T>
217 template <
typename T>
220 for (it = begin(); it != end(); it++) {
221 it->
print(os) << std::endl;
223 os <<
"Total number of observations: " << numberOfObservations();
227 template <
typename T>
235 #endif // HPP_STATISTICS_BIN_HH