CXX11 support for PITimer

git-svn-id: svn://db.shs.com.ru/pip@882 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2020-02-25 14:54:57 +00:00
parent ef2eab9951
commit ddd06de776
6 changed files with 65 additions and 398 deletions

View File

@@ -52,7 +52,8 @@
_PITimerBase::_PITimerBase() {
interval_ = deferred_delay = 0.;
interval_ = 1000;
deferred_delay = 0.;
running_ = deferred_ = deferred_mode = false;
tfunc = 0;
parent = 0;
@@ -481,14 +482,22 @@ PITimer::PITimer(TimerEvent slot, void * data, PITimer::TimerImplementation ti):
}
//PITimer::PITimer(const PITimer & other): PIObject() {
// imp_mode = other.imp_mode;
// initFirst();
// data_t = other.data_t;
// ret_func = other.ret_func;
//}
#ifdef PIP_CXX11_SUPPORT
PITimer::PITimer(std::function<void ()> slot, PITimer::TimerImplementation ti) {
imp_mode = ti;
initFirst();
ret_func = [slot](void *, int){slot();};
}
PITimer::PITimer(std::function<void (void *)> slot, void * data, PITimer::TimerImplementation ti) {
imp_mode = ti;
initFirst();
data_t = data;
ret_func = [slot](void *d, int){slot(d);};
}
#endif
PITimer::~PITimer() {
destroy();
}
@@ -579,6 +588,7 @@ void PITimer::tickImp() {
bool PITimer::start() {
init();
//piCout << this << "start" << imp;
return imp->start();
}