Class ProceduralTemplateParser
- java.lang.Object
-
- ptolemy.cg.kernel.generic.program.TemplateParser
-
- ptolemy.cg.kernel.generic.program.procedural.ProceduralTemplateParser
-
- Direct Known Subclasses:
CTemplateParser
,JavaTemplateParser
public class ProceduralTemplateParser extends TemplateParser
A class that allows to parse macros of templates in a code generator perspective.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Bert Rodiers
- Pt.AcceptedRating:
- Red (rodiers)
- Pt.ProposedRating:
- Red (rodiers)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>
_includeFiles
The set of header files that needed to be included.-
Fields inherited from class ptolemy.cg.kernel.generic.program.TemplateParser
_codeGenerator, _component, _parseTreeCodeGenerator
-
-
Constructor Summary
Constructors Constructor Description ProceduralTemplateParser()
Construct the ProceduralTemplateParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generateFireCode()
Generate code that corresponds with the fire() method.java.util.Set<java.lang.String>
getHeaderFiles()
Get the files needed by the code generated from this adapter class.ParseTreeCodeGenerator
getParseTreeCodeGenerator()
Return a new parse tree code generator to use with expressions.void
init(java.lang.Object component, ProgramCodeGeneratorAdapter adapter)
Init the TemplateParser with the associated given component and the given adapter.-
Methods inherited from class ptolemy.cg.kernel.generic.program.TemplateParser
_findClosedParen, _getCodeGenerator, _replaceMacro, addFunctionUsed, addNewTypesUsed, escapeName, escapePortName, generateBlockCode, generateTypeConvertMethod, generateTypeConvertStatement, getCodeStream, getFunctionInvocation, getNewInvocation, getParameterValue, getPort, getSize, indexOf, parseList, processCode, setCodeGenerator, unescapeName, unescapePortName
-
-
-
-
Method Detail
-
init
public void init(java.lang.Object component, ProgramCodeGeneratorAdapter adapter)
Init the TemplateParser with the associated given component and the given adapter.- Overrides:
init
in classTemplateParser
- Parameters:
component
- The associated component.adapter
- The associated adapter.
-
getHeaderFiles
public java.util.Set<java.lang.String> getHeaderFiles() throws IllegalActionException
Get the files needed by the code generated from this adapter class. This base class returns an empty set.- Overrides:
getHeaderFiles
in classTemplateParser
- Returns:
- A set of strings that are header files needed by the code generated from this adapter class.
- Throws:
IllegalActionException
- Not Thrown in this base class.
-
generateFireCode
public java.lang.String generateFireCode()
Generate code that corresponds with the fire() method.- Returns:
- The generated code.
-
getParseTreeCodeGenerator
public ParseTreeCodeGenerator getParseTreeCodeGenerator()
Return a new parse tree code generator to use with expressions.- Overrides:
getParseTreeCodeGenerator
in classTemplateParser
- Returns:
- the parse tree code generator to use with expressions.
-
-