|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.kernel.util.NamedObj ptolemy.codegen.kernel.CodeGeneratorHelper ptolemy.codegen.c.kernel.CCodeGeneratorHelper ptolemy.codegen.c.actor.TypedCompositeActor
public class TypedCompositeActor
Code generator helper for typed composite actor.
Red (zgang) |
Yellow (cxh) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper |
---|
CodeGeneratorHelper.Channel, CodeGeneratorHelper.VariableScope |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private int[] |
_firingsPerGlobalIteration
An int array of firings per global iteration. |
private int[][] |
_rates
A two-dimensional int array of rates of this actor. |
Fields inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper |
---|
_codeGenerator, _codeStream, _eol, _INDENT1, _INDENT2, _parseTreeCodeGenerator, _portConversions, _referencedParameters |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary | |
---|---|
TypedCompositeActor(TypedCompositeActor component)
Construct the code generator helper associated with the given TypedCompositeActor. |
Method Summary | |
---|---|
protected void |
_createBufferSizeAndOffsetMap()
Create and initialize the buffer size and offset maps for this composite actor. |
protected void |
_createOutputBufferSizeAndOffsetMap()
Create the output buffer and offset map. |
protected java.lang.String |
_generateFireCode()
Generate the fire code of the associated composite actor. |
void |
analyzeTypeConvert()
For each actor in this typed composite actor, determine which ports need type conversion. |
java.lang.String |
createOffsetVariablesIfNeeded()
Create read and write offset variables if needed for the associated composite actor. |
java.lang.String |
generateFireFunctionCode()
Generate The fire function code. |
java.lang.String |
generateInitializeCode()
Generate the initialize code of the associated composite actor. |
void |
generateModeTransitionCode(java.lang.StringBuffer code)
Generate mode transition code. |
java.lang.String |
generatePostfireCode()
Generate the postfire code of the associated composite actor. |
java.lang.String |
generatePreinitializeCode()
Generate the preinitialize code of the associated composite actor. |
java.lang.String |
generateVariableDeclaration()
Generate variable declarations for input ports, output ports and parameters if necessary, as well as for the director and the contained actors. |
java.lang.String |
generateVariableInitialization()
Generate variable initialization for the referenced parameters. |
java.lang.String |
generateWrapupCode()
Generate the wrapup code of the associated composite actor. |
int[] |
getFiringsPerGlobalIteration()
Return an int array of firings per global iteration. |
java.util.Set |
getHeaderFiles()
Get the header files needed by the code generated from this helper class. |
java.util.Set |
getIncludeDirectories()
Return the include directories specified in the "includeDirectories" blocks in the templates of the actors included in this CompositeActor. |
java.util.Set |
getLibraries()
Return the libraries specified in the "libraries" blocks in the templates of the actors included in this CompositeActor. |
java.util.Set |
getModifiedVariables()
Return a set of parameters that will be modified during the execution of the model. |
int[][] |
getRates()
Return a two-dimensional int array of rates of this actor. |
java.util.Set |
getSharedCode()
Generate a set of shared code fragments of the associated composite actor. |
java.lang.String |
resetOutputPortsOffset()
Reset the offsets of all inside buffers of all output ports of the associated composite actor to the default value of 0. |
void |
setFiringsPerGlobalIteration(int[] firingsPerGlobalIteration)
Set the int array of firings per global iteration. |
void |
setRates(int[][] rates)
Set the two-dimensional int array of rates of this actor. |
Methods inherited from class ptolemy.codegen.c.kernel.CCodeGeneratorHelper |
---|
_generateInputVariableDeclaration, _generateOutputVariableDeclaration, _generateReferencedParameterDeclaration, _generateTypeConvertStatement, _generateTypeConvertVariableDeclaration, _getFireFunctionArguments, _replaceMacro, getCodeGenerator, getJVMHeaderFiles, getParseTreeCodeGenerator |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int[] _firingsPerGlobalIteration
private int[][] _rates
Constructor Detail |
---|
public TypedCompositeActor(TypedCompositeActor component)
component
- The associated component.Method Detail |
---|
public void analyzeTypeConvert() throws IllegalActionException
analyzeTypeConvert
in class CodeGeneratorHelper
IllegalActionException
- If any of the helpers of the
inside actors is unavailable.CodeGeneratorHelper.analyzeTypeConvert()
public java.lang.String createOffsetVariablesIfNeeded() throws IllegalActionException
createOffsetVariablesIfNeeded
in interface ActorCodeGenerator
createOffsetVariablesIfNeeded
in class CodeGeneratorHelper
IllegalActionException
- If the helper class cannot be found
or the director helper throws it.protected java.lang.String _generateFireCode() throws IllegalActionException
_generateFireCode
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated
with an actor throws it while generating fire code for the
actor, or the director helper throws it while generating code
for transferring data.public java.lang.String generateFireFunctionCode() throws IllegalActionException
generateFireFunctionCode
in interface ActorCodeGenerator
generateFireFunctionCode
in class CodeGeneratorHelper
IllegalActionException
- If thrown while generating fire code.public java.lang.String generateInitializeCode() throws IllegalActionException
generateInitializeCode
in interface ComponentCodeGenerator
generateInitializeCode
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating initialize code for the actor
or while resetting read and write offset.public void generateModeTransitionCode(java.lang.StringBuffer code) throws IllegalActionException
generateModeTransitionCode
in interface ActorCodeGenerator
generateModeTransitionCode
in class CodeGeneratorHelper
code
- The string buffer that the generated code is appended to.
IllegalActionException
- If the director helper throws it
while generating mode transition code.public java.lang.String generatePostfireCode() throws IllegalActionException
generatePostfireCode
in interface ActorCodeGenerator
generatePostfireCode
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating postfire code for the actor.public java.lang.String generatePreinitializeCode() throws IllegalActionException
generatePreinitializeCode
in interface ActorCodeGenerator
generatePreinitializeCode
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating preinitialize code for the actor
or while creating buffer size and offset map.public java.lang.String generateVariableDeclaration() throws IllegalActionException
generateVariableDeclaration
in interface ActorCodeGenerator
generateVariableDeclaration
in class CCodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating variable declarations for
the actor.public java.lang.String generateVariableInitialization() throws IllegalActionException
generateVariableInitialization
in interface ActorCodeGenerator
generateVariableInitialization
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating variable declarations for
the actor.public java.lang.String generateWrapupCode() throws IllegalActionException
generateWrapupCode
in interface ComponentCodeGenerator
generateWrapupCode
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating wrapup code for the actor.public int[] getFiringsPerGlobalIteration()
setFiringsPerGlobalIteration(int[])
public java.util.Set getHeaderFiles() throws IllegalActionException
getHeaderFiles
in interface ActorCodeGenerator
getHeaderFiles
in class CCodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating header files for the actor.public java.util.Set getIncludeDirectories() throws IllegalActionException
getIncludeDirectories
in interface ActorCodeGenerator
getIncludeDirectories
in class CodeGeneratorHelper
IllegalActionException
- If thrown when gathering
include directories.public java.util.Set getLibraries() throws IllegalActionException
getLibraries
in interface ActorCodeGenerator
getLibraries
in class CodeGeneratorHelper
IllegalActionException
- If thrown when gathering libraries.public java.util.Set getModifiedVariables() throws IllegalActionException
getModifiedVariables
in interface ActorCodeGenerator
getModifiedVariables
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with an actor
or director throws it while getting modified variables.public int[][] getRates()
getRates
in class CodeGeneratorHelper
setRates(int[][])
public java.util.Set getSharedCode() throws IllegalActionException
getSharedCode
in interface ActorCodeGenerator
getSharedCode
in class CodeGeneratorHelper
IllegalActionException
- If the helper associated with
an actor throws it while generating shared code for the actor.public java.lang.String resetOutputPortsOffset() throws IllegalActionException
IllegalActionException
- If thrown while getting or
setting the offset.public void setFiringsPerGlobalIteration(int[] firingsPerGlobalIteration)
firingsPerGlobalIteration
- An int array of firings per
global iterationgetFiringsPerGlobalIteration()
public void setRates(int[][] rates)
rates
- A two-dimensional int array of rates of this actor.getRates()
protected void _createBufferSizeAndOffsetMap() throws IllegalActionException
_createBufferSizeAndOffsetMap
in class CodeGeneratorHelper
IllegalActionException
- If thrown while getting helper
or buffer size.protected void _createOutputBufferSizeAndOffsetMap() throws IllegalActionException
IllegalActionException
- If thrown while getting the
director helper or while getting the buffer size or read offset
or write offset.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |