addSubInterface<PairInterfaceType extends PairInterface> method
Registers a new subInterface
on this PairInterface, enabling a simple
way to build hierarchical interface definitions.
If reverse
is set, then this subInterface
will be connected in the
opposite way as it usually is with respect to the PairRole specified.
Sub-interfaces are connected via connectIO based on the name
.
Implementation
@protected
PairInterfaceType addSubInterface<PairInterfaceType extends PairInterface>(
String name,
PairInterfaceType subInterface, {
bool reverse = false,
}) {
if (_subInterfaces.containsKey(name)) {
throw InterfaceNameException(
name,
'Sub-interface name is not unique.'
' There is already a sub-interface with that name');
}
if (!Sanitizer.isSanitary(name)) {
throw InterfaceNameException(name, 'Sub-interface name is not sanitary.');
}
_subInterfaces[name] = _SubPairInterface(subInterface, reverse: reverse);
return subInterface;
}