2 The software in this package is distributed under the GNU General
3 Public License version 2 (with a special exception described below).
5 A copy of GNU General Public License (GPL) is included in this distribution,
6 in the file COPYING.GPL.
8 As a special exception, if other files instantiate templates or use macros
9 or inline functions from this file, or you compile this file and link it
10 with other works to produce a work based on this file, this file
11 does not by itself cause the resulting work to be covered
12 by the GNU General Public License.
14 However the source code for this file must still be made available
15 in accordance with section (3) of the GNU General Public License.
17 This exception does not invalidate any other reasons why a work based
18 on this file might be covered by the GNU General Public License.
22 * provides timer objects based on the TimerBase class
24 * (c) Copyright 2007 by Intra2net AG
27 #ifndef __ASYNC_TIMER_HPP__
28 #define __ASYNC_TIMER_HPP__
30 #include "async_io.hpp"
32 #include <boost/signals2.hpp>
38 class SimpleTimer : public TimerBase
42 typedef boost::signals2::signal<void()> TimerSignal;
43 typedef boost::signals2::signal<void(SimpleTimer*)> TimerSignalP;
49 // convenience constructors for simple timeouts:
50 SimpleTimer(const MilliTime& delta, const TimerSignal::slot_function_type& action);
51 SimpleTimer(long milli_seonds_delta, const TimerSignal::slot_function_type& action);
54 void addAction( const TimerSignal::slot_function_type& action );
55 void addActionP( const TimerSignalP::slot_function_type& action );
58 void startTimer( const MilliTime& delta );
59 void startTimerMS( long milli_seconds );
67 TimerSignal m_timer_signal;
68 TimerSignalP m_timer_signal_p;
70 virtual void execute();
71 }; // eo class SimpleTimer
74 } // eo namespace AsyncIo