|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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.fsm.kernel.FSMDirector
ptolemy.codegen.c.domains.fsm.kernel.MultirateFSMDirector
public class MultirateFSMDirector
Code generator helper class associated with the MultirateFSMDirector class.
Red (zgang) |
Red (zgang) |
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 |
---|
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 | |
---|---|
MultirateFSMDirector(MultirateFSMDirector director)
Construct the code generator helper associated with the given MultirateFSMDirector. |
Method Summary | |
---|---|
protected java.lang.String |
_createOffsetVariablesIfNeeded()
Create read and write offset variables if needed for any output port of the container actor and any input port of contained actors. |
protected java.lang.String |
_createOffsetVariablesIfNeeded(IOPort port)
Check to see if variables are needed to represent read and write offsets for the given port. |
protected java.lang.String |
_generateInitialTransitionCode(java.util.Iterator transitions)
Generate code for making initial transition. |
protected void |
_updateConfigurationNumber(java.lang.StringBuffer codeBuffer,
State state)
Generate code for updating configuration number of the container actor according to the following equation: container's current configuration number = sum of numbers of configurations of refinements corresponding to states before the current state + configuration number of refinement corresponding to the current state The order of states is the same as in the list returned by calling entityList() on the controller. |
protected void |
_updatePortBufferSize(Actor refinement,
int[] portRates)
Check to see if the buffer size needed in current configuration is greater than in previous configurations. |
java.lang.String |
createOffsetVariablesIfNeeded()
Generate code for declaring read and write offset variables if needed. |
java.lang.String |
generateFireCode()
Generate the code for the firing of actors controlled by this director. |
java.lang.String |
generateInitializeCode()
Generate the initialize code for the associated MultirateFSMDirector. |
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. |
Methods inherited from class ptolemy.codegen.c.domains.fsm.kernel.FSMDirector |
---|
_generateRefinementCode, generateFireFunctionCode |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MultirateFSMDirector(MultirateFSMDirector director)
director
- The associated component.Method Detail |
---|
public java.lang.String createOffsetVariablesIfNeeded() throws IllegalActionException
createOffsetVariablesIfNeeded
in interface ActorCodeGenerator
createOffsetVariablesIfNeeded
in class Director
IllegalActionException
- If thrown while creating
offset variables.public java.lang.String generateFireCode() throws IllegalActionException
generateFireCode
in interface ActorCodeGenerator
generateFireCode
in class FSMDirector
IllegalActionException
- If the helper associated with
an actor throws it while generating fire code for the actor.public java.lang.String generateInitializeCode() throws IllegalActionException
generateInitializeCode
in interface ComponentCodeGenerator
generateInitializeCode
in class Director
IllegalActionException
- If thrown while calling the same
method in its super class or updating the configuration number.public java.lang.String generatePreinitializeCode() throws IllegalActionException
generatePreinitializeCode
in interface ActorCodeGenerator
generatePreinitializeCode
in class Director
IllegalActionException
- If getting the helper fails,
or if generating the preinitialize code for a helper fails,
or if there is a problem getting the buffer size of a port.public void generateTransferInputsCode(IOPort inputPort, java.lang.StringBuffer code) throws IllegalActionException
generateTransferInputsCode
in class Director
inputPort
- The port to transfer tokens.code
- The string buffer that the generated code is appended to.
IllegalActionException
- If thrown while transferring tokens.public void generateTransferOutputsCode(IOPort outputPort, java.lang.StringBuffer code) throws IllegalActionException
generateTransferOutputsCode
in class Director
outputPort
- The port to transfer tokens.code
- The string buffer that the generated code is appended to.
IllegalActionException
- If thrown while transferring tokens.protected java.lang.String _createOffsetVariablesIfNeeded() throws IllegalActionException
IllegalActionException
- If thrown while creating
offset variables.protected java.lang.String _createOffsetVariablesIfNeeded(IOPort port) throws IllegalActionException
port
- The given port.
IllegalActionException
- If thrown while creating
offset variables.protected java.lang.String _generateInitialTransitionCode(java.util.Iterator transitions) throws IllegalActionException
transitions
- The iterator of transitions from initial state.
IllegalActionException
- If thrown while generating
transition code.protected void _updateConfigurationNumber(java.lang.StringBuffer codeBuffer, State state) throws IllegalActionException
container's current configuration number = sum of numbers of configurations of refinements corresponding to states before the current state + configuration number of refinement corresponding to the current state
The order of states is the same as in the list returned by calling entityList() on the controller.
codeBuffer
- The string buffer that the generated code is
appended to.state
- The current state.
IllegalActionException
- If helper cannot be found, refinement
cannot be found or code cannot be processed.protected void _updatePortBufferSize(Actor refinement, int[] portRates) throws IllegalActionException
refinement
- The refinement to be checked.portRates
- An int array of port rates of the refinement.
IllegalActionException
- If thrown while getting helper
or buffer size.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |