connectIO method
- Module module,
- Interface srcInterface, {
- Iterable<
PairDirection> ? inputTags, - Iterable<
PairDirection> ? outputTags, - Iterable<
PairDirection> ? inOutTags, - String uniquify(
- String original
inherited
Calls Interface.connectIO for ports of this interface as well as hierarchically for all subInterfaces.
Implementation
@override
void connectIO(
Module module,
Interface<dynamic> srcInterface, {
Iterable<PairDirection>? inputTags,
Iterable<PairDirection>? outputTags,
Iterable<PairDirection>? inOutTags,
String Function(String original)? uniquify,
}) {
final selectedInputs = inputTags?.toSet();
final selectedOutputs = outputTags?.toSet();
final selectedInOuts = inOutTags?.toSet();
final inputs = selectedInputs == null
? <String>{}
: getPorts(selectedInputs).keys.toSet();
final outputs = selectedOutputs == null
? <String>{}
: getPorts(selectedOutputs).keys.toSet();
final inOuts = selectedInOuts == null
? <String>{}
: getPorts(selectedInOuts).keys.toSet();
for (final payload in _payloads) {
if (inOuts.contains(payload.name) &&
(inputs.contains(payload.name) || outputs.contains(payload.name))) {
throw PortTypeException.forIntendedName(payload.name,
'Cache payload cannot be both directional and an inOut port.');
}
}
final handled = <String>{};
for (final payload in _payloads) {
final isInput = inputs.contains(payload.name);
final isOutput = outputs.contains(payload.name);
if (!isInput && !isOutput) {
continue;
}
final source = srcInterface.port(payload.name);
if (!rohdPayloadsCompatible([payload, source])) {
throw PortTypeException.forIntendedName(
payload.name, 'Cache payload shape does not match.');
}
final name = uniquify?.call(payload.name) ?? payload.name;
connectTypedPayloadPorts<T>(module,
name: name,
local: payload,
source: source,
input: isInput,
output: isOutput);
handled.add(payload.name);
}
_handledPayloads = handled;
try {
super.connectIO(module, srcInterface,
inputTags: selectedInputs,
outputTags: selectedOutputs,
inOutTags: selectedInOuts,
uniquify: uniquify);
} finally {
_handledPayloads = {};
}
}