added ctors to StatisticsData
[senf.git] / senf / Utils / StatisticAccumulator.hh
index 0293e5f..178fbb8 100644 (file)
@@ -34,9 +34,19 @@ namespace senf {
 
      struct StatisticsData
      {
+        StatisticsData( float min_, float avg_, float max_, float stddev_, boost::uint32_t count_)
+            : min(min_), avg(avg_), max(max_), stddev(stddev_), count(count_){
+        };
+        StatisticsData( StatisticsData const & other)
+            : min(other.min), avg(other.avg), max(other.max), stddev(other.stddev), count(other.count){
+        };
+        StatisticsData()
+            : min(0.0), avg(0.0), max(0.0), stddev(0.0), count(0){
+        };
+
          float min;
-         float max;
          float avg;
+         float max;
          float stddev;
          boost::uint32_t count;
      };
@@ -67,8 +77,12 @@ namespace senf {
         /**< This member reset all values. */
         void accumulate(T value);
         ///< Gather value to be accumulated.
-        /**< This method accumulate a value.
+        /**< This method accumulates a value.
              \param[in] value to be accumulated value*/
+        void setLastAvg(T value);
+        ///< If no real data was collected, this method specifies the min/avg/max value to be returned.
+        /**< This method specifies the the min/avg/max value to be returned if no real data was colelcted
+             \param[in] value to be returned*/
 
     public:
         T     min() const;
@@ -89,7 +103,7 @@ namespace senf {
         boost::uint32_t count() const;
         ///< Returns count of accumulated values.
         /**< This method returns count of accumulated values of the current accumulation.*/
-        void data( StatisticsData & data_);
+        void data( StatisticsData & data_) const;
         ///< Returns the accumulated data as a tuple
         /**< This method returns the accumulated information as a tuple.*/