Package ptolemy.cg.lib
Class ModularCodeGenTypedCompositeActor
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity
-
- ptolemy.kernel.CompositeEntity
-
- ptolemy.actor.CompositeActor
-
- ptolemy.actor.TypedCompositeActor
-
- ptolemy.actor.LazyTypedCompositeActor
-
- ptolemy.cg.lib.ModularCodeGenLazyTypedCompositeActor
-
- ptolemy.cg.lib.ModularCodeGenTypedCompositeActor
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,ModularableComposite
,Changeable
,Configurable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,LazyComposite
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class ModularCodeGenTypedCompositeActor extends ModularCodeGenLazyTypedCompositeActor implements ModularableComposite
A TypedCompositeActor with Lazy evaluation for Modular code generation.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Bert Rodiers, Dai Bui
- Pt.AcceptedRating:
- Red (rodiers)
- Pt.ProposedRating:
- Red (rodiers)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.actor.LazyTypedCompositeActor
LazyTypedCompositeActor.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.cg.lib.ModularCodeGenLazyTypedCompositeActor
_addedSubscribersFromProfile, _creatingPubSub, _fireMethod, _generatingCode, _objectWrapper, _profile, _subscriberPorts, recompileHierarchy, recompileThisLevel
-
Fields inherited from class ptolemy.actor.LazyTypedCompositeActor
_configureDone, _populating
-
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
-
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description ModularCodeGenTypedCompositeActor()
Construct a library in the default workspace with no container and an empty string as its name.ModularCodeGenTypedCompositeActor(CompositeEntity container, java.lang.String name)
Construct a library with the given container and name.ModularCodeGenTypedCompositeActor(Workspace workspace)
Construct a library in the specified workspace with no container and an empty string as a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
_isPublishedPort(IOPort port)
Return true if the port is a is connected to a publisher.protected java.lang.String
_pubSubChannelName(IOPort port, boolean publisher, boolean subscriber)
Return the name of a Publisher or Subscriber channel name.void
attributeChanged(Attribute attribute)
React to a change in an attribute.void
fire()
If this actor is opaque, transfer any data from the input ports of this composite to the ports connected on the inside, and then invoke the fire() method of its local director.void
initialize()
Create receivers and invoke the preinitialize() method of the local director.java.util.List
portList()
Get the ports belonging to this entity.void
preinitialize()
Create receivers and invoke the preinitialize() method of the local director.void
registerPublisherPort(java.lang.String name, IOPort port)
Register a "published port" coming from a publisher.void
wrapup()
Invoke the wrapup() method of all the actors contained in the director's container.-
Methods inherited from class ptolemy.cg.lib.ModularCodeGenLazyTypedCompositeActor
_addEntity, _addRelation, _fire, _isSubscribedPort, _removeEntity, _removeRelation, _setRecompileFlag, _transferOutputs, classToActorName, convertProfilePort, newRelation
-
Methods inherited from class ptolemy.actor.LazyTypedCompositeActor
_exportMoMLContents, classDefinitionList, clone, configure, deepContains, deepEntityList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportMoML, getConfigureSource, getConfigureText, getEntity, getRelation, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyContainedObjectsIterator, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, populate, relationList, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addPort, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, resolveTypes, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, recordFiring, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
-
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepGetEntities, deepNamedObjList, exportLinks, getAttribute, getEntities, getPort, getRelations, isAtomic, lazyAllCompositeTransparentAndOpaqueEntityList, numEntities, numRelations, removeAllEntities, removeAllRelations, statistics
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, removeAllPorts
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
ModularCodeGenTypedCompositeActor
public ModularCodeGenTypedCompositeActor() throws IllegalActionException, NameDuplicationException
Construct a library in the default workspace with no container and an empty string as its name. Add the library to the workspace directory. Increment the version number of the workspace.- Throws:
IllegalActionException
- If the entity cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
ModularCodeGenTypedCompositeActor
public ModularCodeGenTypedCompositeActor(Workspace workspace) throws IllegalActionException, NameDuplicationException
Construct a library in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. Add the actor to the workspace directory. Increment the version number of the workspace.- Parameters:
workspace
- The workspace that will list the actor.- Throws:
IllegalActionException
- If the entity cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
ModularCodeGenTypedCompositeActor
public ModularCodeGenTypedCompositeActor(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct a library with the given container and name.- Parameters:
container
- The container.name
- The name of this library.- Throws:
IllegalActionException
- If the entity cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
React to a change in an attribute. This method is called by a contained attribute when its value changes. This overrides the base class so that if the attribute is an instance of TypeAttribute, then it sets the type of the port.- Overrides:
attributeChanged
in classTypedCompositeActor
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the change is not acceptable to this container.
-
portList
public java.util.List portList()
Get the ports belonging to this entity. The order is the order in which they became contained by this entity. This method is read-synchronized on the workspace.
-
fire
public void fire() throws IllegalActionException
If this actor is opaque, transfer any data from the input ports of this composite to the ports connected on the inside, and then invoke the fire() method of its local director. The transfer is accomplished by calling the transferInputs() method of the local director (the exact behavior of which depends on the domain). If the actor is not opaque, throw an exception. This method is read-synchronized on the workspace, so the fire() method of the director need not be (assuming it is only called from here). After the fire() method of the director returns, send any output data created by calling the local director's transferOutputs method.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's fire() method throws it, or if the actor is not opaque.
-
initialize
public void initialize() throws IllegalActionException
Create receivers and invoke the preinitialize() method of the local director. If this actor is not opaque, throw an exception. This method also resets the protected variable _stopRequested to false, so if a derived class overrides this method, then it should also do that. This method is read-synchronized on the workspace, so the preinitialize() method of the director need not be, assuming it is only called from here.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's preinitialize() method throws it, or if this actor is not opaque.
-
preinitialize
public void preinitialize() throws IllegalActionException
Create receivers and invoke the preinitialize() method of the local director. If this actor is not opaque, throw an exception. This method also resets the protected variable _stopRequested to false, so if a derived class overrides this method, then it should also do that. This method is read-synchronized on the workspace, so the preinitialize() method of the director need not be, assuming it is only called from here.- Specified by:
preinitialize
in interfaceInitializable
- Overrides:
preinitialize
in classCompositeActor
- Throws:
IllegalActionException
- If there is no director, or if the director's preinitialize() method throws it, or if this actor is not opaque.
-
registerPublisherPort
public void registerPublisherPort(java.lang.String name, IOPort port) throws NameDuplicationException, IllegalActionException
Register a "published port" coming from a publisher. The name is the name being used in the matching process to match publisher and subscriber. A subscriber interested in the output of this publisher uses the same name. This registration process of publisher typically happens before the model is preinitialized, for example when opening the model. The subscribers will look for publishers during the preinitialization phase.- Overrides:
registerPublisherPort
in classCompositeActor
- Parameters:
name
- The name is being used in the matching process to match publisher and subscriber.port
- The published port.- Throws:
NameDuplicationException
- If the published port is already registered.IllegalActionException
- If the published port can't be added.
-
wrapup
public void wrapup() throws IllegalActionException
Invoke the wrapup() method of all the actors contained in the director's container. In this base class wrapup() is called on the associated actors in the order of their creation. If the container is not an instance of CompositeActor, then this method does nothing.This method should be invoked once per execution. None of the other action methods should be invoked after it in the execution. This method is not synchronized on the workspace, so the caller should be.
- Specified by:
wrapup
in interfaceInitializable
- Overrides:
wrapup
in classCompositeActor
- Throws:
IllegalActionException
- If the wrapup() method of one of the associated actors throws it.
-
_isPublishedPort
protected boolean _isPublishedPort(IOPort port)
Return true if the port is a is connected to a publisher.- Specified by:
_isPublishedPort
in classModularCodeGenLazyTypedCompositeActor
- Parameters:
port
- The port to look up.- Returns:
- Return true if the port is a is connected to a publisher.
-
_pubSubChannelName
protected java.lang.String _pubSubChannelName(IOPort port, boolean publisher, boolean subscriber)
Return the name of a Publisher or Subscriber channel name.- Specified by:
_pubSubChannelName
in classModularCodeGenLazyTypedCompositeActor
- Parameters:
port
- The port.publisher
- True if the corresponding Publisher should be returned.subscriber
- True if the corresponding Subscriber should be returned.- Returns:
- the name of the channel.
-
-