public class PtidesPreemptiveEDFDirector extends Director
red (jiazou) |
red (jiazou) |
NamedProgramCodeGeneratorAdapter.VariableScope
ProgramCodeGeneratorAdapter.Channel
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
java.util.Map<Actor,java.lang.Integer> |
actuators
Map of Actors to actuator number.
|
java.util.Map<Actor,java.lang.Integer> |
sensors
Map of Sensor to sensor number.
|
_component, _defaultBlocks, _eol, _templateParser
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
PtidesPreemptiveEDFDirector(PtidesDirector ptidesPreemptiveEDFDirector)
Construct the code generator adapter associated with the given
PtidesBasicDirector.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
_generateActorFireCode()
Fire methods for each actor.
|
protected java.lang.String |
_generateActorFuncProtoCode()
Generate actor function prototypes.
|
protected java.lang.String |
_generateActuatorActuationFuncArrayCode()
Return the code for the actuatorActuations array.
|
protected java.lang.String |
_generateActuatorActuationFuncProtoCode()
Return the code for Actuation_*(void) function prototypes.
|
protected java.lang.String |
_generateClearEventHeadCode(Actor actor)
This code reset the Event_Head pointer for each channel to null.
|
protected java.lang.String |
_generateDirectorHeader()
Generate code for director header.
|
protected java.lang.String |
_generatePtrToEventHeadCodeInputs()
Generate a pointer to the event head.
|
protected java.lang.String |
_generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source,
ProgramCodeGeneratorAdapter.Channel sink,
int offset)
Generate the type conversion statement for the particular offset of
the two given channels.
|
protected void |
_modelStaticAnalysis()
Traverse all the entities in the model and place them in the sensors
and actuators variables.
|
java.util.Map<java.lang.String,java.lang.String> |
generateAdditionalCodeFiles()
Generate the assembly file associated for this PtidyOS program.
|
java.lang.String |
generateInitializeCode()
Generate the initialize code for the associated PtidesBasic director.
|
java.lang.String |
generateMainLoop()
Generate a main loop for an execution under the control of
this director.
|
java.lang.String |
generatePreinitializeCode()
Generate the preinitialize code for this director.
|
void |
generateTransferInputsCode(IOPort inputPort,
java.lang.StringBuffer code)
Generate code for transferring all input tokens to the inside.
|
void |
generateTransferOutputsCode(IOPort outputPort,
java.lang.StringBuffer code)
Generate code for transferring all output tokens to the outside.
|
java.lang.String |
generateTypeConvertFireCode()
Generate the type conversion fire code.
|
java.lang.String |
generateVariableDeclaration()
Generate variable declarations for inputs and outputs and parameters.
|
java.util.Set |
getSharedCode()
Generate the shared code.
|
_ceilToPowerOfTwo, _generateVariableDeclaration, _generateVariableInitialization, _getParameter, generateCodeForGet, generateCodeForSend, generateConstructorCode, generateFireCode, generateFireFunctionCode, generateModeTransitionCode, generatePostfireCode, generatePreinitializeMethodBodyCode, generateTransferInputsCode, generateTransferOutputsCode, generateVariableDeclaration, generateVariableInitialization, generateVariableInitialization, generateWrapupCode, getComponent, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getParameter, getReference
_generateFireCode, analyzeTypeConvert, copyFilesToCodeDirectory, generatePrefireCode, generateSimpleName, generateTypeConvertFireCode, getAddTimeString, getBufferSize, getBufferSize, getDeclareSharedCode, getDefaultBlocks, getFireFunctionParameters, getHeaderFiles, getName, getParameterValue, getReference, getReference, getSinkChannels, getSourceTimeString, getTimeSourcePortName, getTypeConvertChannels, getTypeConvertReference, getTypeConvertSinkChannels, setupAdapter, targetType
_generateBlockByName, getAdapter, getCodeGenerator, getTemplateParser, processCode, setCodeGenerator, setTemplateParser, toString
createDecoratorAttributes, generateName
_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
public java.util.Map<Actor,java.lang.Integer> actuators
public java.util.Map<Actor,java.lang.Integer> sensors
public PtidesPreemptiveEDFDirector(PtidesDirector ptidesPreemptiveEDFDirector)
ptidesPreemptiveEDFDirector
- The associated director
ptolemy.domains.ptides.kernel.PtidesBasicDirectorpublic java.util.Map<java.lang.String,java.lang.String> generateAdditionalCodeFiles() throws IllegalActionException
IllegalActionException
- Not thrown in this base class.public java.lang.String generateInitializeCode() throws IllegalActionException
generateInitializeCode
in class Director
IllegalActionException
- If the adapter associated with
an actor throws it while generating initialize code for the actor.public java.lang.String generateMainLoop() throws IllegalActionException
generateMainLoop
in class NamedProgramCodeGeneratorAdapter
IllegalActionException
- Not thrown in this base class.public java.lang.String generatePreinitializeCode() throws IllegalActionException
generatePreinitializeCode
in class Director
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.
NOTE: fire code for each function, as well as the scheduler, should all go here
Take care of platform independent code.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.public java.lang.String generateTypeConvertFireCode() throws IllegalActionException
generateTypeConvertFireCode
in class NamedProgramCodeGeneratorAdapter
IllegalActionException
- Not thrown in this base class.public java.lang.String generateVariableDeclaration() throws IllegalActionException
generateVariableDeclaration
in class Director
IllegalActionException
- If the adapter class for the model
director cannot be found.public java.util.Set getSharedCode() throws IllegalActionException
getSharedCode
in class NamedProgramCodeGeneratorAdapter
IllegalActionException
- Not thrown in this base class.protected java.lang.String _generateActuatorActuationFuncArrayCode()
protected java.lang.String _generateActuatorActuationFuncProtoCode()
protected java.lang.String _generateActorFuncProtoCode() throws IllegalActionException
IllegalActionException
- If thrown while getting the
adapter for the actor.protected java.lang.String _generateDirectorHeader()
protected java.lang.String _generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source, ProgramCodeGeneratorAdapter.Channel sink, int offset) throws IllegalActionException
_generateTypeConvertStatement
in class NamedProgramCodeGeneratorAdapter
source
- The given source channel.sink
- The given sink channel.offset
- The given offset.IllegalActionException
- If there is a problem getting the
adapters for the ports or if the conversion cannot be handled.protected void _modelStaticAnalysis() throws IllegalActionException
IllegalActionException
- Thrown in derived classes.public java.lang.String _generateActorFireCode() throws IllegalActionException
IllegalActionException
- If thrown when getting the port's adapter.protected java.lang.String _generateClearEventHeadCode(Actor actor) throws IllegalActionException
actor
- The actor which the input channels reside, whose
pointers are pointed to nullIllegalActionException
- If thrown while getting the
width of a port.protected java.lang.String _generatePtrToEventHeadCodeInputs() throws IllegalActionException
IllegalActionException
- If thrown while getting the inputs
or reading the width of the inputs.