mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add move constructors and assignment operators to wpilibc (#1314)
Fixes #898.
This commit is contained in:
committed by
Peter Johnson
parent
b1965f74a8
commit
1aa8446725
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <hal/HAL.h>
|
||||
|
||||
#include "frc/Timer.h"
|
||||
@@ -61,6 +63,22 @@ TimedRobot::~TimedRobot() {
|
||||
HAL_CleanNotifier(m_notifier, &status);
|
||||
}
|
||||
|
||||
TimedRobot::TimedRobot(TimedRobot&& rhs)
|
||||
: IterativeRobotBase(std::move(rhs)),
|
||||
m_expirationTime(std::move(rhs.m_expirationTime)) {
|
||||
std::swap(m_notifier, rhs.m_notifier);
|
||||
}
|
||||
|
||||
TimedRobot& TimedRobot::operator=(TimedRobot&& rhs) {
|
||||
IterativeRobotBase::operator=(std::move(rhs));
|
||||
ErrorBase::operator=(std::move(rhs));
|
||||
|
||||
std::swap(m_notifier, rhs.m_notifier);
|
||||
m_expirationTime = std::move(rhs.m_expirationTime);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void TimedRobot::UpdateAlarm() {
|
||||
int32_t status = 0;
|
||||
HAL_UpdateNotifierAlarm(
|
||||
|
||||
Reference in New Issue
Block a user