Formatting: move big inlines out of class def
This commit is contained in:
@@ -69,7 +69,42 @@ public:
|
|||||||
scheduleNextTimeout();
|
scheduleNextTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop()
|
void stop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onTimeout(const boost::system::error_code& error);
|
||||||
|
|
||||||
|
public:
|
||||||
|
device::DeviceAttachmentSpec deviceAttachmentSpec;
|
||||||
|
std::vector<StimFrame> frames_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SpinLock frameAssemblyRateLimiter;
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::asio::io_service& ioService;
|
||||||
|
std::atomic<bool> shouldContinue;
|
||||||
|
boost::asio::deadline_timer timer;
|
||||||
|
|
||||||
|
void scheduleNextTimeout(int delayMs = CONFIG_STIMBUFF_FRAME_PERIOD_MS)
|
||||||
|
{
|
||||||
|
if (!shouldContinue.load())
|
||||||
|
{ return; }
|
||||||
|
|
||||||
|
// Schedule the next timeout using the provided delay
|
||||||
|
timer.expires_from_now(
|
||||||
|
boost::posix_time::milliseconds(delayMs));
|
||||||
|
|
||||||
|
timer.async_wait(
|
||||||
|
std::bind(
|
||||||
|
&StimulusBuffer::onTimeout, this, std::placeholders::_1));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Inline methods
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
inline void StimulusBuffer::stop()
|
||||||
{
|
{
|
||||||
shouldContinue.store(false);
|
shouldContinue.store(false);
|
||||||
|
|
||||||
@@ -97,33 +132,7 @@ public:
|
|||||||
timer.cancel();
|
timer.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
inline void StimulusBuffer::onTimeout(const boost::system::error_code& error)
|
||||||
device::DeviceAttachmentSpec deviceAttachmentSpec;
|
|
||||||
std::vector<StimFrame> frames_;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
SpinLock frameAssemblyRateLimiter;
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::asio::io_service& ioService;
|
|
||||||
std::atomic<bool> shouldContinue;
|
|
||||||
boost::asio::deadline_timer timer;
|
|
||||||
|
|
||||||
void scheduleNextTimeout(int delayMs = CONFIG_STIMBUFF_FRAME_PERIOD_MS)
|
|
||||||
{
|
|
||||||
if (!shouldContinue.load())
|
|
||||||
{ return; }
|
|
||||||
|
|
||||||
// Schedule the next timeout using the provided delay
|
|
||||||
timer.expires_from_now(
|
|
||||||
boost::posix_time::milliseconds(delayMs));
|
|
||||||
|
|
||||||
timer.async_wait(
|
|
||||||
std::bind(
|
|
||||||
&StimulusBuffer::onTimeout, this, std::placeholders::_1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void onTimeout(const boost::system::error_code& error)
|
|
||||||
{
|
{
|
||||||
// Timer was cancelled, which is expected when stopping
|
// Timer was cancelled, which is expected when stopping
|
||||||
if (error == boost::asio::error::operation_aborted) {
|
if (error == boost::asio::error::operation_aborted) {
|
||||||
@@ -163,7 +172,6 @@ private:
|
|||||||
// Schedule next timeout with the pre-determined duration
|
// Schedule next timeout with the pre-determined duration
|
||||||
scheduleNextTimeout(nextWakeupDelayMs);
|
scheduleNextTimeout(nextWakeupDelayMs);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace stim_buff
|
} // namespace stim_buff
|
||||||
} // namespace smo
|
} // namespace smo
|
||||||
|
|||||||
Reference in New Issue
Block a user