getPorts method
- [Iterable<
TagType> ? tags]
Returns all interface ports associated with the provided tags
as a
Map from the port name to the Logic
port.
Returns all ports if tags
is null.
Implementation
Map<String, Logic> getPorts([Iterable<TagType>? tags]) {
if (tags == null) {
return ports;
} else {
final matchingPorts = <String, Logic>{};
for (final tag in tags.toSet().toList()) {
matchingPorts.addEntries(_ports.keys
.where(
(portName) => _portToTagMap[portName]?.contains(tag) ?? false)
.map((matchingPortName) =>
MapEntry(matchingPortName, _ports[matchingPortName]!)));
}
return matchingPorts;
}
}