public class GiottoCEmachineFrameworkGenerator extends GiottoCodeGenerator
The framework code consists of
Modifier and Type | Class and Description |
---|---|
protected class |
GiottoCEmachineFrameworkGenerator.CEmachineFrameworkEditorFactory
An editor for CE machines.
|
GiottoCodeGenerator.GiottoEditorFactory
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
_endLine
The character use at the end of a line.
|
protected java.lang.String |
_tabChar
The character to use for a tab.
|
protected java.lang.String |
copyrightString
The text to be used for the copyright in the generated code.
|
protected java.util.Set |
dataTypes
The set of all unique types used.
|
protected java.lang.StringBuffer |
FCinDriversImplString
The functions to implement the input drivers.
|
protected java.lang.StringBuffer |
FCoutDriversImplString
The code for the initialization of output drivers.
|
protected java.lang.StringBuffer |
FCVarInitString
The code for the initialization of the array variables.
|
protected java.lang.StringBuffer |
FHfuncVarDeclString
The declaration of the driver functions and array variables.
|
protected java.lang.StringBuffer |
TCfuncImplString
Contains the skeleton code for the task functions.
|
protected java.lang.String |
THfuncDeclString
Contains the declaration of the task functions.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
GiottoCEmachineFrameworkGenerator(NamedObj container,
java.lang.String name)
Construct a factory with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_arrayVariablesAllocationCode(TypedCompositeActor model)
Generate the memory allocation code for
the output ports that are of type array.
|
protected void |
_driversImplementationCode(TypedCompositeActor model)
Generate implementation code for the drivers.
|
protected void |
_generateCodeStrings(TypedCompositeActor model)
Generate the various code strings for the framework C and Header code,
as well as the strings for the task C and Header code.
|
protected java.lang.String |
_generateFrameworkHeaderCode(TypedCompositeActor model)
Generate code for the H file f_code.h.
|
protected java.lang.String |
_generateFrameworkImplementationCode(TypedCompositeActor model)
Generate Framework Implementation C code (f_code.c) for the given model.
|
protected java.lang.String |
_generateTaskHeaderCode(TypedCompositeActor model)
Generate code for the H file task_code.h.
|
protected java.lang.String |
_generateTaskImplementationCode(TypedCompositeActor model)
Generate the Task Implementation C code (task_code.c) for the given model.
|
protected java.lang.String |
_getArrayLength(TypedIOPort port)
Return the value of the "arrayLength" attribute for the given port.
|
protected java.lang.String |
_getInitialValueString(TypedIOPort port)
Return the correct Giotto initial value string for the given port.
|
protected java.lang.String |
_getTypeString(TypedIOPort port)
Return the type of the port.
|
protected void |
_inputDriversImplementationCode(TypedCompositeActor model)
Generate input driver implementation code.
|
protected void |
_instantiateEditorFactoryClass()
Method to instantiate the Editor Factory class called from the
constructor.
|
protected void |
_outputDriversImplementationCode(TypedCompositeActor model)
Generate code which will copy the output local
data to the global data.
|
protected void |
_outputInitializationCode(TypedCompositeActor model)
Generate initialization code for the output drivers.
|
protected void |
_taskCodeSkeleton(TypedCompositeActor model)
Generate code for the task.
|
void |
writeFrameworkCode(TypedCompositeActor model,
java.io.File directory)
Generate the Framework code for the given model.
|
void |
writeGiottoCode(TypedCompositeActor model,
java.io.File directory)
Generate Giotto code for the given model and write into the file
model name.giotto in the directory specified by parameter "directory".
|
generateGiottoCode
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
protected java.util.Set dataTypes
protected java.lang.String _endLine
protected java.lang.String _tabChar
protected java.lang.StringBuffer FHfuncVarDeclString
protected java.lang.StringBuffer FCoutDriversImplString
protected java.lang.StringBuffer FCVarInitString
protected java.lang.StringBuffer FCinDriversImplString
protected java.lang.String THfuncDeclString
protected java.lang.StringBuffer TCfuncImplString
protected java.lang.String copyrightString
public GiottoCEmachineFrameworkGenerator(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the factory.IllegalActionException
- If the factory is not of an
acceptable attribute for the container.NameDuplicationException
- If the name coincides with
an attribute already in the container.public void writeGiottoCode(TypedCompositeActor model, java.io.File directory) throws IllegalActionException, NameDuplicationException
model
- The model for which the Giotto code is to be generateddirectory
- The directory into which the generated file
(model_name.giotto) is to be writtenIllegalActionException
- If the file
"directory"/"model_name"/model_name.giotto cannot be openedNameDuplicationException
- If any actor name coincides with
the name of another actor already in the model.public void writeFrameworkCode(TypedCompositeActor model, java.io.File directory) throws IllegalActionException, NameDuplicationException
model
- The model for which the Framework code is to be generateddirectory
- The directory into which the generated files
are to be writtenIllegalActionException
- If any of the files cannot be openedNameDuplicationException
- If any actor name coincides with
the name of another actor already in the model.protected void _instantiateEditorFactoryClass() throws IllegalActionException, NameDuplicationException
_instantiateEditorFactoryClass
in class GiottoCodeGenerator
IllegalActionException
- If the editor factory can not be
created.NameDuplicationException
- If there is already another editor
factory with the same name.protected java.lang.String _getTypeString(TypedIOPort port)
port
- The port for which to get the type.protected java.lang.String _getInitialValueString(TypedIOPort port) throws IllegalActionException
port
- The given port.IllegalActionException
- If there is a problem reading the
"initialOutputValue" attribute from the port.protected java.lang.String _getArrayLength(TypedIOPort port) throws IllegalActionException
port
- The given portIllegalActionException
- If there is a problem
reading the attribute from the port.protected java.lang.String _generateFrameworkImplementationCode(TypedCompositeActor model)
model
- The model for which to generate code.protected java.lang.String _generateFrameworkHeaderCode(TypedCompositeActor model) throws IllegalActionException
model
- The model for which to generate code.IllegalActionException
- If thrown while reading the frequency parameter.protected java.lang.String _generateTaskImplementationCode(TypedCompositeActor model)
model
- The model for which to generate code.protected java.lang.String _generateTaskHeaderCode(TypedCompositeActor model)
model
- The model for which to generate code.protected void _generateCodeStrings(TypedCompositeActor model) throws IllegalActionException
model
- The model for which to generate code.IllegalActionException
- If thrown while generating code
strings.protected void _outputInitializationCode(TypedCompositeActor model) throws IllegalActionException
model
- The modelIllegalActionException
- If thrown while accessing ports
or checking Giotto IDs.protected void _arrayVariablesAllocationCode(TypedCompositeActor model) throws IllegalActionException
model
- The model for which to generate code.IllegalActionException
- If there is a problem
getting the array length of the ports or if the input port is
a multiport.protected void _driversImplementationCode(TypedCompositeActor model) throws IllegalActionException
model
- The model.IllegalActionException
- If there is a problem
generating the input drivers or output drivers code.protected void _outputDriversImplementationCode(TypedCompositeActor model) throws IllegalActionException
model
- The modelIllegalActionException
- If there is a problem
generating the drivers implementation code.protected void _inputDriversImplementationCode(TypedCompositeActor model) throws IllegalActionException
model
- The model for which to generate the input drivers code.IllegalActionException
- If thrown while determining if
an input driver is needed, if the input port is a multiport
or if thrown while getting the array length of the output port.protected void _taskCodeSkeleton(TypedCompositeActor model) throws IllegalActionException
model
- The model.IllegalActionException
- If there is a problem
generating the task code.