An example of how to use the Async::Timer class
#include <iostream>
using namespace std;
class MyClass : public sigc::trackable
{
public:
MyClass(void) : count(0)
{
timer =
new Timer(1000, Timer::TYPE_PERIODIC);
timer->expired.connect(mem_fun(*this, &MyClass::onTimerExpired));
}
~MyClass(void)
{
delete timer;
}
private:
int count;
void onTimerExpired(
Timer *t)
{
if (++count == 3)
{
Application::app().quit();
}
cout << "Timer expired " << count << "...\n";
}
};
int main(int argc, char **argv)
{
MyClass my_class;
}
The core class for writing asyncronous cpp applications.
Contains a single shot or periodic timer that emits a signal on timeout.
An application class for writing non GUI applications.
void exec(void)
Execute the application main loop.
A class that produces timer events.
Namespace for the asynchronous programming classes.