addStructuredPairInterface<InterfaceType extends PairInterface> method

  1. @experimental
InterfaceType addStructuredPairInterface<InterfaceType extends PairInterface>(
  1. InterfaceType source,
  2. PairRole role, {
  3. String uniquify(
    1. String original
    )?,
  4. String? name,
})
inherited

Registers source for role and returns its internal clone.

Input and output directions become grouped typed LogicStructure ports, except that a single field remains a direct port. InOut fields remain individual ports.

name prefixes the generated directional port names. When omitted, the prefix is derived from uniquify or the interface's runtime type.

Implementation

@experimental
InterfaceType addStructuredPairInterface<InterfaceType extends PairInterface>(
  InterfaceType source,
  PairRole role, {
  String Function(String original)? uniquify,
  String? name,
}) {
  final target = source.clone() as InterfaceType;
  final registrations = target.pairConnectIOAsStructuredPorts(
    this,
    source,
    role,
    uniquify: uniquify,
    name: name,
  );
  _structuredInterfacePortBindings.addAll(
    registrations.map(
      (registration) => StructuredInterfacePortBinding(
        sourceInterface: registration.sourceInterface,
        internalInterface: registration.internalInterface,
        inputPort: registration.inputPort,
        outputPort: registration.outputPort,
      ),
    ),
  );
  return target;
}