Class TypedCompositeActor
- 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.TypedCompositeActor
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
TypedCompositeActor
public class TypedCompositeActor extends NamedProgramCodeGeneratorAdapter
Code generator adapter for typed composite actor.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Man-Kit Leung
- Pt.AcceptedRating:
- Red (zgang)
- Pt.ProposedRating:
- Yellow (cxh)
-
-
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 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 TypedCompositeActor(TypedCompositeActor component)
Construct the code generator adapter associated with the given TypedCompositeActor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
_generateFireCode()
Generate the fire code.java.lang.String
generateInitializeCode()
Generate the initialize code for this director.java.lang.String
generatePreinitializeCode()
Generate the preinitialize code of the associated composite actor.java.lang.String
generatePreinitializeMethodBodyCode()
Generate the preinitialize code of the associated composite actor.java.lang.String
generateWrapupCode()
Generate the wrapup code.java.util.Set<java.lang.String>
getSharedCode()
Generate the shared code.-
Methods inherited from class ptolemy.cg.kernel.generic.program.NamedProgramCodeGeneratorAdapter
_generateTypeConvertStatement, analyzeTypeConvert, copyFilesToCodeDirectory, generateFireCode, generateFireFunctionCode, generateMainLoop, generateModeTransitionCode, generatePostfireCode, generatePrefireCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, generateVariableDeclaration, generateVariableInitialization, getAddTimeString, getBufferSize, getBufferSize, getComponent, getDeclareSharedCode, getDefaultBlocks, getFireFunctionParameters, getHeaderFiles, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getName, getParameterValue, getReference, getReference, getSinkChannels, getSourceTimeString, getTimeSourcePortName, getTypeConvertChannels, getTypeConvertReference, getTypeConvertSinkChannels, setupAdapter, targetType
-
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
-
TypedCompositeActor
public TypedCompositeActor(TypedCompositeActor component)
Construct the code generator adapter associated with the given TypedCompositeActor.- Parameters:
component
- The associated component.
-
-
Method Detail
-
_generateFireCode
protected java.lang.String _generateFireCode() throws IllegalActionException
Description copied from class:NamedProgramCodeGeneratorAdapter
Generate the fire code. In this base class, add the name of the associated component in the comment. It checks the inline parameter of the code generator. If the value is true, it generates the actor fire code and the necessary type conversion code. Otherwise, it generate an invocation to the actor function that is generated by generateFireFunctionCode.- Overrides:
_generateFireCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The generated code.
- Throws:
IllegalActionException
- Not thrown in this base class.
-
generatePreinitializeCode
public java.lang.String generatePreinitializeCode() throws IllegalActionException
Generate the preinitialize code of the associated composite actor. It first creates buffer size and offset map for its input ports and output ports. It then gets the result of generatePreinitializeCode() method of the local director adapter.- Overrides:
generatePreinitializeCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The preinitialize code of the associated composite actor.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating preinitialize code for the actor or while creating buffer size and offset map.
-
generatePreinitializeMethodBodyCode
public java.lang.String generatePreinitializeMethodBodyCode() throws IllegalActionException
Generate the preinitialize code of the associated composite actor. It first creates buffer size and offset map for its input ports and output ports. It then gets the result of generatePreinitializeCode() method of the local director adapter.- Overrides:
generatePreinitializeMethodBodyCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The preinitialize code of the associated composite actor.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating preinitialize code for the actor or while creating buffer size and offset map.
-
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 classNamedProgramCodeGeneratorAdapter
- Returns:
- The generated initialize code.
- Throws:
IllegalActionException
- If illegal macro names are found.
-
generateWrapupCode
public java.lang.String generateWrapupCode() throws IllegalActionException
Description copied from class:NamedProgramCodeGeneratorAdapter
Generate the wrapup code. In this base class, do nothing. Subclasses may extend this method to generate the wrapup code of the associated component and append the code to the given string buffer.- Overrides:
generateWrapupCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The generated wrapup code.
- Throws:
IllegalActionException
- If thrown while appending to the the block or processing the macros.
-
getSharedCode
public java.util.Set<java.lang.String> getSharedCode() throws IllegalActionException
Description copied from class:NamedProgramCodeGeneratorAdapter
Generate the shared code. At run time of the generated code, the code generated by this method is run first, so any initialization of variables of this adapter should be done in this method. Note that at code generation time,NamedProgramCodeGeneratorAdapter.setupAdapter()
is run before this method. In this base class, return an empty set. Subclasses may generate code for variable declaration, defining constants, etc.- Overrides:
getSharedCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- An empty set in this base class.
- Throws:
IllegalActionException
- Not thrown in this base class.
-
-