module Quartz::Coupler

Overview

This mixin provides coupled models with several components and coupling methods.

Direct including types

Defined in:

quartz/coupler.cr

Instance Method Summary

Instance Method Detail

def <<(model : Model) #

Append the given model to childrens


[View source]
def [](name : Name) : Model #

Find the component identified by the given name

Raise NoSuchChildError error if name doesn't match any child


[View source]
def []?(name : Name) : Model? #

Find the component identified by the given name


[View source]
def add_child(child) #

Alias for #<<.


[View source]
def attach(p1 : OutputPort, to p2 : InputPort) #

Adds an internal coupling (IC) to self between the two given ports.

Raises a FeedbackLoopError if p1 and p2 hosts are the same child when constructing the internal coupling. Direct feedback loops are not allowed, i.e, no output port of a component may be connected to an input port of the same component. Raises an InvalidPortHostError if no coupling can be established from given ports hosts.


[View source]
def attach(p1 : Name, *, to p2 : Name, between sender : Name, and receiver : Name, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds a coupling to self. Establish a relation between the two given ports that belongs respectively to sender and receiver.

Note: If given port names p1 and p2 doesn't exist within their host (respectively sender and receiver), they will be automatically generated.


[View source]
def attach(p1 : Name, *, to p2 : Name, between sender : Name, and receiver : Name) #

Adds a coupling to self. Establish a relation between the two given ports that belongs respectively to sender and receiver.

Note: If given port names p1 and p2 doesn't exist within their host (respectively sender and receiver), they will be automatically generated.


[View source]
def attach(p1 : Name, *, to p2 : Name, between sender : Coupleable, and receiver : Coupleable, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds a coupling to self. Establish a relation between the two given ports that belongs respectively to sender and receiver.

Note: If given port names p1 and p2 doesn't exist within their host (respectively sender and receiver), they will be automatically generated.


[View source]
def attach(p1 : Name, *, to p2 : Name, between sender : Coupleable, and receiver : Coupleable) #

Adds a coupling to self. Establish a relation between the two given ports that belongs respectively to sender and receiver.

Note: If given port names p1 and p2 doesn't exist within their host (respectively sender and receiver), they will be automatically generated.


[View source]
def attach(p1 : OutputPort, to p2 : OutputPort, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an external output coupling (EOC) to self between the two given output ports.

Raises an InvalidPortHostError if no coupling can be established from given ports hosts.


[View source]
def attach(p1 : OutputPort, to p2 : OutputPort) #

Adds an external output coupling (EOC) to self between the two given output ports.

Raises an InvalidPortHostError if no coupling can be established from given ports hosts.


[View source]
def attach(p1 : OutputPort, to p2 : InputPort, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an internal coupling (IC) to self between the two given ports.

Raises a FeedbackLoopError if p1 and p2 hosts are the same child when constructing the internal coupling. Direct feedback loops are not allowed, i.e, no output port of a component may be connected to an input port of the same component. Raises an InvalidPortHostError if no coupling can be established from given ports hosts.


[View source]
def attach(p1 : InputPort, to p2 : InputPort) #

Adds an external input coupling (EIC) to self between the two given input ports.

Raises an InvalidPortHostError if no coupling can be established from given ports hosts.


[View source]
def attach(p1 : InputPort, to p2 : InputPort, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an external input coupling (EIC) to self between the two given input ports.

Raises an InvalidPortHostError if no coupling can be established from given ports hosts.


[View source]
def attach_input(myport : Name, *, to iport : Name, of child : Coupleable) #

Adds an external input coupling (EIC) to self. Establish a relation between a self input port and a child input port.

Note: If given port names myport and iport doesn't exist within their host (respectively self and child), they will be automatically generated.


[View source]
def attach_input(myport : Name, *, to iport : Name, of child : Coupleable, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an external input coupling (EIC) to self. Establish a relation between a self input port and a child input port.

Note: If given port names myport and iport doesn't exist within their host (respectively self and child), they will be automatically generated.


[View source]
def attach_input(myport : Name, *, to iport : Name, of child : Name) #

Adds an external input coupling (EIC) to self. Establish a relation between a self input port and a child input port.

Note: If given port names myport and iport doesn't exist within their host (respectively self and child), they will be automatically generated.


[View source]
def attach_input(myport : Name, *, to iport : Name, of child : Name, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an external input coupling (EIC) to self. Establish a relation between a self input port and a child input port.

Note: If given port names myport and iport doesn't exist within their host (respectively self and child), they will be automatically generated.


[View source]
def attach_output(oport : Name, *, of child : Name, to myport : Name, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an external output coupling (EOC) to self. Establish a relation between an output port of one of self's children and one of self's output ports.

Note: If given port names oport and myport doesn't exist within their host (respectively child and self), they will be automatically generated.


[View source]
def attach_output(oport : Name, *, of child : Coupleable, to myport : Name) #

Adds an external output coupling (EOC) to self. Establish a relation between an output port of one of self's children and one of self's output ports.

Note: If given port names oport and myport doesn't exist within their host (respectively child and self), they will be automatically generated.


[View source]
def attach_output(oport : Name, *, of child : Name, to myport : Name) #

Adds an external output coupling (EOC) to self. Establish a relation between an output port of one of self's children and one of self's output ports.

Note: If given port names oport and myport doesn't exist within their host (respectively child and self), they will be automatically generated.


[View source]
def attach_output(oport : Name, *, of child : Coupleable, to myport : Name, &block : Enumerable(Any) -> Enumerable(Any)) #

Adds an external output coupling (EOC) to self. Establish a relation between an output port of one of self's children and one of self's output ports.

Note: If given port names oport and myport doesn't exist within their host (respectively child and self), they will be automatically generated.


[View source]
def children_names : Array(Name) #

Returns the children names


[View source]
def children_size #

Returns the number of children in self.


[View source]
def detach(p1 : InputPort, from p2 : InputPort) : Bool #

Deletes a external input coupling (EOC) from self.

Returns true if successful.


[View source]
def detach(p1 : OutputPort, from p2 : InputPort) : Bool #

Deletes an internal coupling (IC) from self.

Returns true if successful.


[View source]
def detach(p1 : OutputPort, from p2 : OutputPort) : Bool #

Deletes an external output coupling (EOC) from self.

Returns true if successful.


[View source]
def detach(oport : Name, *, from iport : Name, between sender : Coupleable, and receiver : Coupleable) : Bool #

Deletes a coupling from self. Returns true if successful.


[View source]
def detach(oport : Name, *, from iport : Name, between sender : Name, and receiver : Name) #

Deletes a coupling from self. Returns true if successful.


[View source]
def detach(oport : Name, *, of child : Coupleable, from myport : Name) : Bool #

Deletes an external output coupling (EOC) from self. Returns true if successful.


[View source]
def detach(oport : Name, *, of child : Name, from myport : Name) : Bool #

Deletes an external output coupling (EOC) from self. Returns true if successful.


[View source]
def each_child #

Returns an Iterator for the children of self


[View source]
def each_child(&) #

Calls given block once for each child, passing that element as a parameter.


[View source]
def each_coupling(&) #

Calls block once for each coupling (EIC, IC, EOC), passing that element as a parameter.


[View source]
def each_coupling(port : OutputPort, &) #

Calls block once for each coupling, passing that element as a parameter. Given output port is used to filter internal couplings and external output couplings (IC, EOC) having this port as a source.


[View source]
def each_coupling(port : InputPort, &) #

Calls block once for each coupling, passing that element as a parameter. Given input port is used to filter external input couplings (EIC) having this port as a source.


[View source]
def each_coupling_reverse(port : OutputPort, &) #

[View source]
def each_coupling_reverse(port : InputPort, &) #

TODO doc


[View source]
def each_input_coupling(&) #

Calls block once for each external input coupling (EIC) in #input_couplings, passing that element as a parameter.


[View source]
def each_input_coupling(port : InputPort, &) #

Calls block once for each external input coupling (EIC) in #input_couplings, passing that element as a parameter. Given port is used to filter couplings having this port as a source.

TODO check if port in input_couplings ?


[View source]
def each_input_coupling_reverse(port : InputPort, &) #

TODO doc


[View source]
def each_internal_coupling(&) #

Calls block once for each internal coupling (IC) in #internal_couplings, passing that element as a parameter.


[View source]
def each_internal_coupling(port : OutputPort, &) #

Calls block once for each internal coupling (IC) in #internal_couplings, passing that element as a parameter. Given port is used to filter couplings having this port as a source.


[View source]
def each_internal_coupling_reverse(port : InputPort, &) #

TODO doc


[View source]
def each_output_coupling(&) #

Calls block once for each external output coupling (EOC) in #output_couplings, passing that element as a parameter.


[View source]
def each_output_coupling(port : OutputPort, &) #

Calls block once for each external output coupling (EOC) in #output_couplings, passing that element as a parameter. Given port is used to filter couplings having this port as a source.


[View source]
def each_output_coupling_reverse(port : OutputPort, &) #

TODO doc


[View source]
def find_direct_couplings(&block : OutputPort, InputPort, Array(Proc(Enumerable(Any), Enumerable(Any))) -> ) #

Finds and yields direct connections in the coupling graph of self.


[View source]
def has_child?(name : Name) : Bool #

Returns whether self has a child named like name


[View source]
def has_child?(model : Coupleable) : Bool #

Returns whether given model is a child of self


[View source]
def has_transducer_for?(src : Port, dst : Port) : Bool #

Whether the given coupling has an associated transducer.


[View source]
def input_couplings(port : InputPort) : Array(InputPort) #

Returns all external input couplings attached to the given input port.


[View source]
def internal_couplings(port : OutputPort) : Array(InputPort) #

Returns all internal couplings attached to the given output port.


[View source]
def output_couplings(port : OutputPort) : Array(OutputPort) #

Returns all external output couplings attached to the given output port.


[View source]
def remove_child(model : Model) #

Deletes the given model from childrens


[View source]
def transducer_for(src : Port, dst : Port) #

Returns the transducer associated with the given coupling.


[View source]