2000-06-08 23:16:16 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
#ifndef TIMEOUT_H
|
|
|
|
#define TIMEOUT_H
|
|
|
|
|
2000-06-21 12:41:18 +00:00
|
|
|
#include <sigc++/signal_system.h>
|
|
|
|
|
|
|
|
#ifdef SIGC_CXX_NAMESPACES
|
|
|
|
using SigC::Signal0;
|
|
|
|
#endif
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
/** This class executes the callback when the timeout expires.
|
|
|
|
This class currently uses a regular callback, later it will use
|
|
|
|
signals and slots to provide the same.
|
|
|
|
*/
|
|
|
|
class Timeout {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
enum Type {
|
|
|
|
ONETIME,
|
|
|
|
CONTINOUS
|
|
|
|
};
|
|
|
|
///
|
|
|
|
Timeout();
|
|
|
|
///
|
|
|
|
Timeout(int msec, Type = ONETIME);
|
|
|
|
///
|
|
|
|
~Timeout();
|
|
|
|
///
|
|
|
|
void start();
|
|
|
|
///
|
|
|
|
void stop();
|
|
|
|
///
|
|
|
|
void restart();
|
|
|
|
///
|
2000-06-21 12:41:18 +00:00
|
|
|
Signal0<void> timeout;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2000-06-21 12:41:18 +00:00
|
|
|
void emit();
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
|
|
|
void setType(Type t);
|
|
|
|
///
|
|
|
|
void setTimeout(int msec);
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
Type type;
|
|
|
|
///
|
2000-06-21 12:41:18 +00:00
|
|
|
int timeout_ms;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
|
|
|
int timeout_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|