//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project
//
//File: timers.h 
//
//State: $State: Exp $
//
//Version: $Revision: 1.15 $
//
//Date: $Date: 1998/10/19 08:46:02 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
// 
//Authors:
//	Vesa-Matti Puro
//      Jari Pusa
//
//Description:
//
//
//Copyright:    
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
// 
//      
//Licence:
//     
//
//History:
//
//

#ifndef __PF_TIMERS_H__
#define __PF_TIMERS_H__

class pfProtocol;

#include <typeinfo>
#include <string>
#include <map>
#include "timer.h"
#include "conduit.h"
#include "exception.h"

class pfTimers
{
    public:
        pfTimers(const pfTimers &other_);
        virtual ~pfTimers(void);

        // throw (pfNameAlreadyDefinedException,
        //        pfNullPointerException);
        void defineTimer(const string &name_,
                         pfTimerMessenger *timerMessenger_,
                         pfUlong timeout_in_msec_);
        
        // throw (pfNameUndefinedException);
        void startTimer(const string &name_);
        void stopTimer(const string &name_);
        void setTimeout(const string &name_, pfUlong timeout_in_msec_);
        bool isTimerActive(const string &name_);

    protected:
        pfTimers(pfProtocol *host_);

    private:
	pfTimers &operator=(const pfTimers &other_);
        // throw (pfNameUndefinedException);
        pfTimer &getTimer(const string &name_);
        
        typedef map<string, pfTimer, less<string> > mapType;
        typedef mapType::iterator mapIterType;
        typedef pair<mapIterType, bool> insResultType;
        mapType _map;
        pfProtocol *_host;
};

#endif // __PF_TIMERS_H__

