
/*
**  This file forms part of the GOBLIN C++ Class Library.
**
**  Written by Christian Fremuth-Paeger, June 2003.
**  
**  Copying, compiling, distribution and modification
**  of this source code is permitted only in accordance
**  with the GOBLIN general licence information.
*/             


#if !defined(_TIMERS_H_)

#define _TIMERS_H_


#include <globals.h>

#if defined(_TIMERS_)

class goblinTimer
{
private:

    double          clockTick;

    double          accTime;
    double          minTime;
    double          maxTime;
    double          prevTime;
    unsigned long   nRounds;

    bool            enabled;
    unsigned long   nestingDepth;
    double          startTime;
    
    double*         savedTime;
    goblinTimer**   globalTimer;

    TFloat      lowerBound;
    TFloat      upperBound;
       
public:

    goblinTimer(goblinTimer** = NULL) throw();
    ~goblinTimer() throw();
                    
    void        Reset() throw(ERRejected);
    bool        Enable() throw();
    bool        Disable() throw();

    double      AccTime() throw();
    double      AvTime() throw();
    double      MaxTime() throw();
    double      MinTime() throw();
    double      PrevTime() throw();
    double      ChildTime(TTimer) throw();

    bool        Enabled() throw() {return enabled;};
    bool        FullInfo() throw() {return (savedTime!=NULL);};

    bool        SetLowerBound(TFloat) throw(ERRejected);
    bool        SetUpperBound(TFloat) throw(ERRejected);
    
    TFloat      LowerBound() throw() {return lowerBound;};
    TFloat      UpperBound() throw() {return upperBound;};

};


typedef goblinTimer* pGoblinTimer;

#endif

#endif
