[wpilib] Add protected default constructor for CallbackStore (#6667)

This  is to allow 3rd party sim providers (eg vendors) to subclass this class so that the register methods of their sim classes can return CallbackStores like the builtin sims.

Although it was already possible to create such a subclass but passing dummy parameters to one of the other constructors, this eliminates the need to pass such dummy parameters and makes it clearer that subclassing is allowed.
This commit is contained in:
Dean Brettle
2024-05-27 21:19:12 -07:00
committed by GitHub
parent 0ad4cd69d0
commit 9782abbcb1

View File

@@ -21,6 +21,20 @@ public class CallbackStore implements AutoCloseable {
void cancel(int uid);
}
/**
* Constructs an empty CallbackStore. This constructor is to allow 3rd party sim providers (eg
* vendors) to subclass this class (without needing provide dummy constructing parameters) so that
* the register methods of their sim classes can return CallbackStores like the builtin sims.
* <b>Note: It should not be called by teams that are just using sims!</b>
*/
protected CallbackStore() {
this.m_cancelType = -1;
this.m_index = -1;
this.m_uid = -1;
this.m_cancelCallback = null;
this.m_cancelCallbackChannel = null;
}
/**
* <b>Note: This constructor is for simulation classes only. It should not be called by teams!</b>
*