Package ptolemy.actor

Class PublisherPort

  • All Implemented Interfaces:
    java.lang.Cloneable, Initializable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, HierarchyListener, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    ConstantPublisherPort

    public class PublisherPort
    extends PubSubPort
    This is a specialized output port that publishes data sent through it on the specified named channel. The tokens are "tunneled" to any instance of SubscriberPort that names the same channel. If PubSubPort.global is false (the default), then this publisher will only send to instances of SubscriberPort 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 PubSubPort.global is true, then the subscriber may be anywhere in the model, as long as its global parameter is also true.

    It is an error to have two instances of PublisherPort using the same channel under the control of the same director. When you create a new PublisherPort, by default, it has no channel name. You have to specify a channel name to use it.

    How it works: When the channel name is specified, typically during model construction, this actor causes a relation to be created in the least opaque composite actor above it in the hierarchy and links to that relation. In addition, if PubSubPort.global is set to true, it causes a port to be created in that composite, and also links that port to the relation on the inside. The relation is recorded by the opaque composite. When a SubscriberPort is preinitialized that refers to the same channel, that SubscriberPort finds the relation (by finding the least opaque composite actor above it) and links to the relation. Some of these links are "liberal links" in that they cross levels of the hierarchy.

    Since publishers are linked to subscribers, 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 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (eal)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • propagateNameChanges

        public Parameter propagateNameChanges
        If true, then propagate channel name changes to any Subscribers. The default value is a BooleanToken with the value false, indicating that if the channel name is changed, then the channel names of the Subscribers are not changed. If the value is true, then if the channel name is changed, the channel names of the connected Subscribers are updated.

        If the value is true, then SubscriptionAggregators that have the same regular expression as the channel name of the Publisher will be updated. However, SubscriptionAggregators usually have regular expressions as channel names, so usually the channel name of the SubscriptionAggregator will not be updated.

        Note that if a Publisher is within an Actor Oriented Class definition, then any Subscribers with the same channel name in Actor Oriented Class definitions will not be updated. This is because there is no connection between the Publisher in the Actor Oriented Class definition and the Subscriber. However, if the channel name in a Publisher in an instance of an Actor Oriented Class is updated, then the corresponding Subscribers in instances of Actor Oriented Class will be updated.

    • Constructor Detail