mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 00:03:34 +08:00
Added try_implicit_cast<>() to check callbacks validness at run time
This commit is contained in:
@@ -66,13 +66,18 @@ public:
|
||||
TimerEventForwarder(Scheduler& node, Functor functor)
|
||||
: Timer(node)
|
||||
, functor_(functor)
|
||||
{ }
|
||||
{
|
||||
assert(try_implicit_cast<bool>(functor, true));
|
||||
}
|
||||
|
||||
const Functor& getFunctor() const { return functor_; }
|
||||
|
||||
void onTimerEvent(const TimerEvent& event)
|
||||
{
|
||||
functor_(event);
|
||||
if (try_implicit_cast<bool>(functor_, true))
|
||||
functor_(event);
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user