17 #ifndef HPP_STATISTICS_BIN_HH 18 # define HPP_STATISTICS_BIN_HH 24 # include "hpp/statistics/config.hh" 28 namespace statistics {
35 class HPP_STATISTICS_DLLAPI
Bin 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();
133 const_iterator
end()
const 151 virtual T& increment (
const T& bin) __attribute__ ((deprecated));
156 virtual iterator insert (
const T& bin);
164 template <
typename T >
165 std::ostream& operator<< (std::ostream& os, const hpp::statistics::Statistics <T>& ss);
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 >
265 std::ostream& operator<< (std::ostream& os, const hpp::statistics::Statistics <T>& ss)
267 return ss.print (os);
272 #endif // HPP_STATISTICS_BIN_HH const_iterator begin() const
Definition: bin.hh:126
unsigned int numberOfBins() const
Return the number of bins.
Definition: bin.hh:112
const std::size_t & freq() const
Return the number of element in the bin.
Definition: bin.hh:39
double Proba_t
Definition: fwd.hh:22
virtual std::ostream & print(std::ostream &os) const
Put the results in a stream.
Definition: bin.hh:254
std::size_t numberOfObservations() const
Definition: bin.hh:106
Container::const_iterator const_iterator
Definition: bin.hh:90
std::ostream & operator<<(std::ostream &os, const hpp::statistics::Bin &b)
Definition: bin.hh:76
Container::iterator iterator
Definition: bin.hh:89
virtual std::ostream & print(std::ostream &os) const
Print the bin.
Definition: bin.hh:59
void clear()
Remove all element.
Definition: bin.hh:139
const_iterator end() const
Definition: bin.hh:133
virtual std::size_t freq(const T &bin) const
Definition: bin.hh:230
Bin()
Constructor.
Definition: bin.hh:69
std::list< T > Container
Definition: bin.hh:88