|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.codegen.kernel.CodeGeneratorHelper
ptolemy.codegen.actor.Director
ptolemy.codegen.c.domains.pn.kernel.PNDirector
public class PNDirector
Code generator helper associated with the PNDirector class. This director initializes all the actors, then starts a thread for each actor that invokes the fire code for the actor in an infinite loop. FIXME: How to make it possible for executions to be finite?
| Red (eal) |
| Yellow (eal) |
| 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 java.util.HashSet<java.lang.String> |
_buffers
|
| Fields inherited from class ptolemy.codegen.actor.Director |
|---|
_director, _eol, _INDENT1, _INDENT2, _INDENT3, _INDENT4 |
| Fields inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper |
|---|
_codeGenerator, _codeStream, _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 | |
|---|---|
PNDirector(PNDirector pnDirector)
Construct the code generator helper associated with the given PNDirector. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
_createDynamicOffsetVariables(IOPort port)
Create offset variables for the channels of the given port. |
private java.lang.String |
_generateActorNameFileForDebugging()
|
protected java.lang.String |
_generateNotTerminateFlag()
Generate the notTerminate flag variable for the associated PN director. |
private void |
_generateThreadFunctionCode(java.lang.StringBuffer code)
|
private java.lang.String |
_getActorThreadLabel(Actor actor)
Generate the thread function name for a given actor. |
java.lang.String |
generateCodeForGet(IOPort port,
int channel)
Return the code for getting data from the specific port channel. |
java.lang.String |
generateCodeForSend(IOPort port,
int channel)
Return the code for sending data from the specific port channel. |
java.lang.String |
generateDirectorHeader()
Return the generated label for the director header. |
java.lang.String |
generateFireCode()
Generate the body code that lies between variable declaration and wrapup. |
java.lang.String |
generateInitializeCode()
Generate the initialize code for the associated PN director. |
java.lang.String |
generateMainLoop()
Return the main loop code for the associated PN director. |
static java.lang.String |
generatePortHeader(IOPort port,
int i)
Return the generated header label for the specified port channel. |
java.lang.String |
generatePostfireCode()
Generate the postfire code for the associated PN director. |
java.lang.String |
generatePreinitializeCode()
Generate the preinitialize code for the associated PN director. |
void |
generateTransferInputsCode(IOPort inputPort,
java.lang.StringBuffer code)
Generate code for transferring enough tokens to complete an internal iteration. |
void |
generateTransferOutputsCode(IOPort port,
java.lang.StringBuffer code)
Generate the transfer output code for the specified port. |
java.lang.String |
generateVariableInitialization()
Generate variable initialization for the referenced parameters. |
java.lang.String |
generateWrapupCode()
Generate the wrapup code for the associated PN director. |
int |
getBufferSize(IOPort port,
int channelNumber)
Return the size of the generated buffer for the specified port channel. |
java.util.Set |
getHeaderFiles()
Get the files needed by the code generated from this helper class. |
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 |
getSharedCode()
Generate the shared code for the associated PN director. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final java.util.HashSet<java.lang.String> _buffers
| Constructor Detail |
|---|
public PNDirector(PNDirector pnDirector)
pnDirector - The associated ptolemy.domains.pn.kernel.PNDirector| Method Detail |
|---|
public java.lang.String generateFireCode()
throws IllegalActionException
generateFireCode in interface ActorCodeGeneratorgenerateFireCode in class DirectorIllegalActionException - If the CodeGeneratorHelper._generateFireCode()
method throws the exceptions.
public java.util.Set getHeaderFiles()
throws IllegalActionException
getHeaderFiles in interface ActorCodeGeneratorgetHeaderFiles in class DirectorIllegalActionException - If something goes wrong.
public java.util.Set getLibraries()
throws IllegalActionException
getLibraries in interface ActorCodeGeneratorgetLibraries in class DirectorIllegalActionException - If thrown when gathering libraries.
public java.lang.String generateCodeForGet(IOPort port,
int channel)
throws IllegalActionException
generateCodeForGet in class Directorport - The specified port.channel - The specified channel.
IllegalActionException - Not thrown here.
public java.lang.String generateCodeForSend(IOPort port,
int channel)
throws IllegalActionException
port - The specified port.channel - The specified channel.
IllegalActionException - Not thrown here.public java.lang.String generateDirectorHeader()
public java.lang.String generateInitializeCode()
throws IllegalActionException
generateInitializeCode in interface ComponentCodeGeneratorgenerateInitializeCode in class DirectorIllegalActionException - If the helper associated with the
director throws it while generating initialize code.
public java.lang.String generateMainLoop()
throws IllegalActionException
generateMainLoop in class DirectorIllegalActionException - If the helper associated with the
director throws it while generating main loop code.
public static java.lang.String generatePortHeader(IOPort port,
int i)
port - The specified port.i - The specified channel number.
public java.lang.String generatePostfireCode()
throws IllegalActionException
generatePostfireCode in interface ActorCodeGeneratorgeneratePostfireCode in class DirectorIllegalActionException - If the helper associated with the
director throws it while generating postfire code.
public java.lang.String generatePreinitializeCode()
throws IllegalActionException
generatePreinitializeCode in interface ActorCodeGeneratorgeneratePreinitializeCode in class DirectorIllegalActionException - If the helper associated with an actor
throws it while generating preinitialize code for the actor.
public void generateTransferOutputsCode(IOPort port,
java.lang.StringBuffer code)
throws IllegalActionException
generateTransferOutputsCode in class Directorport - The specified port.code - The given buffer to generate code to.
IllegalActionException - Not thrown here.
public void generateTransferInputsCode(IOPort inputPort,
java.lang.StringBuffer code)
throws IllegalActionException
generateTransferInputsCode in class DirectorinputPort - The port to transfer tokens.code - The string buffer that the generated code is appended to.
IllegalActionException - If thrown while transferring tokens.
public java.lang.String generateVariableInitialization()
throws IllegalActionException
generateVariableInitialization in interface ActorCodeGeneratorgenerateVariableInitialization in class DirectorIllegalActionException - If the helper class for the model
director cannot be found.
public java.lang.String generateWrapupCode()
throws IllegalActionException
generateWrapupCode in interface ComponentCodeGeneratorgenerateWrapupCode in class DirectorIllegalActionException - If the helper associated with an actor
throws it while generating preinitialize code for the actor.
public int getBufferSize(IOPort port,
int channelNumber)
throws IllegalActionException
getBufferSize in class Directorport - The specified port.channelNumber - The specified channel number.
IllegalActionException - If an error occurs when getting the
value from the parameter.CodeGeneratorHelper.setBufferSize(IOPort, int, int)
public java.util.Set getSharedCode()
throws IllegalActionException
getSharedCode in interface ActorCodeGeneratorgetSharedCode in class CodeGeneratorHelperIllegalActionException - If the helper associated with the
director throws it while generating shared code.
protected java.lang.String _createDynamicOffsetVariables(IOPort port)
throws IllegalActionException
port - The port whose offset variables are generated.
IllegalActionException - If getting the rate or reading
parameters throws it.protected java.lang.String _generateNotTerminateFlag()
private void _generateThreadFunctionCode(java.lang.StringBuffer code)
throws IllegalActionException
code - The given code buffer.
IllegalActionExceptionprivate java.lang.String _generateActorNameFileForDebugging()
private java.lang.String _getActorThreadLabel(Actor actor)
actor - The given actor.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||