punchUpTo method
Creates a copy of this interface in a parent module.
This "punches up" the interface from this module
to newModule
, which
should be a parent of this module. The new interface will have the same
role and be automatically connected to this interface.
Parameters:
newIntfName
: Optional new name for the interface (defaults to current name)allowNameUniquification
: Whether to allow automatic name uniquificationexceptPorts
: Set of port names to exclude from the new interfaceportUniquify
: Function to generate unique port names
If exceptPorts
is provided, the resulting interface will exclude those
ports. Otherwise, the new interface will be of the same type as this one.
Implementation
InterfaceReference punchUpTo(
BridgeModule newModule, {
String? newIntfName,
bool allowNameUniquification = false,
Set<String>? exceptPorts,
String Function(String logical)? portUniquify,
}) {
// TODO(mkorbel1): remove restriction that it must be adjacent (https://github.com/intel/rohd-bridge/issues/13)
if (module.parent != newModule) {
throw RohdBridgeException(
'The newModule must be the direct parent of this module.');
}
_connectAllPortMaps(exceptPorts: exceptPorts);
final newRef = newModule.addInterface(
_clonePairInterface(interface, exceptPorts: exceptPorts),
name: newIntfName ?? name,
role: role,
allowNameUniquification: allowNameUniquification,
portUniquify: portUniquify,
);
connectUpTo(newRef);
return newRef;
}