Class SDFDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.cg.kernel.generic.CodeGeneratorAdapter
-
- ptolemy.cg.kernel.generic.program.ProgramCodeGeneratorAdapter
-
- ptolemy.cg.kernel.generic.program.NamedProgramCodeGeneratorAdapter
-
- ptolemy.cg.adapter.generic.adapters.ptolemy.actor.Director
-
- ptolemy.cg.adapter.generic.adapters.ptolemy.actor.PortDirector
-
- ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.actor.sched.StaticSchedulingDirector
-
- ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.domains.sdf.kernel.SDFDirector
-
- ptolemy.cg.adapter.generic.program.procedural.java.adapters.ptolemy.domains.sdf.kernel.SDFDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
SDFDirector
public class SDFDirector extends SDFDirector
Code generator adapter associated with the SDFDirector class. This class is also associated with a code generator.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Ye Zhou, Gang Zhou, Contributor: Christopher Brooks
- Pt.AcceptedRating:
- Red (eal)
- Pt.ProposedRating:
- Yellow (zgang)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.cg.kernel.generic.program.NamedProgramCodeGeneratorAdapter
NamedProgramCodeGeneratorAdapter.VariableScope
-
Nested classes/interfaces inherited from class ptolemy.cg.kernel.generic.program.ProgramCodeGeneratorAdapter
ProgramCodeGeneratorAdapter.Channel
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_portNumber
The port number.-
Fields inherited from class ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.domains.sdf.kernel.SDFDirector
_referencedParameters
-
Fields inherited from class ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.actor.sched.StaticSchedulingDirector
CURRENTTIME_DECLARATION
-
Fields inherited from class ptolemy.cg.adapter.generic.adapters.ptolemy.actor.PortDirector
_sanitizedDirectorName, ports
-
Fields inherited from class ptolemy.cg.kernel.generic.program.ProgramCodeGeneratorAdapter
_component, _defaultBlocks, _eol, _templateParser
-
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
-
-
Constructor Summary
Constructors Constructor Description SDFDirector(SDFDirector sdfDirector)
Construct the code generator adapter associated with the given SDFDirector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
_generatePortVariableDeclaration(NamedProgramCodeGeneratorAdapter target)
Generate the input and output port declarations.protected java.lang.String
_generateVariableDeclaration(NamedProgramCodeGeneratorAdapter target)
Generate variable declarations for inputs and outputs and parameters.protected java.lang.String
_getParameter(NamedProgramCodeGeneratorAdapter target, Attribute attribute, java.lang.String[] channelAndOffset)
Return an unique label for the given attribute referenced by the given adapter.java.lang.String
generateInitializeCode()
Generate the initialize code for this director.java.lang.String
generatePreinitializeCode()
Generate the preinitialize code for this director.void
generateTransferInputsCode(IOPort inputPort, java.lang.StringBuffer code)
Generate code for transferring enough tokens to complete an internal iteration.void
generateTransferOutputsCode(IOPort outputPort, java.lang.StringBuffer code)
Generate code for transferring enough tokens to fulfill the output production rate.java.lang.String
generateVariableDeclaration()
Generate constant for the period parameter, if there is one.JavaCodeGenerator
getCodeGenerator()
Get the code generator associated with this adapter class.-
Methods inherited from class ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.domains.sdf.kernel.SDFDirector
_createDynamicOffsetVariables, _createInputBufferSizeAndOffsetMap, _createOffsetVariablesIfNeeded, _generateVariableInitialization, _updatePortBufferSize, generateFireFunctionCode, getBufferSize
-
Methods inherited from class ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.actor.sched.StaticSchedulingDirector
_generateUpdatePortOffsetCode, _updateConnectedPortsOffset, _updatePortOffset, allowDynamicMultiportReference, createDecoratorAttributes, generateFireCode, generateMainLoop, generatePortName, padBuffers
-
Methods inherited from class ptolemy.cg.adapter.generic.adapters.ptolemy.actor.PortDirector
_checkLocal, _checkRemote, _generateChannelOffset, _generatePortReference, _getCastType, _getChannelAndOffset, _getRefName, _getRefType, getReference, getReference, getSanitizedDirectorName
-
Methods inherited from class ptolemy.cg.adapter.generic.adapters.ptolemy.actor.Director
_ceilToPowerOfTwo, generateCodeForGet, generateCodeForSend, generateConstructorCode, generateModeTransitionCode, generatePostfireCode, generatePreinitializeMethodBodyCode, generateTransferInputsCode, generateTransferOutputsCode, generateVariableDeclaration, generateVariableInitialization, generateVariableInitialization, generateWrapupCode, getComponent, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getParameter
-
Methods inherited from class ptolemy.cg.kernel.generic.program.NamedProgramCodeGeneratorAdapter
_generateFireCode, _generateTypeConvertStatement, analyzeTypeConvert, copyFilesToCodeDirectory, generatePrefireCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, getAddTimeString, getBufferSize, getDeclareSharedCode, getDefaultBlocks, getFireFunctionParameters, getHeaderFiles, getName, getParameterValue, getReference, getReference, getSharedCode, getSinkChannels, getSourceTimeString, getTimeSourcePortName, getTypeConvertChannels, getTypeConvertReference, getTypeConvertSinkChannels, setupAdapter, targetType
-
Methods inherited from class ptolemy.cg.kernel.generic.program.ProgramCodeGeneratorAdapter
_generateBlockByName, getAdapter, getTemplateParser, processCode, setCodeGenerator, setTemplateParser, toString
-
Methods inherited from class ptolemy.cg.kernel.generic.CodeGeneratorAdapter
generateName
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateExistence, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, decorators, 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, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
-
-
-
-
Constructor Detail
-
SDFDirector
public SDFDirector(SDFDirector sdfDirector)
Construct the code generator adapter associated with the given SDFDirector.- Parameters:
sdfDirector
- The associated ptolemy.domains.sdf.kernel.SDFDirector
-
-
Method Detail
-
generateInitializeCode
public java.lang.String generateInitializeCode() throws IllegalActionException
Generate the initialize code for this director. The initialize code for the director is generated by appending the initialize code for each actor.- Overrides:
generateInitializeCode
in classSDFDirector
- Returns:
- The generated initialize code.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating initialize code for the actor.
-
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.- Overrides:
generatePreinitializeCode
in classSDFDirector
- Returns:
- The generated preinitialize code.
- Throws:
IllegalActionException
- If getting the adapter fails, or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
-
generateTransferInputsCode
public void generateTransferInputsCode(IOPort inputPort, java.lang.StringBuffer code) throws IllegalActionException
Generate code for transferring enough tokens to complete an internal iteration.- Overrides:
generateTransferInputsCode
in classDirector
- Parameters:
inputPort
- The port to transfer tokens.code
- The string buffer that the generated code is appended to.- Throws:
IllegalActionException
- If thrown while transferring tokens.
-
generateTransferOutputsCode
public void generateTransferOutputsCode(IOPort outputPort, java.lang.StringBuffer code) throws IllegalActionException
Generate code for transferring enough tokens to fulfill the output production rate.- Overrides:
generateTransferOutputsCode
in classDirector
- Parameters:
outputPort
- The port to transfer tokens.code
- The string buffer that the generated code is appended to.- Throws:
IllegalActionException
- If thrown while transferring tokens.
-
generateVariableDeclaration
public java.lang.String generateVariableDeclaration() throws IllegalActionException
Generate constant for the period parameter, if there is one.- Overrides:
generateVariableDeclaration
in classStaticSchedulingDirector
- Returns:
- code The generated code.
- Throws:
IllegalActionException
- If the adapter class for the model director cannot be found.
-
getCodeGenerator
public JavaCodeGenerator getCodeGenerator()
Get the code generator associated with this adapter class.- Overrides:
getCodeGenerator
in classProgramCodeGeneratorAdapter
- Returns:
- The code generator associated with this adapter class.
- See Also:
ProgramCodeGeneratorAdapter.setCodeGenerator(GenericCodeGenerator)
-
_generatePortVariableDeclaration
protected java.lang.String _generatePortVariableDeclaration(NamedProgramCodeGeneratorAdapter target) throws IllegalActionException
Generate the input and output port declarations.- Parameters:
target
- The NamedProgramCodeGeneratorAdapter for which code needs to be generated.- Returns:
- The generated code.
- Throws:
IllegalActionException
- If thrown while generating the input or output variables.
-
_generateVariableDeclaration
protected java.lang.String _generateVariableDeclaration(NamedProgramCodeGeneratorAdapter target) throws IllegalActionException
Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.- Overrides:
_generateVariableDeclaration
in classDirector
- Parameters:
target
- The ProgramCodeGeneratorAdapter for which code needs to be generated.- Returns:
- code The generated code.
- Throws:
IllegalActionException
- If the adapter class for the model director cannot be found.
-
_getParameter
protected java.lang.String _getParameter(NamedProgramCodeGeneratorAdapter target, Attribute attribute, java.lang.String[] channelAndOffset) throws IllegalActionException
Return an unique label for the given attribute referenced by the given adapter.- Overrides:
_getParameter
in classSDFDirector
- Parameters:
target
- The ProgramCodeGeneratorAdapter for which code needs to be generated.attribute
- The given attribute.channelAndOffset
- The given channel and offset.- Returns:
- an unique label for the given attribute.
- Throws:
IllegalActionException
- If the adapter throws it while generating the label.
-
-