A ComplementedPort P is a Port s.t. whenever it is BinaryOperable with another Port P2, P2 is a particular type - either P's complement type, or a KeyedPort that delegates to P's complement type in a binary operation with P.

ComplementedPorts are useful in situations where Port types are BinaryOperable in a one-to-one fashion (a pair of Port types are each other's port complements), or in a one-to-many fashion (a number of Port types have the same complement port). An example of the latter is Dataflow.Signals, where any signal of signature T has a complement port of type function<T>, and can therefore model ComplementedPort, but function<T> cannot because there are many signal types to which it can be connected.

The traits of a ComplementedPort are captured by the ComplementedPortTraits, which refines the PortTraits with an additional member type specifying the complement port type.

ComplementedPort Refines
ComplementedPortTraits Refines
Notation

The following expressions are used in this document:

T

A Tag type. If omitted, T defaults to default_tag.

P

A ComplementedPort type, for Tag T.

PT

ComplementedPortTraits of P for T.

ComplementedPort Requirements

Name

Expression

Result Type

Semantics

Port Traits

traits_of<P, T>::type

PT

The ComplementedPortTraits of the port.

ComplementedPortTraits Requirements

Name

Expression

Result Type

Semantics

Complement Port Type

PT::complement_port_type

Any Port type

The complement port type of P. If P is BinaryOperable with another port type P2, then P2 must be either PT::complement_port_type, , or a KeyedPort that delegates to PT::complement_port_type in a binary operation with P.

Models