Skip to content
Snippets Groups Projects
Commit 40e1bf39 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Change numberOfOccurence to numberOfObservations. Modify operator<<

parent 01e2ba1e
No related branches found
No related tags found
No related merge requests found
......@@ -36,8 +36,10 @@ IF (HPP_DEBUG)
ENDIF()
SET (${PROJECT_NAME}_HEADERS
include/hpp/statistics/fwd.hh
include/hpp/statistics/bin.hh
include/hpp/statistics/success-bin.hh
include/hpp/statistics/operators.hh
)
# Add dependency toward hpp-model library in pkg-config file.
......
......@@ -21,19 +21,8 @@
# include <ostream>
# include <set>
# include <hpp/statistics/config.hh>
namespace hpp {
namespace statistics {
class Bin;
template < typename T >
class Statistics;
} // namespace statistics
} // namespace hpp
std::ostream& operator<< (std::ostream&, const hpp::statistics::Bin&);
template < typename T >
std::ostream& operator<< (std::ostream&, const hpp::statistics::Statistics <T>&);
# include "hpp/statistics/config.hh"
# include "hpp/statistics/fwd.hh"
namespace hpp {
namespace statistics {
......@@ -94,8 +83,9 @@ namespace hpp {
/// Return the number of occurence of a Bin
virtual size_t freq (const T& bin) const;
/// Return the total number of occurence.
unsigned int numberOfOccurence () const
/// Return the number of times a observation has recorded. It is the
/// total number of observations.
unsigned int numberOfObservations () const
{
return counts_;
}
......@@ -171,17 +161,12 @@ namespace hpp {
std::ostream& Statistics<T>::print (std::ostream& os) const
{
const_iterator it;
for (it = begin(); it != end(); it++)
os << (*it) << std::endl;
for (it = begin(); it != end(); it++) {
it->print (os) << std::endl;
}
return os;
}
} // namespace statistics
} // namespace hpp
template < typename T >
std::ostream& operator<< (std::ostream& os, const hpp::statistics::Statistics <T>& ss)
{
return ss.print (os);
}
#endif // HPP_STATISTICS_HH
// Copyright (c) 2014, LAAS-CNRS
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
//
// This file is part of hpp-statistics.
// hpp-statistics is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// hpp-statistics is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// hpp-statistics. If not, see <http://www.gnu.org/licenses/>.
#ifndef HPP_STATISTICS_OPERATORS_HH
# define HPP_STATISTICS_OPERATORS_HH
# include <iosfwd>
# include "hpp/statistics/bin.hh"
# include "hpp/statistics/success-bin.hh"
# include "hpp/statistics/config.hh"
namespace hpp {
HPP_STATISTICS_DLLAPI std::ostream&
operator<< (std::ostream& os, const hpp::statistics::Bin& b);
HPP_STATISTICS_DLLAPI std::ostream&
operator<< (std::ostream& os, const hpp::statistics::SuccessBin& b);
template < typename T > HPP_STATISTICS_DLLAPI std::ostream&
operator<< (std::ostream& os, const hpp::statistics::Statistics <T>& ss);
HPP_STATISTICS_DLLAPI std::ostream&
operator<< (std::ostream& os, const hpp::statistics::SuccessStatistics& ss);
} // namespace hpp
#endif // HPP_STATISTICS_OPERATORS_HH
......@@ -23,6 +23,7 @@
# include "hpp/statistics/config.hh"
# include "hpp/statistics/bin.hh"
# include "hpp/statistics/fwd.hh"
# define HPP_DEFINE_REASON_FAILURE(ID, STRING) \
const ::hpp::statistics::SuccessBin::Reason ID = \
......@@ -122,9 +123,4 @@ namespace hpp {
} // namespace statistics
} // namespace hpp
std::ostream& operator<< (std::ostream& os, const hpp::statistics::SuccessStatistics& ss)
{
return ss.print (os);
}
#endif // HPP_STATISTICS_SUCCESSBIN_HH
......@@ -15,6 +15,7 @@
// hpp-statistics. If not, see <http://www.gnu.org/licenses/>.
#include "hpp/statistics/bin.hh"
#include "hpp/statistics/operators.hh"
namespace hpp {
namespace statistics {
......@@ -24,7 +25,3 @@ namespace hpp {
}
} // namespace statistics
} // namespace hpp
std::ostream& operator<< (std::ostream& os, const hpp::statistics::Bin& b)
{
return b.print (os);
}
......@@ -17,6 +17,7 @@
#include <limits.h>
#include "hpp/statistics/success-bin.hh"
#include "hpp/statistics/operators.hh"
namespace hpp {
namespace statistics {
......@@ -86,7 +87,7 @@ namespace hpp {
unsigned int SuccessStatistics::nbFailure () const
{
return numberOfOccurence() - nbSuccess();
return numberOfObservations() - nbSuccess();
}
unsigned int SuccessStatistics::nbFailure (const SuccessBin::Reason& r) const
......
......@@ -19,9 +19,12 @@
#include <iostream>
#include "hpp/statistics/success-bin.hh"
#include "hpp/statistics/operators.hh"
HPP_DEFINE_REASON_FAILURE (REASON_TEST, "Fake reason for testing purpose");
using namespace hpp;
int main ()
{
/* initialize random seed: */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment