|
RIT VEXU Core API
|
#include <initializer.h>
Public Member Functions | |
| Initializer (std::function< void()> initialize) | |
| Initializer (std::vector< Initialization > initializations, std::function< Selector::selector_t > selector, std::function< void()> pre_init=nullptr, std::function< void()> post_init=nullptr) | |
| void | initialize () |
| const std::vector< Initialization > & | initializations () const |
| const std::size_t | initialization_count () const |
| const std::string | selected_name () const |
| unsigned int | selected_meta () const |
| unsigned int | selected_index () const |
| bool | uninitialized () const |
Initializer is a utility that allows one program to call different robot initializations depending on a selection function, effectively reducing the amount of program slots that need to be redownloaded when making modifications to the entire code.
| Initializer::Initializer | ( | std::function< void()> | initialize | ) |
Shorthand for constructing an Initializer that bypasses selection and simply calls the provided callback function during initialization. Ideally, this constructor will never be used, but is included to allow quick, simple changes to programs without forcing extra changes or unnecessary syntax.
| initialize | The callback function used to initialize the robot |
| Initializer::Initializer | ( | std::vector< Initialization > | initializations, |
| std::function< Selector::selector_t > | selector, | ||
| std::function< void()> | pre_init = nullptr, | ||
| std::function< void()> | post_init = nullptr ) |
The primary constructor for Initializer
| initializations | A vector of Initializations |
| selector | A function used to select the Initialization. If a nullptr is passed for this, the initialize() function will call the first Initialization. |
| pre_init | A function for common code that runs before the selection-dependent initialization. This should only be used to setup anything needed by the initializer selector function. |
| post_init | A function for common code that runs after the selection-dependent initialization |
The constructor for Initializer
| initializations | A vector of Initializations |
| selector | A function used to select the Initialization. If a nullptr is passed for this, the initialize() function will call the first Initialization. |
| pre_init | A function for common code that runs before the selection-dependent initialization. This should only be used to setup anything needed by the initializer selector function. |
| post_init | A function for common code that runs after the selection-dependent initialization |
| const std::size_t Initializer::initialization_count | ( | ) | const |
Returns the number of Initializations that can be selected
| const std::vector< Initialization > & Initializer::initializations | ( | ) | const |
Returns the vector storing the Initializations
| void Initializer::initialize | ( | ) |
Initializes the robot
| unsigned int Initializer::selected_index | ( | ) | const |
Returns the index of the selected Initialization
Returns the index of the selected Initialization
| unsigned int Initializer::selected_meta | ( | ) | const |
Returns the meta of the selected Initialization
Returns the meta of the selected Initialization
| const std::string Initializer::selected_name | ( | ) | const |
Returns the name of the selected Initialization
| bool Initializer::uninitialized | ( | ) | const |
Returns whether or not the robot is currently uninitialized