Description
The AddReference method allows a device to reference another element in the system. References are the means by which devices are able to be associated with other system components. Objects of type IDevice, IExtension, IBusInterface, and IClockSource can be referenced.
Usage
virtual bool AddReference(const std::wstring& referenceName, IDevice* target); virtual bool AddReference(const std::wstring& referenceName, IExtension* target); virtual bool AddReference(const std::wstring& referenceName, IBusInterface* target); virtual bool AddReference(const std::wstring& referenceName, IClockSource* target);
Argument list
- referenceName [std::wstring]
- Name which identifies this reference to the device. Reference names are specific to the device that the reference is being added to, and supported reference names, and the purpose of each reference, should be clearly documented for each device.
- target [IDevice / IExtension / IBusInterface / IClockSource]
- The object being referenced. A pointer is passed in to this object, and it is perfectly valid, and expected, for the device to keep a reference to the target object. If the referenced object is removed from the system, the RemoveReference method will be called before the target object is destroyed. Note that RemoveReference is not guaranteed to be called for all existing references before a device which has added references to other devices is destroyed, although any remaining references are guaranteed to still be valid at the time the destructor is run.
Return value
- [bool]
- True if the reference was successfully added by the target device, false otherwise.
See also
- RemoveReference
- IDevice
- IBusInterface
- IExtension
- IClockSource