Class Expression
- 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.program.procedural.c.adapters.ptolemy.actor.lib.Expression
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class Expression extends NamedProgramCodeGeneratorAdapter
A code generation adapter class for ptolemy.actor.lib.Expression.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Man-Kit Leung
- Pt.AcceptedRating:
- Red (mankit)
- Pt.ProposedRating:
- Red (mankit) Needs 2nd pass for array children of different types
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Expression.VariableScope
Variable scope class customized for the CParseTreeCodeGenerator.-
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 CParseTreeCodeGenerator
_cParseTreeCodeGenerator
The parse tree code generator.-
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 Expression(Expression actor)
Constructor method for the Expression adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
_generateFireCode()
Generate fire code.java.lang.String
generateInitializeCode()
Generate initialize code.java.lang.String
generatePreinitializeCode()
Generate preinitialize code.java.lang.String
generateWrapupCode()
Generate wrap up code.java.util.Set
getHeaderFiles()
Get the files needed by the code generated for the Expression actor.java.util.Set
getSharedCode()
Get shared code.-
Methods inherited from class ptolemy.cg.kernel.generic.program.NamedProgramCodeGeneratorAdapter
_generateTypeConvertStatement, analyzeTypeConvert, copyFilesToCodeDirectory, generateFireCode, generateFireFunctionCode, generateMainLoop, generateModeTransitionCode, generatePostfireCode, generatePrefireCode, generatePreinitializeMethodBodyCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, generateVariableDeclaration, generateVariableInitialization, getAddTimeString, getBufferSize, getBufferSize, getComponent, getDeclareSharedCode, getDefaultBlocks, getFireFunctionParameters, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getName, getParameterValue, getReference, getReference, 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
-
-
-
-
Field Detail
-
_cParseTreeCodeGenerator
protected CParseTreeCodeGenerator _cParseTreeCodeGenerator
The parse tree code generator.
-
-
Constructor Detail
-
Expression
public Expression(Expression actor)
Constructor method for the Expression adapter.- Parameters:
actor
- The associated actor.
-
-
Method Detail
-
_generateFireCode
protected java.lang.String _generateFireCode() throws IllegalActionException
Generate fire code. The method reads infireBlock
from Expression.c, replaces macros with their values and appends the processed code block to the given code buffer.- Overrides:
_generateFireCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The generated code.
- Throws:
IllegalActionException
- If the code stream encounters an error in processing the specified code block(s).
-
generateInitializeCode
public java.lang.String generateInitializeCode() throws IllegalActionException
Generate initialize code. This method reads theinitBlock
from Expression.c, replaces macros with their values and returns the processed code string.- Overrides:
generateInitializeCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The processed code string.
- Throws:
IllegalActionException
- If the code stream encounters an error in processing the specified code block(s).
-
generatePreinitializeCode
public java.lang.String generatePreinitializeCode() throws IllegalActionException
Generate preinitialize code. This method reads thepreinitBlock
from Expression.c, replaces macros with their values and returns the processed code string.- Overrides:
generatePreinitializeCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The processed code string.
- Throws:
IllegalActionException
- If the code stream encounters an error in processing the specified code block(s).
-
getSharedCode
public java.util.Set getSharedCode() throws IllegalActionException
Get shared code. This method reads thesharedBlock
from Expression.c, replaces macros with their values and returns the processed code string.- Overrides:
getSharedCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- A set of strings that are code shared by multiple instances of the same actor.
- Throws:
IllegalActionException
- If the code stream encounters an error in processing the specified code block(s).
-
generateWrapupCode
public java.lang.String generateWrapupCode() throws IllegalActionException
Generate wrap up code. This method reads thewrapupBlock
from Expression.c, replaces macros with their values and appends the processed code block to the given code buffer.- Overrides:
generateWrapupCode
in classNamedProgramCodeGeneratorAdapter
- Returns:
- The processed code string.
- Throws:
IllegalActionException
- If the code stream encounters an error in processing the specified code block(s).
-
getHeaderFiles
public java.util.Set getHeaderFiles() throws IllegalActionException
Get the files needed by the code generated for the Expression actor.- Overrides:
getHeaderFiles
in classNamedProgramCodeGeneratorAdapter
- Returns:
- A set of strings that are names of the header files needed by the code generated for the Expression actor.
- Throws:
IllegalActionException
- Not Thrown in this subclass.
-
-