Timer.h
Go to the documentation of this file.
00001 /*
00002  *   Katana Native Interface - A C++ interface to the robot arm Katana.
00003  *   Copyright (C) 2005 Neuronics AG
00004  *   Check out the AUTHORS file for detailed contact information.
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with this program; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 #ifndef KNITIMER_H
00022 #define KNITIMER_H
00023 
00024 #include <ctime>
00025 
00026 #ifndef WIN32 // POSIX 1b
00027 #include <sys/time.h>
00028 #endif
00029 
00030 namespace KNI {
00031 
00036     void sleep(long time);
00037 
00041     class Timer {
00042     private:
00043         long _timeout;
00044         
00045 #ifdef WIN32
00046         clock_t _ct;
00047 #else
00048         struct timeval _ct;
00049 #endif
00050 
00052         long _ElapsedTime() const;
00053 
00054     public:
00055         Timer();
00056         Timer(long timeout);
00057 
00058         void Set(long timeout);
00059         void Start();
00060 
00061         void Set_And_Start(long timeout);
00062         
00066         bool Elapsed() const;
00067 
00071         long ElapsedTime() const;
00072 
00076         void WaitUntilElapsed() const;
00077 
00078     };
00079 
00080 
00081 
00082 }
00083 
00084 #endif


kni
Author(s): Neuronics AG (see AUTHORS.txt); ROS wrapper by Martin Günther
autogenerated on Mon Oct 6 2014 10:45:33