6 #ifndef OPENMPCD_IMPLEMENTATIONDETAILS_ONTHEFLYSTATISTICS_HPP
7 #define OPENMPCD_IMPLEMENTATIONDETAILS_ONTHEFLYSTATISTICS_HPP
11 #include <boost/algorithm/string.hpp>
12 #include <boost/lexical_cast.hpp>
13 #include <boost/static_assert.hpp>
14 #include <boost/type_traits/is_arithmetic.hpp>
25 BOOST_STATIC_ASSERT(boost::is_arithmetic<T>::value);
29 ss.precision(std::numeric_limits<T>::digits10 + 2);
32 ss << sampleSize <<
";";
42 BOOST_STATIC_ASSERT(boost::is_arithmetic<T>::value);
44 std::vector<std::string> parts;
45 boost::algorithm::split(parts, state, boost::algorithm::is_any_of(
";"));
49 if(parts[0][0] ==
'-')
51 const unsigned int version =
52 boost::lexical_cast<unsigned int>(parts[0]);
60 if(parts[1][0] ==
'-')
63 const std::size_t _sampleSize =
64 boost::lexical_cast<std::size_t>(parts[1]);
65 const T _mean = boost::lexical_cast<T>(parts[2]);
66 const T _varianceHelper = boost::lexical_cast<T>(parts[3]);
70 if(_mean != 0 || _varianceHelper != 0)
73 if(_varianceHelper < 0)
76 sampleSize = _sampleSize;
78 varianceHelper = _varianceHelper;
80 catch(
const boost::bad_lexical_cast&)
88 #endif //OPENMPCD_IMPLEMENTATIONDETAILS_ONTHEFLYSTATISTICS_HPP