SubZero Common
Common library components for an FRC CommandRobot
Loading...
Searching...
No Matches
subzero::TaggedChooser< TKey > Class Template Reference

Each key of type T has a vector<string> of tags; accepts a list of groups that each have a name and list of possible tags that are mutually exclusive. The ANY option is automatically included in all group selectors to indicate the lack of a selection. When a selection is made, the intersection of all selections is created based on T's list of tags. More...

#include <TaggedChooser.h>

Public Types

using TaggedChooserValue = std::pair<TKey, std::string>
 A pair composed of the key and its name.
 
using TaggedChooserEntry
 A pair composed of TaggedChooserValue and a set of associated tags.
 
using TaggedChooserSelectorGroup
 Describes a single group which has a name and a set of available tags from which to choose.
 

Public Member Functions

 TaggedChooser (const std::vector< TaggedChooserEntry > &entries, const std::vector< TaggedChooserSelectorGroup > &groups, std::string chooserName)
 Construct a new TaggedChooser.
 
void Initialize (void)
 Call this one on startup to populate and push to SmartDashboard.
 
void SetOnChangeCallback (std::function< void(TKey)> cb)
 Register a callback that gets executed each time the selected option changes.
 
std::vector< TaggedChooserValueGetAvailableEntries (void)
 Get the list of all available entries in the selector.
 
void PopulateChooser (void)
 Repopulate the chooser based on the selected group filters.
 
TKey GetSelectedValue ()
 Get the currently-selected option.
 

Detailed Description

template<typename TKey>
class subzero::TaggedChooser< TKey >

Each key of type T has a vector<string> of tags; accepts a list of groups that each have a name and list of possible tags that are mutually exclusive. The ANY option is automatically included in all group selectors to indicate the lack of a selection. When a selection is made, the intersection of all selections is created based on T's list of tags.

Template Parameters
TKey

Definition at line 27 of file TaggedChooser.h.

Member Typedef Documentation

◆ TaggedChooserEntry

template<typename TKey >
using subzero::TaggedChooser< TKey >::TaggedChooserEntry
Initial value:
std::pair<TaggedChooserValue, std::set<std::string>>

A pair composed of TaggedChooserValue and a set of associated tags.

Definition at line 38 of file TaggedChooser.h.

◆ TaggedChooserSelectorGroup

template<typename TKey >
using subzero::TaggedChooser< TKey >::TaggedChooserSelectorGroup
Initial value:
std::pair<std::string, std::set<std::string>>

Describes a single group which has a name and a set of available tags from which to choose.

Definition at line 45 of file TaggedChooser.h.

◆ TaggedChooserValue

template<typename TKey >
using subzero::TaggedChooser< TKey >::TaggedChooserValue = std::pair<TKey, std::string>

A pair composed of the key and its name.

Definition at line 33 of file TaggedChooser.h.

Constructor & Destructor Documentation

◆ TaggedChooser()

template<typename TKey >
subzero::TaggedChooser< TKey >::TaggedChooser ( const std::vector< TaggedChooserEntry > & entries,
const std::vector< TaggedChooserSelectorGroup > & groups,
std::string chooserName )

Construct a new TaggedChooser.

Parameters
entriesList of filterable entries
groupsList of group selectors
chooserNameName of the TaggedChooser in SmartDashboard

Member Function Documentation

◆ GetAvailableEntries()

template<typename TKey >
std::vector< TaggedChooserValue > subzero::TaggedChooser< TKey >::GetAvailableEntries ( void )

Get the list of all available entries in the selector.

Returns
std::vector<TaggedChooserValue> List of entries

◆ GetSelectedValue()

template<typename TKey >
TKey subzero::TaggedChooser< TKey >::GetSelectedValue ( )
inline

Get the currently-selected option.

Returns
TKey

Definition at line 91 of file TaggedChooser.h.

◆ Initialize()

template<typename TKey >
void subzero::TaggedChooser< TKey >::Initialize ( void )

Call this one on startup to populate and push to SmartDashboard.

◆ PopulateChooser()

template<typename TKey >
void subzero::TaggedChooser< TKey >::PopulateChooser ( void )

Repopulate the chooser based on the selected group filters.

◆ SetOnChangeCallback()

template<typename TKey >
void subzero::TaggedChooser< TKey >::SetOnChangeCallback ( std::function< void(TKey)> cb)

Register a callback that gets executed each time the selected option changes.

Parameters
cb

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