CStopwatch.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2002 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #ifndef CSTOPWATCH_H
00016 #define CSTOPWATCH_H
00017 
00018 #include "common.h"
00019 
00021 
00025 class CStopwatch {
00026 public:
00031     CStopwatch(bool triggered = false);
00032     ~CStopwatch();
00033 
00035 
00036 
00038 
00044     double              reset();
00045 
00047 
00052     void                stop();
00053 
00055 
00059     void                start();
00060 
00062 
00068     void                setTrigger();
00069 
00071 
00075     double              getTime();
00077                         operator double();
00079 
00080 
00081 
00083 
00086     bool                isStopped() const;
00087 
00088     // return the time since the last reset().  
00090 
00094     double              getTime() const;
00096                         operator double() const;
00098 
00099 private:
00100     double              getClock() const;
00101 
00102 private:
00103     double              m_mark;
00104     bool                m_triggered;
00105     bool                m_stopped;
00106 };
00107 
00108 #endif

Generated on Fri Nov 6 00:18:45 2009 for synergy-plus by  doxygen 1.4.7