Class Subscriber

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    SubscriptionAggregator

    public class Subscriber
    extends TypedAtomicActor
    This actor subscribes to tokens on a named channel. The tokens are "tunneled" from an instance of Publisher that names the same channel. If global is false (the default), then this subscriber will only see instances of Publisher that are under the control of the same director. That is, it can be at a different level of the hierarchy, or in an entirely different composite actor, as long as the relevant composite actors are transparent (have no director). If global is true, then the publisher may be anywhere in the model, as long as its global parameter is also true.

    Any number of instances of Subscriber can subscribe to the same channel.

    This actor actually has a hidden input port that is connected to the publisher via hidden "liberal links" (links that are allowed to cross levels of the hierarchy). Consequently, any data dependencies that the director might assume on a regular "wired" connection will also be assumed across Publisher-Subscriber pairs. Similarly, type constraints will propagate across Publisher-Subscriber pairs. That is, the type of the Subscriber output will match the type of the Publisher input.

    Since:
    Ptolemy II 5.2
    Version:
    $Id$
    Author:
    Edward A. Lee, Raymond A. Cardillo, Bert Rodiers
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Green (cxh)
    • Field Detail

      • channel

        public StringParameter channel
        The name of the channel. Subscribers that reference this same channel will receive any transmissions to this port. This is a string that defaults to "channel1".
      • global

        public Parameter global
        Specification of whether the data is subscribed globally. If this is set to true, then this subscriber will see values published by a publisher anywhere in the model references the same channel by name. If this is set to false (the default), then only values published by the publisher that are fired by the same director are seen by this subscriber.
      • input

        public SubscriberPort input
        The input port. This port is hidden and should not be directly used. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output.
      • output

        public TypedIOPort output
        The output port. This is a multiport. If the corresponding publisher has multiple input signals, then those multiple signals will appear on this output port. By default, the type of this output is constrained to be at least that of the input. This port is hidden by default and the actor handles creating connections to it.