2022-06-09 08:16:51 +03:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
|
|
#include "frc/event/EventLoop.h"
|
|
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
|
|
|
|
EventLoop::EventLoop() {}
|
|
|
|
|
|
2022-11-28 23:48:48 +02:00
|
|
|
void EventLoop::Bind(wpi::unique_function<void()> action) {
|
|
|
|
|
m_bindings.emplace_back(std::move(action));
|
2022-06-09 08:16:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EventLoop::Poll() {
|
2022-11-28 23:48:48 +02:00
|
|
|
for (wpi::unique_function<void()>& action : m_bindings) {
|
|
|
|
|
action();
|
2022-06-09 08:16:51 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EventLoop::Clear() {
|
|
|
|
|
m_bindings.clear();
|
|
|
|
|
}
|