mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Allow composing two triggers directly (#4580)
For backwards compatibility reasons.
This commit is contained in:
@@ -487,6 +487,15 @@ class Trigger {
|
||||
return m_event.operator&&(rhs).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Composes two triggers with logical AND.
|
||||
*
|
||||
* @return A trigger which is active when both component triggers are active.
|
||||
*/
|
||||
Trigger operator&&(Trigger& rhs) {
|
||||
return (m_event && rhs.m_event).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Composes two triggers with logical OR.
|
||||
*
|
||||
@@ -496,6 +505,15 @@ class Trigger {
|
||||
return m_event.operator||(rhs).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Composes two triggers with logical OR.
|
||||
*
|
||||
* @return A trigger which is active when either component trigger is active.
|
||||
*/
|
||||
Trigger operator||(Trigger& rhs) {
|
||||
return (m_event || rhs.m_event).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Composes a trigger with logical NOT.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user