Class FSMDirector
- 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.Director
-
- ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.domains.modal.kernel.FSMDirector
-
- ptolemy.cg.adapter.generic.program.procedural.c.adapters.ptolemy.domains.modal.kernel.FSMDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class FSMDirector extends FSMDirector
Code generator adapter associated with the FSMDirector class. This class is also associated with a code generator.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- William Lucas
- Pt.AcceptedRating:
- Red (sssf)
- Pt.ProposedRating:
- Red (sssf)
-
-
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 Modifier and Type Field Description protected java.lang.String
_sanitizedDirectorName
The sanitized name of the director.-
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 FSMDirector(FSMDirector component)
Construct the code generator helper associated with the given modal controller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generateConstructorCode()
Generate the constructor code for the specified director.java.lang.String
generateFireFunctionCode()
Generate the code for the firing of this director.java.lang.String
generateFunctionsDeclaration()
Generate The functions' declaration code for this director.java.lang.String
generateInitializeFunctionCode()
Generate the initialize function code for the associated FSM director.java.lang.String
generateMainLoop()
Generate a main loop for an execution under the control of this FSM director.java.lang.String
generatePostfireCode()
Generate the postfire code of the associated composite actor.java.lang.String
generatePrefireCode()
Generate the prefire code of the associated composite actor.java.lang.String
generatePreinitializeCode()
Generate the preinitialize code for this director.java.lang.String
generatePreinitializeMethodBodyCode()
Generate the preinitialize code for this director.java.lang.String
generateTransferInputCode()
Generate the code for the transfer of input values inside the modal model.java.lang.String
generateTransferOutputCode()
Generate the code for the transfer of output values inside the modal model.java.lang.String
generateVariableDeclaration()
We override the super method, because the declaration of the variables are in the actor's files.java.lang.String
getSanitizedDirectorName()
Returns the sanitized name of this director adapter.-
Methods inherited from class ptolemy.cg.adapter.generic.program.procedural.adapters.ptolemy.domains.modal.kernel.FSMDirector
generateFireCode, generateTransferInputsCode, generateTransferOutputsCode, getReference
-
Methods inherited from class ptolemy.cg.adapter.generic.adapters.ptolemy.actor.Director
_ceilToPowerOfTwo, _generateVariableDeclaration, _generateVariableInitialization, _getParameter, generateCodeForGet, generateCodeForSend, generateInitializeCode, generateModeTransitionCode, generateTransferInputsCode, generateTransferOutputsCode, generateVariableDeclaration, generateVariableInitialization, generateVariableInitialization, generateWrapupCode, getComponent, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getParameter
-
Methods inherited from class ptolemy.cg.kernel.generic.program.NamedProgramCodeGeneratorAdapter
_generateFireCode, _generateTypeConvertStatement, analyzeTypeConvert, copyFilesToCodeDirectory, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, getAddTimeString, getBufferSize, getBufferSize, getDeclareSharedCode, getDefaultBlocks, getFireFunctionParameters, getHeaderFiles, getName, getParameterValue, getReference, getReference, getSharedCode, 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
-
FSMDirector
public FSMDirector(FSMDirector component)
Construct the code generator helper associated with the given modal controller.- Parameters:
component
- The associated component.
-
-
Method Detail
-
generateConstructorCode
public java.lang.String generateConstructorCode() throws IllegalActionException
Generate the constructor code for the specified director. In this class we initialize the director with its internal parameters and fields as well as with the depths of the actors- Overrides:
generateConstructorCode
in classDirector
- Returns:
- The generated constructor code
- Throws:
IllegalActionException
- Not thrown in this base class.
-
generateFunctionsDeclaration
public java.lang.String generateFunctionsDeclaration() throws IllegalActionException
Generate The functions' declaration code for this director.- Returns:
- The functions' declaration function code.
- Throws:
IllegalActionException
- If thrown while generating code.
-
generateInitializeFunctionCode
public java.lang.String generateInitializeFunctionCode() throws IllegalActionException
Generate the initialize function code for the associated FSM director.- Returns:
- The generated initialize code.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating initialize code for the actor.
-
generateMainLoop
public java.lang.String generateMainLoop() throws IllegalActionException
Generate a main loop for an execution under the control of this FSM director.- Overrides:
generateMainLoop
in classNamedProgramCodeGeneratorAdapter
- Returns:
- Code for the main loop of an execution.
- Throws:
IllegalActionException
- If something goes wrong.
-
generateFireFunctionCode
public java.lang.String generateFireFunctionCode() throws IllegalActionException
Generate the code for the firing of this director.- Overrides:
generateFireFunctionCode
in classDirector
- Returns:
- The generated code.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating fire code for the actor.
-
generatePostfireCode
public java.lang.String generatePostfireCode() throws IllegalActionException
Generate the postfire code of the associated composite actor.- Overrides:
generatePostfireCode
in classDirector
- Returns:
- The postfire code of the associated composite actor.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating postfire code for the actor
-
generatePrefireCode
public java.lang.String generatePrefireCode() throws IllegalActionException
Generate the prefire code of the associated composite actor.- Overrides:
generatePrefireCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The prefire code of the associated composite actor.
- Throws:
IllegalActionException
- It should never happen
-
generatePreinitializeCode
public java.lang.String generatePreinitializeCode() throws IllegalActionException
Generate the preinitialize code for this director. The preinitialize code for the director is generated by appending the preinitialize code for each actor.- Overrides:
generatePreinitializeCode
in classDirector
- Returns:
- The generated preinitialize code.
- Throws:
IllegalActionException
- If getting the adapter fails, or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
-
generatePreinitializeMethodBodyCode
public java.lang.String generatePreinitializeMethodBodyCode() throws IllegalActionException
Generate the preinitialize code for this director. The preinitialize code for the director is generated by appending the preinitialize code for each actor.- Overrides:
generatePreinitializeMethodBodyCode
in classDirector
- Returns:
- The generated preinitialize code.
- Throws:
IllegalActionException
- If getting the adapter fails, or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
-
generateTransferInputCode
public java.lang.String generateTransferInputCode() throws IllegalActionException
Generate the code for the transfer of input values inside the modal model.- Returns:
- The generated code.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating code for the actor.
-
generateTransferOutputCode
public java.lang.String generateTransferOutputCode() throws IllegalActionException
Generate the code for the transfer of output values inside the modal model.- Returns:
- The generated code.
- Throws:
IllegalActionException
- If the adapter associated with an actor throws it while generating code for the actor.
-
generateVariableDeclaration
public java.lang.String generateVariableDeclaration() throws IllegalActionException
We override the super method, because the declaration of the variables are in the actor's files.- Overrides:
generateVariableDeclaration
in classDirector
- Returns:
- code The generated code.
- Throws:
IllegalActionException
- If the adapter class for the model director cannot be found.
-
getSanitizedDirectorName
public java.lang.String getSanitizedDirectorName()
Returns the sanitized name of this director adapter.- Returns:
- The sanitized name of the director
-
-