mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Fix C++ SendableRegistry::AddChild() (#2207)
Add a Sendable* overload so pointers to sendable objects work appropriately. Otherwise an AddLW(this) in a child (which is a Sendable*) could be a different pointer than a void* to the same object. For example: AnalogInput constructor calls AddLW(this) AnalogPotentiometer constructor calls AddChild(analog input pointer) Also add handling for the child object moving (if it's Sendable).
This commit is contained in:
@@ -118,6 +118,15 @@ class SendableRegistry {
|
||||
void AddLW(Sendable* sendable, const wpi::Twine& subsystem,
|
||||
const wpi::Twine& name);
|
||||
|
||||
/**
|
||||
* Adds a child object to an object. Adds the child object to the registry
|
||||
* if it's not already present.
|
||||
*
|
||||
* @param parent parent object
|
||||
* @param child child object
|
||||
*/
|
||||
void AddChild(Sendable* parent, Sendable* child);
|
||||
|
||||
/**
|
||||
* Adds a child object to an object. Adds the child object to the registry
|
||||
* if it's not already present.
|
||||
|
||||
Reference in New Issue
Block a user