[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,69 +33,237 @@ class AnalogInputSim {
*/
explicit AnalogInputSim(int channel);
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
/**
* Register a callback on whether the analog input is initialized.
*
* @param callback the callback that will be called whenever the analog input
* is initialized
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check if this analog input has been initialized.
*
* @return true if initialized
*/
bool GetInitialized() const;
/**
* Change whether this analog input has been initialized.
*
* @param initialized the new value
*/
void SetInitialized(bool initialized);
std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
/**
* Register a callback on the number of average bits.
*
* @param callback the callback that will be called whenever the number of
* average bits is changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the number of average bits.
*
* @return the number of average bits
*/
int GetAverageBits() const;
/**
* Change the number of average bits.
*
* @param averageBits the new value
*/
void SetAverageBits(int averageBits);
std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
/**
* Register a callback on the amount of oversampling bits.
*
* @param callback the callback that will be called whenever the oversampling
* bits are changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the amount of oversampling bits.
*
* @return the amount of oversampling bits
*/
int GetOversampleBits() const;
/**
* Change the amount of oversampling bits.
*
* @param oversampleBits the new value
*/
void SetOversampleBits(int oversampleBits);
std::unique_ptr<CallbackStore> RegisterVoltageCallback(
/**
* Register a callback on the voltage.
*
* @param callback the callback that will be called whenever the voltage is
* changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterVoltageCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the voltage.
*
* @return the voltage
*/
double GetVoltage() const;
/**
* Change the voltage.
*
* @param voltage the new value
*/
void SetVoltage(double voltage);
std::unique_ptr<CallbackStore> RegisterAccumulatorInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
* Register a callback on whether the accumulator is initialized.
*
* @param callback the callback that will be called whenever the accumulator
* is initialized
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterAccumulatorInitializedCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check if the accumulator has been initialized.
*
* @return true if initialized
*/
bool GetAccumulatorInitialized() const;
/**
* Change whether the accumulator has been initialized.
*
* @param accumulatorInitialized the new value
*/
void SetAccumulatorInitialized(bool accumulatorInitialized);
std::unique_ptr<CallbackStore> RegisterAccumulatorValueCallback(
/**
* Register a callback on the accumulator value.
*
* @param callback the callback that will be called whenever the accumulator
* value is changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAccumulatorValueCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the accumulator value.
*
* @return the accumulator value
*/
int64_t GetAccumulatorValue() const;
/**
* Change the accumulator value.
*
* @param accumulatorValue the new value
*/
void SetAccumulatorValue(int64_t accumulatorValue);
std::unique_ptr<CallbackStore> RegisterAccumulatorCountCallback(
/**
* Register a callback on the accumulator count.
*
* @param callback the callback that will be called whenever the accumulator
* count is changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAccumulatorCountCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the accumulator count.
*
* @return the accumulator count.
*/
int64_t GetAccumulatorCount() const;
/**
* Change the accumulator count.
*
* @param accumulatorCount the new count.
*/
void SetAccumulatorCount(int64_t accumulatorCount);
std::unique_ptr<CallbackStore> RegisterAccumulatorCenterCallback(
NotifyCallback callback, bool initialNotify);
/**
* Register a callback on the accumulator center.
*
* @param callback the callback that will be called whenever the accumulator
* center is changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterAccumulatorCenterCallback(NotifyCallback callback,
bool initialNotify);
/**
* Get the accumulator center.
*
* @return the accumulator center
*/
int GetAccumulatorCenter() const;
/**
* Change the accumulator center.
*
* @param accumulatorCenter the new center
*/
void SetAccumulatorCenter(int accumulatorCenter);
std::unique_ptr<CallbackStore> RegisterAccumulatorDeadbandCallback(
NotifyCallback callback, bool initialNotify);
/**
* Register a callback on the accumulator deadband.
*
* @param callback the callback that will be called whenever the accumulator
* deadband is changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterAccumulatorDeadbandCallback(NotifyCallback callback,
bool initialNotify);
/**
* Get the accumulator deadband.
*
* @return the accumulator deadband
*/
int GetAccumulatorDeadband() const;
/**
* Change the accumulator deadband.
*
* @param accumulatorDeadband the new deadband
*/
void SetAccumulatorDeadband(int accumulatorDeadband);
/**
* Reset all simulation data for this object.
*/
void ResetData();
private: