mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[sim] Add WPILib-class-taking constructors (#2538)
When not direct mapped, make index constructors private and add factory functions for channel and index. Co-authored-by: GabrielDeml <gabrielddeml@gmail.com>
This commit is contained in:
@@ -13,12 +13,29 @@
|
||||
#include <hal/simulation/RelayData.h>
|
||||
|
||||
#include "CallbackStore.h"
|
||||
#include "frc/Relay.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
|
||||
/**
|
||||
* Class to control a simulated relay.
|
||||
*/
|
||||
class RelaySim {
|
||||
public:
|
||||
explicit RelaySim(int index) { m_index = index; }
|
||||
/**
|
||||
* Constructs from a Relay object.
|
||||
*
|
||||
* @param relay Relay to simulate
|
||||
*/
|
||||
explicit RelaySim(const Relay& relay) : m_index{relay.GetChannel()} {}
|
||||
|
||||
/**
|
||||
* Constructs from a relay channel number.
|
||||
*
|
||||
* @param channel Channel number
|
||||
*/
|
||||
explicit RelaySim(int channel) : m_index{channel} {}
|
||||
|
||||
std::unique_ptr<CallbackStore> RegisterInitializedForwardCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
|
||||
Reference in New Issue
Block a user