Class ModularSDFCodeGenerator
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.cg.kernel.generic.GenericCodeGenerator
-
- ptolemy.cg.kernel.generic.RunnableCodeGenerator
-
- ptolemy.cg.kernel.generic.program.ProgramCodeGenerator
-
- ptolemy.cg.kernel.generic.program.procedural.ProceduralCodeGenerator
-
- ptolemy.cg.kernel.generic.program.procedural.java.JavaCodeGenerator
-
- ptolemy.cg.kernel.generic.program.procedural.java.modular.ModularSDFCodeGenerator
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Decorator
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class ModularSDFCodeGenerator extends JavaCodeGenerator
Class for modular code generator.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Dai Bui, Bert Rodiers
- Pt.AcceptedRating:
- red (daib)
- Pt.ProposedRating:
- red (rodiers)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ModularSDFCodeGenerator.Firing
A firing instance of an actor.static class
ModularSDFCodeGenerator.FiringCluster
A cluster of firings of actors.static class
ModularSDFCodeGenerator.SimulationFiringFunction
A firing function for simulating (e.g.static class
ModularSDFCodeGenerator.SimulationJunction
Junction for simulation.-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.cg.kernel.generic.program.procedural.ProceduralCodeGenerator
_compileCommandDefault, _includes, _libraries, compile, compileCommand, generateEmbeddedCode
-
Fields inherited from class ptolemy.cg.kernel.generic.program.ProgramCodeGenerator
_modifiedVariables, _newTypesUsed, _portTypeMap, _portTypeMap2, _portTypeMap3, _portTypeMaxIndex, _portTypeMaxIndex2, _portTypeMaxIndex3, _primitiveTypes, _runCommandDefault, _tokenFuncUsed, _typeFuncUsed, _variablesAsArrays, generateComment, inline, maximumLinesPerBlock, measureTime, sourceLineBinding, useMake, variablesAsArrays, verbosity
-
Fields inherited from class ptolemy.cg.kernel.generic.RunnableCodeGenerator
_substituteMap, run, runCommand
-
Fields inherited from class ptolemy.cg.kernel.generic.GenericCodeGenerator
_codeFileName, _eol, _executeCommands, _generateInSubdirectory, _model, _sanitizedModelName, codeDirectory, generateInSubdirectory, generatorPackage, generatorPackageList, INDENT1, INDENT2, INDENT3, overwriteFiles
-
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 ModularSDFCodeGenerator(NamedObj container, java.lang.String name)
Create a new instance of the Modular java code generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBuffer
createGraph()
Create the deterministic SDF with sharing buffers graph for a composite actor.void
createProfile()
Create the profile for the model (at this level).int
generateCode(java.lang.StringBuffer code)
Generate code.java.lang.String
generateMainEntryCode()
Generate the main entry point.java.lang.String
generateMainExitCode()
Generate the main exit point.-
Methods inherited from class ptolemy.cg.kernel.generic.program.procedural.java.JavaCodeGenerator
_addActorIncludeDirectories, _addActorLibraries, _addClassPathLibraries, _analyzeTypeConversions, _concatenateClasspath, _finalPassOverCode, _generateIncludeFiles, _generatePreinitializeMethodBodyCode, _generatePreinitializeMethodEntryCode, _generatePreinitializeMethodExitCode, _generatePreinitializeMethodProcedureName, _getAutoGeneratedAdapter, _getFireFunctionArguments, _printExecutionTime, _processCode, _recordStartTime, _reset, _templateParserClass, _writeMakefile, _writeVariableDeclarations, codeGenType, codeGenType2, codeGenTypeToPtType, codeGenTypeValue, generateClosingEntryCode, generateClosingExitCode, generateConstantDefinition, generateFireFunctionCompositeEnd, generateFireFunctionCompositeStart, generateFireFunctionMethodInvocation, generateFireFunctionMethodName, generateFireFunctionVariableAndMethodName, generateFireFunctionVariableDeclaration, generateFunctionTable, generateInitializeEntryCode, generateInitializeExitCode, generateInitializeProcedureName, generateLineInfo, generatePackageStatement, generatePostfireEntryCode, generatePostfireExitCode, generatePostfireProcedureName, generateTypeConvertCode, generateVariableDeclaration, generateVariableInitialization, generateVariableName, generateWrapupEntryCode, generateWrapupExitCode, generateWrapupProcedureName, getMethodExceptionString, getMethodVisibilityString, markFunctionCalled, ptTypeToCodegenType, splitLongBody, splitVariableDeclaration, targetType
-
Methods inherited from class ptolemy.cg.kernel.generic.program.procedural.ProceduralCodeGenerator
_concatenateElements, _executeCommands, addInclude, addLibrary, addLibraryIfNecessary, clone, markFunctionCalled
-
Methods inherited from class ptolemy.cg.kernel.generic.program.ProgramCodeGenerator
_codeDirectoryAsFile, _formatComment, _generateBodyCode, _generateCode, _generatePreinitializeCode, _generateSharedCode, _instantiateAdapter, _setupAdapter, _splitBody, _splitVariableDeclaration, addModifiedVariables, attributeChanged, comment, comment, containsCode, generateFireFunctionCode, generateInitializeCode, generatePortName, generatePostfireCode, generatePtIOPortName, generatePtIOPortSize, generatePtTypedCompositeActorName, generatePtTypedCompositeActorSize, generateWrapupCode, getModifiedVariables, getTemplateExtension, invokeGenerateUpdatePortOffsets, isPrimitive, isPrimitive, ptolemyType, setModifiedVariables, updateCommandOptions
-
Methods inherited from class ptolemy.cg.kernel.generic.RunnableCodeGenerator
_runCommand, _setupCommands, _updateSubstituteMap
-
Methods inherited from class ptolemy.cg.kernel.generic.GenericCodeGenerator
_copyCFilesTosrc, _copyCFileTosrc, _getAdapter, _getAdapterClassFilter, _getOutputFilename, _isTopLevel, _printTimeAndMemory, _resetAll, _writeCode, _writeCodeFileName, createDecoratorAttributes, decoratedObjects, generateCode, generateCode, generateCopyright, getAdapter, getCodeFileName, getComponent, getExecuteCommands, isGlobalDecorator, main, setCodeGenerator, setContainer, setExecuteCommands
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_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, 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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
ModularSDFCodeGenerator
public ModularSDFCodeGenerator(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new instance of the Modular java code generator.- Parameters:
container
- The container.name
- The name of the Java code generator.- Throws:
IllegalActionException
- If the super class throws the exception or error occurs when setting the file path.NameDuplicationException
- If the super class throws the exception or an error occurs when setting the file path.
-
-
Method Detail
-
createProfile
public void createProfile() throws IllegalActionException
Create the profile for the model (at this level).- Throws:
IllegalActionException
- when the profile can't be generated.
-
createGraph
public java.lang.StringBuffer createGraph() throws IllegalActionException
Create the deterministic SDF with sharing buffers graph for a composite actor.- Returns:
- The generated profile of the composite actor.
- Throws:
IllegalActionException
- If there are problems performing the analysis.
-
generateCode
public int generateCode(java.lang.StringBuffer code) throws KernelException
Generate code. This is the main entry point.- Overrides:
generateCode
in classGenericCodeGenerator
- Parameters:
code
- The code buffer into which to generate the code.- Returns:
- The return value of the last subprocess that was executed. or -1 if no commands were executed.
- Throws:
KernelException
- If a type conflict occurs or the model is running.
-
generateMainEntryCode
public java.lang.String generateMainEntryCode() throws IllegalActionException
Generate the main entry point.- Overrides:
generateMainEntryCode
in classJavaCodeGenerator
- Returns:
- Return the definition of the main entry point for a program. In C, this would be defining main().
- Throws:
IllegalActionException
- Not thrown in this base class.
-
generateMainExitCode
public java.lang.String generateMainExitCode() throws IllegalActionException
Generate the main exit point.- Overrides:
generateMainExitCode
in classJavaCodeGenerator
- Returns:
- Return a string that declares the end of the main() function.
- Throws:
IllegalActionException
- Not thrown in this base class.
-
-