CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
ctre::phoenix6::AlertableCollection Class Reference

Collection of objects that can report alerts. More...

#include <ctre/phoenix6/Alertable.hpp>

Public Member Functions

 AlertableCollection (std::string group)
 Constructs a new collection of alertable objects.
 AlertableCollection (AlertableCollection &&)=default
AlertableCollectionoperator= (AlertableCollection &&)=default
void Report () const
 Reports all alerts in this collection.
AlertableCollectionWithAlertable (PhoenixAlertable &alertable) &
 Adds a PhoenixAlertable to this collection.
AlertableCollection && WithAlertable (PhoenixAlertable &alertable) &&
 Adds a PhoenixAlertable to this collection.
template<std::invocable< AlertableCollection & > F>
AlertableCollectionWithAlertable (F const &alertable) &
 Adds an alertable to this collection.
template<std::invocable< AlertableCollection & > F>
AlertableCollection && WithAlertable (F const &alertable) &&
 Adds an alertable to this collection.
template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<AlertInfo>>
AlertableCollectionWithAlert (std::string id, PhoenixAlert::Level level, F &&infoGetter, std::string const &text="", wpi::units::second_t debounce=-1_s) &
 Adds a PhoenixAlert to this collection.
template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<AlertInfo>>
AlertableCollection && WithAlert (std::string id, PhoenixAlert::Level level, F &&infoGetter, std::string const &text="", wpi::units::second_t debounce=-1_s) &&
 Adds a PhoenixAlert to this collection.
template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<MultiAlertInfo>>
AlertableCollectionWithMultiAlert (std::string id, uint32_t levelFlags, F &&infoGetter, std::string const &text="", wpi::units::second_t debounce=-1_s) &
 Adds a PhoenixMultiAlert to this collection.
template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<MultiAlertInfo>>
AlertableCollection && WithMultiAlert (std::string id, uint32_t levelFlags, F &&infoGetter, std::string const &text="", wpi::units::second_t debounce=-1_s) &&
 Adds a PhoenixMultiAlert to this collection.
template<std::invocable F>
AlertableCollectionWithBeforeAlerts (F &&func) &
 Adds a function to run before updating any alerts.
template<std::invocable F>
AlertableCollection && WithBeforeAlerts (F &&func) &&
 Adds a function to run before updating any alerts.

Detailed Description

Collection of objects that can report alerts.

This collection must outlive any PhoenixAlertable objects and lambda captures registered to the collection.

Constructor & Destructor Documentation

◆ AlertableCollection() [1/2]

ctre::phoenix6::AlertableCollection::AlertableCollection ( std::string group)
inline

Constructs a new collection of alertable objects.

Parameters
groupAlert group identifier

◆ AlertableCollection() [2/2]

ctre::phoenix6::AlertableCollection::AlertableCollection ( AlertableCollection && )
default

Member Function Documentation

◆ operator=()

AlertableCollection & ctre::phoenix6::AlertableCollection::operator= ( AlertableCollection && )
default

◆ Report()

void ctre::phoenix6::AlertableCollection::Report ( ) const
inline

Reports all alerts in this collection.

◆ WithAlert() [1/2]

template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<AlertInfo>>
AlertableCollection & ctre::phoenix6::AlertableCollection::WithAlert ( std::string id,
PhoenixAlert::Level level,
F && infoGetter,
std::string const & text = "",
wpi::units::second_t debounce = -1_s ) &
inline

Adds a PhoenixAlert to this collection.

Template Parameters
FType of the function returning live information to report in the alert
Parameters
idAlert identifier, unique within the group
levelAlert urgency level
infoGetterFunction returning the AlertInfo to report
textDefault alert text to display when the alert is active
debounceDebounce time of the alert, or negative to use the default debounce time (1 second)
Returns
This collection

◆ WithAlert() [2/2]

template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<AlertInfo>>
AlertableCollection && ctre::phoenix6::AlertableCollection::WithAlert ( std::string id,
PhoenixAlert::Level level,
F && infoGetter,
std::string const & text = "",
wpi::units::second_t debounce = -1_s ) &&
inline

Adds a PhoenixAlert to this collection.

Template Parameters
FType of the function returning live information to report in the alert
Parameters
idAlert identifier, unique within the group
levelAlert urgency level
infoGetterFunction returning the AlertInfo to report
textDefault alert text to display when the alert is active
debounceDebounce time of the alert, or negative to use the default debounce time (1 second)
Returns
This collection

◆ WithAlertable() [1/4]

template<std::invocable< AlertableCollection & > F>
AlertableCollection & ctre::phoenix6::AlertableCollection::WithAlertable ( F const & alertable) &
inline

Adds an alertable to this collection.

Template Parameters
FType of the function registering the alerts
Parameters
alertableFunction that registers the alerts
Returns
This collection

◆ WithAlertable() [2/4]

template<std::invocable< AlertableCollection & > F>
AlertableCollection && ctre::phoenix6::AlertableCollection::WithAlertable ( F const & alertable) &&
inline

Adds an alertable to this collection.

Template Parameters
FType of the function registering the alerts
Parameters
alertableFunction that registers the alerts
Returns
This collection

◆ WithAlertable() [3/4]

AlertableCollection & ctre::phoenix6::AlertableCollection::WithAlertable ( PhoenixAlertable & alertable) &
inline

Adds a PhoenixAlertable to this collection.

Parameters
alertablePhoenixAlertable to register
Returns
This collection

◆ WithAlertable() [4/4]

AlertableCollection && ctre::phoenix6::AlertableCollection::WithAlertable ( PhoenixAlertable & alertable) &&
inline

Adds a PhoenixAlertable to this collection.

Parameters
alertablePhoenixAlertable to register
Returns
This collection

◆ WithBeforeAlerts() [1/2]

template<std::invocable F>
AlertableCollection & ctre::phoenix6::AlertableCollection::WithBeforeAlerts ( F && func) &
inline

Adds a function to run before updating any alerts.

This can be used to perform actions such as a bulk signal refresh so individual alerts do not have to perform refreshes.

Template Parameters
FType of the function to register
Parameters
funcFunction to run before any alerts
Returns
This collection

◆ WithBeforeAlerts() [2/2]

template<std::invocable F>
AlertableCollection && ctre::phoenix6::AlertableCollection::WithBeforeAlerts ( F && func) &&
inline

Adds a function to run before updating any alerts.

This can be used to perform actions such as a bulk signal refresh so individual alerts do not have to perform refreshes.

Template Parameters
FType of the function to register
Parameters
funcFunction to run before any alerts
Returns
This collection

◆ WithMultiAlert() [1/2]

template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<MultiAlertInfo>>
AlertableCollection & ctre::phoenix6::AlertableCollection::WithMultiAlert ( std::string id,
uint32_t levelFlags,
F && infoGetter,
std::string const & text = "",
wpi::units::second_t debounce = -1_s ) &
inline

Adds a PhoenixMultiAlert to this collection.

Template Parameters
FType of the function returning live information to report in the alert
Parameters
idAlert identifier, unique within the group
levelFlagsAlert urgency levels to include
infoGetterFunction returning the MultiAlertInfo to report
textDefault alert text to display when the alert is active
debounceDebounce time of the alert, or negative to use the default debounce time (1 second)
Returns
This collection

◆ WithMultiAlert() [2/2]

template<std::invocable F>
requires std::convertible_to<std::invoke_result_t<F>, std::optional<MultiAlertInfo>>
AlertableCollection && ctre::phoenix6::AlertableCollection::WithMultiAlert ( std::string id,
uint32_t levelFlags,
F && infoGetter,
std::string const & text = "",
wpi::units::second_t debounce = -1_s ) &&
inline

Adds a PhoenixMultiAlert to this collection.

Template Parameters
FType of the function returning live information to report in the alert
Parameters
idAlert identifier, unique within the group
levelFlagsAlert urgency levels to include
infoGetterFunction returning the MultiAlertInfo to report
textDefault alert text to display when the alert is active
debounceDebounce time of the alert, or negative to use the default debounce time (1 second)
Returns
This collection

The documentation for this class was generated from the following file: