Class SDFReceiver
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.cg.kernel.generic.CodeGeneratorAdapter
-
- ptolemy.cg.kernel.generic.program.ProgramCodeGeneratorAdapter
-
- ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.actor.Receiver
-
- ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.domains.sdf.kernel.SDFReceiver
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
FSMReceiver
,SDFReceiver
public class SDFReceiver extends Receiver
The adapter for SDF receiver.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Jia Zou, Man-Kit Leung, Isaac Liu, Bert Rodiers
- Pt.AcceptedRating:
- Red (jiazou)
- Pt.ProposedRating:
- Red (jiazou)
-
-
Nested Class Summary
-
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 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 SDFReceiver(SDFReceiver receiver)
Construct an adapter for an SDF receiver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
_generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source)
Generate the type conversion statement for the particular offset of the two given channels.protected StaticSchedulingDirector
_getDirectorForReceiver()
Each receiver is associated with a director, return that director.protected StaticSchedulingDirector
_getExecutiveDirectorForReceiver()
Each receiver is associated with a component of some executive director.java.lang.String
generateGetCode(java.lang.String offset)
Generates code for getting tokens from the receiver.java.lang.String
generateHasTokenCode(java.lang.String offset)
Generates code to check the receiver has a token.java.lang.String
generatePutCode(IOPort sourcePort, java.lang.String offset, java.lang.String token)
Generate code for putting tokens from the receiver.-
Methods inherited from class ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.actor.Receiver
_removeSink, generateInitializeCode, getComponent, getName
-
Methods inherited from class ptolemy.cg.kernel.generic.program.ProgramCodeGeneratorAdapter
_generateBlockByName, getAdapter, getCodeGenerator, getTemplateParser, processCode, setCodeGenerator, setTemplateParser, toString
-
Methods inherited from class ptolemy.cg.kernel.generic.CodeGeneratorAdapter
createDecoratorAttributes, 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
-
SDFReceiver
public SDFReceiver(SDFReceiver receiver) throws IllegalActionException
Construct an adapter for an SDF receiver.- Parameters:
receiver
- The SDFReceiver for which an adapter is constructed.- Throws:
IllegalActionException
- If thrown by the superclass.
-
-
Method Detail
-
generateGetCode
public java.lang.String generateGetCode(java.lang.String offset) throws IllegalActionException
Generates code for getting tokens from the receiver.- Specified by:
generateGetCode
in classReceiver
- Parameters:
offset
- The offset of the port.- Returns:
- The generated get code.
- Throws:
IllegalActionException
- If thrown while getting the component, getting the adapter, getting the director or getting the port reference.
-
generateHasTokenCode
public java.lang.String generateHasTokenCode(java.lang.String offset) throws IllegalActionException
Generates code to check the receiver has a token.- Specified by:
generateHasTokenCode
in classReceiver
- Parameters:
offset
- The offset of the receiver, ignored in this base class.- Returns:
- The generated hasToken code, in this class, the string "true" is returned
- Throws:
IllegalActionException
- Not thrown in this base class.
-
generatePutCode
public java.lang.String generatePutCode(IOPort sourcePort, java.lang.String offset, java.lang.String token) throws IllegalActionException
Generate code for putting tokens from the receiver.- Specified by:
generatePutCode
in classReceiver
- Parameters:
sourcePort
- The source port.offset
- The offset of the port.token
- The token.- Returns:
- The generated put code.
- Throws:
IllegalActionException
- If thrown while getting the component, getting the adapter, getting the director or getting the port reference.
-
_generateTypeConvertStatement
protected java.lang.String _generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source) throws IllegalActionException
Description copied from class:Receiver
Generate the type conversion statement for the particular offset of the two given channels. This assumes that the offset is the same for both channel. Advancing the offset of one has to advance the offset of the other.- Specified by:
_generateTypeConvertStatement
in classReceiver
- Parameters:
source
- The given source channel.- Returns:
- The type convert statement for assigning the converted source variable to the sink variable with the given offset.
- Throws:
IllegalActionException
- If there is a problem getting the adapters for the ports or if the conversion cannot be handled.
-
_getDirectorForReceiver
protected StaticSchedulingDirector _getDirectorForReceiver() throws IllegalActionException
Each receiver is associated with a director, return that director.- Overrides:
_getDirectorForReceiver
in classReceiver
- Returns:
- The director associated with this receiver.
- Throws:
IllegalActionException
- FIXME: this is not exactly correct. This is probably because the information of the receiver is in the director of the container?
-
_getExecutiveDirectorForReceiver
protected StaticSchedulingDirector _getExecutiveDirectorForReceiver() throws IllegalActionException
Each receiver is associated with a component of some executive director.- Returns:
- The executive director if the component associated with this receiver.
- Throws:
IllegalActionException
- FIXME: This is a patch for hierarchical SDF codegen, need to find a better way of doing this.
-
-