3 * (c) Copyright 2007 by Intra2net AG
11 #include "async_timer.hpp"
17 #define DOUT(msg) std::cout << msg << std::endl
18 #define FODOUT(obj,msg) std::cout << typeid(*obj).name() << "[" << obj << "]:" << msg << std::endl
19 #define ODOUT(msg) std::cout << typeid(*this).name() << "[" << this << "]:" << msg << std::endl
21 #define DOUT(msg) do {} while (0)
22 #define FODOUT(obj,msg) do {} while (0)
23 #define ODOUT(msg) do {} while (0)
32 * Implementation of SimpleTimer
35 SimpleTimer::SimpleTimer()
37 } // eo SimpleTimer::SimpleTimer()
40 SimpleTimer::SimpleTimer(const MilliTime& delta, const TimerSignal::slot_function_type& action)
44 } // eo SimpleTimer::SimpleTimer(const MilliTime&, const TimerSignal::slot_type&)
47 SimpleTimer::SimpleTimer(long milli_seonds_delta, const TimerSignal::slot_function_type& action)
50 startTimerMS(milli_seonds_delta);
51 } // eo SimpleTimer::SimpleTimer(long, const TimerSignal::slot_type&)
54 void SimpleTimer::execute()
58 m_timer_signal_p(this);
59 } // eo SimpleTimer::execute
62 void SimpleTimer::addAction( const TimerSignal::slot_function_type& action )
64 m_timer_signal.connect(action);
65 } // eo SimpleTimer::addAction(const TimerSignal::slot_type&)
68 void SimpleTimer::addActionP( const TimerSignalP::slot_function_type& action )
70 m_timer_signal_p.connect(action);
71 } // eo SimpleTimer::addAction(const TimerSignalP::slot_type&)
74 void SimpleTimer::startTimer( const MilliTime& delta )
77 setDeltaWhenTime( delta );
81 get_current_time(now);
85 ODOUT(" now: sec="<< now.mt_sec << ", msec="<<now.mt_msec);
86 ODOUT(" t: sec="<< t.mt_sec << ", msec="<<t.mt_msec);
87 ODOUT(" dt: sec="<< dt.mt_sec << ", msec="<<dt.mt_msec);
89 } // eo SimpleTimer::startTimer(const MilliTime&)
92 void SimpleTimer::startTimerMS( long milli_seconds )
94 startTimer( MilliTime(0,milli_seconds) );
95 } // eo SimpleTimer::stratTimerMS(long)
98 void SimpleTimer::stopTimer()
101 } // eo SimpleTimer::stopTimer
104 } // eo namespace AsyncIo