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

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

Documentation de fichiers - Reza 12/4/2000

File size: 1.1 KB
RevLine 
[219]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
[241]6#include "machdefs.h"
[219]7#include <list>
8
[895]9namespace SOPHYA {
10
[219]11class Periodic;
12typedef list<Periodic*> PeriodicList;
13
14typedef void (* UsPeriodicAction) (void *);
15
[895]16//! Class for the execution of a periodic action
[219]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
[895]28/*! Returns the time interval in seconds >= 1 sec */
[219]29 inline int Interval() { return(mDt); }
[895]30/*! Returns the time interval in milli-second */
[219]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
[895]48} // namespace SOPHYA
[219]49
50#endif
Note: See TracBrowser for help on using the repository browser.