Timer.h
Go to the documentation of this file.
1 /*
2  * Katana Native Interface - A C++ interface to the robot arm Katana.
3  * Copyright (C) 2005 Neuronics AG
4  * Check out the AUTHORS file for detailed contact information.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 #ifndef KNITIMER_H
22 #define KNITIMER_H
23 
24 #include <ctime>
25 
26 #ifndef WIN32 // POSIX 1b
27 #include <sys/time.h>
28 #endif
29 
30 namespace KNI {
31 
36  void sleep(long time);
37 
41  class Timer {
42  private:
43  long _timeout;
44 
45 #ifdef WIN32
46  clock_t _ct;
47 #else
48  struct timeval _ct;
49 #endif
50 
52  long _ElapsedTime() const;
53 
54  public:
55  Timer();
56  Timer(long timeout);
57 
58  void Set(long timeout);
59  void Start();
60 
61  void Set_And_Start(long timeout);
62 
66  bool Elapsed() const;
67 
71  long ElapsedTime() const;
72 
76  void WaitUntilElapsed() const;
77 
78  };
79 
80 
81 
82 }
83 
84 #endif
long ElapsedTime() const
Definition: Timer.cpp:74
bool Elapsed() const
Definition: Timer.cpp:69
struct timeval _ct
Definition: Timer.h:48
long _ElapsedTime() const
Platform specific implementation of ElapsedTime().
Definition: Timer.cpp:55
void Set(long timeout)
Definition: Timer.cpp:30
void WaitUntilElapsed() const
Definition: Timer.cpp:78
void Set_And_Start(long timeout)
Definition: Timer.cpp:64
void sleep(long time)
Definition: Timer.cpp:86
void Start()
Definition: Timer.cpp:51
long _timeout
Definition: Timer.h:43
Definition: Timer.h:30


kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:17