ptolemy.codegen.c.actor.sched
Class StaticSchedulingDirector
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.codegen.kernel.CodeGeneratorHelper
ptolemy.codegen.actor.Director
ptolemy.codegen.c.actor.sched.StaticSchedulingDirector
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, ActorCodeGenerator, ComponentCodeGenerator, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- GiottoDirector, SDFDirector, SRDirector
public class StaticSchedulingDirector
- extends Director
Code generator helper associated with the StaticSchedulingDirector class.
This classis also associated with a code generator.
- Since:
- Ptolemy II 6.0
- Version:
- $Id: StaticSchedulingDirector.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Gang Zhou
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Method Summary |
private void |
_generateUpdatePortOffsetCode(java.lang.StringBuffer code,
Actor actor)
Generate the code that updates the input/output port offset. |
java.lang.String |
generateFireCode()
Generate the code for the firing of actors according to the SDF
schedule. |
java.lang.String |
generateMainLoop()
Generate a main loop for an execution under the control of
this director. |
java.lang.String |
generatePreinitializeCode()
Generate the preinitialize code for this director. |
java.lang.String |
generateVariableDeclaration()
Generate a variable declaration for the period parameter,
if there is one. |
Methods inherited from class ptolemy.codegen.actor.Director |
_ceilToPowerOfTwo, _getIndentPrefix, _updateConnectedPortsOffset, _updatePortOffset, createOffsetVariablesIfNeeded, generateCodeForGet, generateCodeForSend, generateFireFunctionCode, generateInitializeCode, generateModeTransitionCode, generateOffset, generatePostfireCode, generateTransferInputsCode, generateTransferOutputsCode, generateVariableInitialization, generateWrapupCode, getBufferSize, getComponent, getHeaderFiles, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getReference, getReference, getReferenceChannels, getWCET |
Methods inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper |
_createBufferSizeAndOffsetMap, _createInputBufferSizeAndOffsetMap, _findClosedParen, _generateBlockCode, _generateBlockCode, _generateFireCode, _generateTypeConvertMethod, _generateTypeConvertStatement, _generateTypeConvertStatements, _getCastType, _getChannelAndOffset, _getFireFunctionArguments, _getHelper, _getHelper, _getReference, _getReferenceChannels, _getTypeConvertChannels, _getTypeConvertReference, _indexOf, _replaceMacro, addFunctionUsed, addNewTypeUsed, analyzeTypeConvert, checkLocal, checkRemote, codeGenType, copyFilesToCodeDirectory, generateChannelOffset, generateFireFunctionCode2, generateName, generateOffset, generatePortReference, generatePrefireCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, generateVariableName, getBufferSize, getCodeGenerator, getDefaultBlocks, getDirector, getDirectorHelper, getFunctionInvocation, getNewInvocation, getObject, getParameterValue, getParseTreeCodeGenerator, getPort, getRates, getReadOffset, getReference, getReference, getReference, getReference, getSharedCode, getSinkChannels, getSize, getSourceChannel, getWriteOffset, isPrimitive, isPrimitive, parseList, processCode, resetInputPortsOffset, setBufferSize, setCodeGenerator, setReadOffset, setWriteOffset, targetType, toString |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getContainedObject, _isMoMLSuppressed, _markContentsDerived, _propagateExistence, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getContainer, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
StaticSchedulingDirector
public StaticSchedulingDirector(StaticSchedulingDirector staticSchedulingDirector)
- Construct the code generator helper associated with the given
StaticSchedulingDirector.
- Parameters:
staticSchedulingDirector
- The associated
ptolemy.actor.sched.StaticSchedulingDirector
generateFireCode
public java.lang.String generateFireCode()
throws IllegalActionException
- Generate the code for the firing of actors according to the SDF
schedule.
- Specified by:
generateFireCode
in interface ActorCodeGenerator
- Overrides:
generateFireCode
in class Director
- Returns:
- The generated fire code.
- Throws:
IllegalActionException
- If the SDF director does not have an
attribute called "iterations" or a valid schedule, or the actor to be
fired cannot find its associated helper.
_generateUpdatePortOffsetCode
private void _generateUpdatePortOffsetCode(java.lang.StringBuffer code,
Actor actor)
throws IllegalActionException
- Generate the code that updates the input/output port offset.
- Parameters:
code
- The given code buffer.actor
- The given actor.
- Throws:
IllegalActionException
- Thrown if
_updatePortOffset(IOPort, StringBuffer, int) or getRate(IOPort)
throw it.
generateMainLoop
public java.lang.String generateMainLoop()
throws IllegalActionException
- Generate a main loop for an execution under the control of
this director. If the associated director has a parameter
named iterations with a value greater than zero,
then wrap code generated by generateFireCode() in a
loop that executes the specified number of iterations.
Otherwise, wrap it in a loop that executes forever.
In the loop, first get the code returned by generateFireCode(),
and follow that with the code produced by the container
help for generateModeTransitionCode(). That code will
make state transitions in modal models at the conclusion
of each iteration. Next, this code calls postfire(), and
that returns false, breaks out of the main loop.
Finally, if the director has a parameter named period,
then increment the variable _currentTime after each
pass through the loop.
- Overrides:
generateMainLoop
in class Director
- Returns:
- Code for the main loop of an execution.
- Throws:
IllegalActionException
- If something goes wrong.
generatePreinitializeCode
public java.lang.String generatePreinitializeCode()
throws IllegalActionException
- Generate the preinitialize code for this director.
The preinitialize code for the director is generated by appending
the preinitialize code for each actor.
- Specified by:
generatePreinitializeCode
in interface ActorCodeGenerator
- Overrides:
generatePreinitializeCode
in class Director
- Returns:
- The generated preinitialize code.
- Throws:
IllegalActionException
- If getting the helper fails,
or if generating the preinitialize code for a helper fails,
or if there is a problem getting the buffer size of a port.
generateVariableDeclaration
public java.lang.String generateVariableDeclaration()
throws IllegalActionException
- Generate a variable declaration for the period parameter,
if there is one.
- Specified by:
generateVariableDeclaration
in interface ActorCodeGenerator
- Overrides:
generateVariableDeclaration
in class Director
- Returns:
- code The generated code.
- Throws:
IllegalActionException
- If the helper class for the model
director cannot be found.