///////////////////////////////////////////////////////////////////////////// // tstat.cc // // SIMLIB version: 2.18 // Date: 2004-01-25 // // Copyright (c) 1991-2004 Petr Peringer // // This library is licensed under GNU Library GPL. See the file COPYING. // // // class TStat --- time statistic // //////////////////////////////////////////////////////////////////////////// // interface // #include "simlib.h" #include "internal.h" //////////////////////////////////////////////////////////////////////////// // implementation // SIMLIB_IMPLEMENTATION #define CHECKTSTAT(tsptr) if (!tsptr) SIMLIB_error(TStatRefError); //////////////////////////////////////////////////////////////////////////// // constructors // TStat::TStat(double initval): sxt(0), sx2t(0), min(initval), max(initval), t0(Time), tl(Time), // time of initialization and last op xl(initval), // last value n(0UL) // # of rec { dprintf(("TStat::TStat()")); // Clear() } TStat::TStat(const char *name, double initval) : sxt(0), sx2t(0), min(initval), max(initval), t0(Time), tl(Time), xl(initval), n(0UL) { dprintf(("TStat::TStat(\"%s\")",name)); SetName(name); // Clear() } //////////////////////////////////////////////////////////////////////////// // destructor // TStat::~TStat() { dprintf(("TStat::~TStat() // \"%s\" ", Name())); } //////////////////////////////////////////////////////////////////////////// // operator () // void TStat::operator () (double x) { CHECKTSTAT(this); if (Timemax) max = x; } } //////////////////////////////////////////////////////////////////////////// // Clear // void TStat::Clear(double initval) { dprintf(("TStat::Clear() // \"%s\" ", Name())); sxt = sx2t = 0; min = max = initval; t0 = tl = Time; xl = initval; // last value n = 0UL; } //////////////////////////////////////////////////////////////////////////// // TStat::MeanValue // double TStat::MeanValue() const { // if(n==0) Error(111); // return 0 ???? nesmysl !!!! if(Time