punchDownTo method
- BridgeModule subModule, {
- String? newIntfName,
- bool allowNameUniquification = false,
Creates a copy of this interface in a submodule.
This "punches down" the interface from this module
to subModule
,
creating a new interface with the same role and automatically connecting
it to this interface.
The newIntfName
parameter allows renaming the interface in the
submodule. If allowNameUniquification
is true, automatic name collision
resolution will be applied if needed.
This operation is intended for passing interfaces down the module hierarchy.
The subModule
must be a child of this interface's module
.
Implementation
InterfaceReference punchDownTo(BridgeModule subModule,
{String? newIntfName, bool allowNameUniquification = false}) {
// TODO(mkorbel1): remove restriction that it must be adjacent (https://github.com/intel/rohd-bridge/issues/13)
if (subModule.parent != module) {
throw RohdBridgeException(
'The subModule must be a direct child of this module.');
}
_connectAllPortMaps(exceptPorts: null);
final newRef = subModule.addInterface(
interface,
name: newIntfName ?? name,
role: role,
allowNameUniquification: allowNameUniquification,
);
connectDownTo(newRef);
return newRef;
}