source: Sophya/trunk/SophyaLib/SysTools/periodic.h@ 3007

Last change on this file since 3007 was 895, checked in by ansari, 25 years ago

Documentation de fichiers - Reza 12/4/2000

File size: 1.1 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2// Classe d'objets avec une methode (DoPeriodic()) appelee periodiquement
3#ifndef PERIODIC_H
4#define PERIODIC_H
5
6#include "machdefs.h"
7#include <list>
8
9namespace SOPHYA {
10
11class Periodic;
12typedef list<Periodic*> PeriodicList;
13
14typedef void (* UsPeriodicAction) (void *);
15
16//! Class for the execution of a periodic action
17class Periodic
18{
19public:
20 Periodic(int dt, UsPeriodicAction act=NULL, void * usp=NULL);
21 virtual ~Periodic();
22
23 void SetAction(UsPeriodicAction act, void * usp=NULL);
24
25 virtual void SetInterval(int dt);
26 virtual void SetIntervalms(int dtms);
27
28/*! Returns the time interval in seconds >= 1 sec */
29 inline int Interval() { return(mDt); }
30/*! Returns the time interval in milli-second */
31 inline int Intervalms() { return(mDtms); }
32
33 virtual void Start(int dt=-1);
34 virtual void Stop();
35
36 virtual void DoPeriodic();
37
38 static PeriodicList* actifs;
39 static void CallBack(int);
40
41protected:
42 int mDt, mDtms, it;
43 UsPeriodicAction mAct;
44 void * mUsp;
45 bool mFgact;
46};
47
48} // namespace SOPHYA
49
50#endif
Note: See TracBrowser for help on using the repository browser.