trick/trick_source/sim_services/Timer/include/ITimer.hh
Alex Lin 14a75508a3 Cleaning up once include variables and copyright cleanup.
Changed all header file once include variables to follow the same naming
convention and not start with any underscores.  Also deleted old
incorrect copyright notices.  Also removed $Id: tags from all files.

Fixes #14.  Fixes #22.
2015-03-23 16:03:14 -05:00

67 lines
1.6 KiB
C++

/*
PURPOSE:
( gettimeofday Clock )
PROGRAMMERS:
(((Robert W. Bailey) (LinCom) (April 1992) (--) (Realtime.))
((Robert W. Bailey) (LinCom) (7/22/92) (--) (--))
((Eddie J. Paddock) (MDSSC) (Oct 1992) (--) (Realtime.))
((Alex Lin) (NASA) (April 2009) (--) (port to c++)))
*/
#ifndef ITIMER_HH
#define ITIMER_HH
#include <time.h>
#include <sys/time.h>
#include <semaphore.h>
#include <string>
#include "Timer.hh"
namespace Trick {
class ITimer : public Timer {
public:
ITimer() ;
~ITimer() ;
/** Post the semaphore value from the interrupt handler */
void semaphore_post() ;
/** @copybrief Trick::Timer::init() */
virtual int init() ;
/** @copybrief Trick::Timer::start() */
virtual int start(double frame_time) ;
/** @copybrief Trick::Timer::reset() */
virtual int reset(double frame_time) ;
/** @copybrief Trick::Timer::stop() */
virtual int stop() ;
/** @copybrief Trick::Timer::pause() */
virtual int pause() ;
/** @copybrief Trick::Timer::shutdown() */
virtual int shutdown() ;
protected:
struct timespec res; /* ** resolution of the clock */
struct timespec timeout; /* ** timeout value of some kind */
sem_t * semaphore; /* ** Posted by SIGALRM handler to tell sched loop to wake up. */
std::string sem_name ; /* ** name of the semaphore */
} ;
}
Trick::ITimer * get_itimer() ;
void it_handler(int sig) ;
#endif