Other operator parameters

Both composite and primitive operators can be customized by parameters such as the name of an attribute in an input port, or an expression to be used to filter data.

The following example illustrates this fact for a composite operator Mogrifier:

composite Mogrifier(output Out; input In) {
  param attribute  $attr;
        expression $expr;
  graph stream<In> Out = Functor(In) {
         param  filter: $attr < $expr;
         output Out   : $attr = $attr + 1;
        }
 }
composite Main {
  graph stream<int32 i, int32 j> A = Beacon() {}
        stream<int32 i, int32 j> B = Mogrifier(A) {
         param attr: i;
               expr: 2 * j;
  }
}15

Binding the actual attribute i to placeholder $attr and the actual expression 2*j to placeholder $expr yields the following expansion:

composite Main {
  graph
    stream<int32 i, int32 j> A = Beacon() {}
    stream<int32 i, int32 j> B = Functor(A) {
      param  filter: i < 2 * j;
      output B     : i = i + 1;
    }
}