Package ptolemy.domains.taskpt.kernel
Class TaskPtDirector
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
TaskDirector
,ThreadDirector
public abstract class TaskPtDirector extends VisualSequenceDirector
A director for controlling tasks and threads in the taskpt domain.A TaskPtDirector has a shared memory that can be accessed by the actors that this director is controlling. The memory is local to this director (and not accessible for higher level entities).
For more details on this MoC see Torsten Limberg, Bastian Ristau, and Gerhard Fettweis. A Real-Time Programming Model for Heterogeneous MPSoCs, Proc. of SAMOS VIII.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Bastian Ristau
- Pt.AcceptedRating:
- red (ristau)
- Pt.ProposedRating:
- red (ristau)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.domains.sequence.gui.VisualSequenceDirector
VisualSequenceDirector.SequenceConfigureFactory
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.domains.sequence.gui.VisualSequenceDirector
icon, scheduleText
-
Fields inherited from class ptolemy.domains.sequence.kernel.SequencedModelDirector
_iterationCount, _postfireReturns, _scheduler, _sequencedList, defaultOutputInitialValue, fireUnexecutedActors, iterations, userDefinedDefaultOutputInitialValue, userDefinedOutputInitialValue
-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
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 TaskPtDirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_init()
Initialize the shared memory for the actors and set the iterations for this director to one.protected void
_setInitialValues()
Set the initial Tokens present on the inputs of the actors.protected boolean
_transferInputs(IOPort port)
Transfer at most one data token from the given input port of the container to the ports it is connected to on the inside.protected boolean
_transferOutputs(IOPort port)
Transfer at most one data token from the given output port of the container to the ports it is connected to on the outside.Memory
getMemory()
Get the memory assigned to this director.void
initialize()
Initialize the model controlled by this director.Receiver
newReceiver()
Use a QueueReceiver model for this director.boolean
postfire()
Return false if the system has finished executing.-
Methods inherited from class ptolemy.domains.sequence.kernel.SequenceDirector
fire, preinitialize
-
Methods inherited from class ptolemy.domains.sequence.kernel.SequencedModelDirector
_getInitialValueParameterName, _setScheduler, checkAttributeType, clone, fireSchedule, getContainedEntities, getScheduler, invalidateSchedule, isScheduleValid, setOutputInitialValues, setScheduler, suggestedModalModelDirectors, supportMultirateFiring
-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, addInitializable, attributeChanged, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, prefire, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suspend, terminate, transferInputs, transferOutputs, transferOutputs, wrapup
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Constructor Detail
-
TaskPtDirector
public TaskPtDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace. The director will have a default scheduler of type SequenceScheduler. In addition to invoking the base class constructor the memory is initialized.- Parameters:
container
- Container of the director.name
- Name of this director.- Throws:
IllegalActionException
- If the director is not compatible with the specified container. May be thrown in a derived class.NameDuplicationException
- If the container is not a CompositeActor and the name collides with an entity in the container.
-
-
Method Detail
-
getMemory
public Memory getMemory()
Get the memory assigned to this director.- Returns:
- The memory assigned to this director.
-
initialize
public void initialize() throws IllegalActionException
Initialize the model controlled by this director.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classSequencedModelDirector
- Throws:
IllegalActionException
- Thrown if the initialize() method of one of the associated actors throws it, or if there is no scheduler.
-
newReceiver
public Receiver newReceiver()
Use a QueueReceiver model for this director.- Overrides:
newReceiver
in classSequencedModelDirector
- Returns:
- A new QueueReceiver.
-
postfire
public boolean postfire() throws IllegalActionException
Return false if the system has finished executing. In addition to calling the to invoking the base class method clear receivers and the memory, if the system has finished executing.- Specified by:
postfire
in interfaceExecutable
- Overrides:
postfire
in classSequencedModelDirector
- Returns:
- True if the Director wants to be fired again in the future.
- Throws:
IllegalActionException
- Thrown if the iterations parameter does not contain a legal value.
-
_init
protected void _init() throws IllegalActionException, NameDuplicationException
Initialize the shared memory for the actors and set the iterations for this director to one.- Overrides:
_init
in classSequencedModelDirector
- Throws:
IllegalActionException
- Thrown if there is a problem instantiating the director's parameters.NameDuplicationException
- Thrown if there is a problem instantiating the director's parameters.
-
_transferInputs
protected boolean _transferInputs(IOPort port) throws IllegalActionException
Transfer at most one data token from the given input port of the container to the ports it is connected to on the inside. This method delegates the operation to the IOPort, so that the subclass of IOPort, TypedIOPort, can override this method to perform run-time type conversion.- Overrides:
_transferInputs
in classDirector
- Parameters:
port
- The port to transfer tokens from.- Returns:
- True if at least one data token is transferred.
- Throws:
IllegalActionException
- Thrown, if the port is not an opaque input port.- See Also:
IOPort.transferInputs()
-
_transferOutputs
protected boolean _transferOutputs(IOPort port) throws IllegalActionException
Transfer at most one data token from the given output port of the container to the ports it is connected to on the outside.- Overrides:
_transferOutputs
in classDirector
- Parameters:
port
- The port to transfer tokens from.- Returns:
- True if the port has an inside token that was successfully transferred. Otherwise return false (or throw an exception).
- Throws:
IllegalActionException
- Thrown, if the port is not an opaque output port.
-
_setInitialValues
protected void _setInitialValues() throws IllegalActionException
Set the initial Tokens present on the inputs of the actors. In this case do not set any initial tokens. Remove already present tokens.- Throws:
IllegalActionException
- Thrown if already present tokens cannot be removed.
-
-