[wpilib] Document simulation APIs (#3079)

- Remove sim checkstyle suppression
- Add [[nodiscard]] to C++ register callback functions
- Add a couple of missing sim functions

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Starlight220 <yotamshlomi@gmail.com>
This commit is contained in:
Peter Johnson
2021-01-11 21:55:45 -08:00
committed by GitHub
parent 26584ff145
commit 9c3b51ca0f
64 changed files with 4516 additions and 199 deletions

View File

@@ -33,34 +33,107 @@ class RelaySim {
*/
explicit RelaySim(int channel);
std::unique_ptr<CallbackStore> RegisterInitializedForwardCallback(
NotifyCallback callback, bool initialNotify);
/**
* Register a callback to be run when the forward direction is initialized.
*
* @param callback the callback
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterInitializedForwardCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check whether the forward direction has been initialized.
*
* @return true if initialized
*/
bool GetInitializedForward() const;
/**
* Define whether the forward direction has been initialized.
*
* @param initializedForward whether this object is initialized
*/
void SetInitializedForward(bool initializedForward);
std::unique_ptr<CallbackStore> RegisterInitializedReverseCallback(
NotifyCallback callback, bool initialNotify);
/**
* Register a callback to be run when the reverse direction is initialized.
*
* @param callback the callback
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterInitializedReverseCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check whether the reverse direction has been initialized.
*
* @return true if initialized
*/
bool GetInitializedReverse() const;
/**
* Define whether the reverse direction has been initialized.
*
* @param initializedReverse whether this object is initialized
*/
void SetInitializedReverse(bool initializedReverse);
std::unique_ptr<CallbackStore> RegisterForwardCallback(
/**
* Register a callback to be run when the forward direction changes state.
*
* @param callback the callback
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterForwardCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether the forward direction is active.
*
* @return true if active
*/
bool GetForward() const;
/**
* Set whether the forward direction is active.
*
* @param forward true to make active
*/
void SetForward(bool forward);
std::unique_ptr<CallbackStore> RegisterReverseCallback(
/**
* Register a callback to be run when the reverse direction changes state.
*
* @param callback the callback
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterReverseCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether the reverse direction is active.
*
* @return true if active
*/
bool GetReverse() const;
/**
* Set whether the reverse direction is active.
*
* @param reverse true to make active
*/
void SetReverse(bool reverse);
/**
* Reset all simulation data.
*/
void ResetData();
private: