mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Common naming conventions for event handling methods: handleFooBar() instead of onFooBar()
This commit is contained in:
parent
393641b5b6
commit
3d8285b123
@ -27,7 +27,7 @@ protected:
|
||||
virtual ~MonotonicDeadlineHandler() { stop(); }
|
||||
|
||||
public:
|
||||
virtual void onMonotonicDeadline(uint64_t monotonic_timestamp) = 0;
|
||||
virtual void handleMonotonicDeadline(uint64_t monotonic_timestamp) = 0;
|
||||
|
||||
void startWithDeadline(uint64_t monotonic_deadline);
|
||||
void startWithDelay(uint64_t delay_usec);
|
||||
|
||||
@ -33,7 +33,7 @@ class Timer : private MonotonicDeadlineHandler
|
||||
{
|
||||
uint64_t period_;
|
||||
|
||||
void onMonotonicDeadline(uint64_t monotonic_timestamp);
|
||||
void handleMonotonicDeadline(uint64_t monotonic_timestamp);
|
||||
|
||||
public:
|
||||
static const uint64_t InfinitePeriod = 0xFFFFFFFFFFFFFFFFUL;
|
||||
@ -54,7 +54,7 @@ public:
|
||||
|
||||
uint64_t getPeriod() const { return period_; }
|
||||
|
||||
virtual void onTimerEvent(const TimerEvent& event) = 0;
|
||||
virtual void handleTimerEvent(const TimerEvent& event) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ public:
|
||||
const Callback& getCallback() const { return callback_; }
|
||||
void setCallback(const Callback& callback) { callback_ = callback; }
|
||||
|
||||
void onTimerEvent(const TimerEvent& event)
|
||||
void handleTimerEvent(const TimerEvent& event)
|
||||
{
|
||||
if (try_implicit_cast<bool>(callback_, true))
|
||||
callback_(event);
|
||||
|
||||
@ -98,7 +98,7 @@ uint64_t MonotonicDeadlineScheduler::pollAndGetMonotonicTimestamp(ISystemClock&
|
||||
return ts;
|
||||
|
||||
handlers_.remove(mdh);
|
||||
mdh->onMonotonicDeadline(ts); // This handler can be re-registered immediately
|
||||
mdh->handleMonotonicDeadline(ts); // This handler can be re-registered immediately
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
|
||||
@ -10,7 +10,7 @@ namespace uavcan
|
||||
|
||||
const uint64_t Timer::InfinitePeriod;
|
||||
|
||||
void Timer::onMonotonicDeadline(uint64_t monotonic_timestamp)
|
||||
void Timer::handleMonotonicDeadline(uint64_t monotonic_timestamp)
|
||||
{
|
||||
assert(!isRunning());
|
||||
|
||||
@ -18,7 +18,7 @@ void Timer::onMonotonicDeadline(uint64_t monotonic_timestamp)
|
||||
startWithDeadline(getMonotonicDeadline() + period_);
|
||||
|
||||
// Application can re-register the timer with different params, it's OK
|
||||
onTimerEvent(TimerEvent(this, getMonotonicDeadline(), monotonic_timestamp));
|
||||
handleTimerEvent(TimerEvent(this, getMonotonicDeadline(), monotonic_timestamp));
|
||||
}
|
||||
|
||||
void Timer::startOneShotWithDeadline(uint64_t monotonic_deadline_usec)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user