Package org.intocps.maestro.plugin
Class BasicMaestroExpansionPlugin
java.lang.Object
org.intocps.maestro.plugin.BasicMaestroExpansionPlugin
- All Implemented Interfaces:
IMaestroExpansionPlugin,IMaestroPlugin
Abstract base maestro expansion plugin implementation. All plugins should extend this class to reduce the impact on future changes of the @{link
IMaestroExpansionPlugin interface-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classNested classes/interfaces inherited from interface org.intocps.maestro.plugin.IMaestroExpansionPlugin
IMaestroExpansionPlugin.ConfigOption, IMaestroExpansionPlugin.EmptyRuntimeConfig<R>, IMaestroExpansionPlugin.RuntimeConfigAddition<T> -
Field Summary
Fields inherited from interface org.intocps.maestro.plugin.IMaestroPlugin
FMI_STATUS_VARIABLE_NAME, GLOBAL_EXECUTION_CONTINUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<org.intocps.maestro.ast.node.PStm> expand(AFunctionDeclaration declaredFunction, List<org.intocps.maestro.ast.node.PExp> formalArguments, IPluginConfiguration config, ISimulationEnvironment env, IErrorReporter errorReporter) Fallback function for raw expansion<R> Map.Entry<List<org.intocps.maestro.ast.node.PStm>, IMaestroExpansionPlugin.RuntimeConfigAddition<R>> expandWithRuntimeAddition(AFunctionDeclaration declaredFunction, List<org.intocps.maestro.ast.node.PExp> formalArguments, IPluginConfiguration config, ISimulationEnvironment env, IErrorReporter errorReporter) Function to use for building using the raw interface This is search order 2expandWithRuntimeAddition(AFunctionDeclaration declaredFunction, FmiBuilder<org.intocps.maestro.ast.node.PStm, org.intocps.maestro.ast.node.ASimulationSpecificationCompilationUnit, org.intocps.maestro.ast.node.PExp, ?> builder, List<FmiBuilder.Variable<org.intocps.maestro.ast.node.PStm, ?>> formalArguments, IPluginConfiguration config, ISimulationEnvironment env, IErrorReporter errorReporter) Function to use for building using the builder interface.Get the configuration requirement for this expansion plugingetFunctionDeclarationBuilder(String name, org.intocps.maestro.ast.node.PType returnType) booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.intocps.maestro.plugin.IMaestroExpansionPlugin
getDeclaredImportUnitMethods inherited from interface org.intocps.maestro.plugin.IMaestroPlugin
getName, getVersion
-
Constructor Details
-
BasicMaestroExpansionPlugin
public BasicMaestroExpansionPlugin()
-
-
Method Details
-
getFunctionDeclarationBuilder
protected BasicMaestroExpansionPlugin.FunctionDeclarationBuilder getFunctionDeclarationBuilder(String name, org.intocps.maestro.ast.node.PType returnType) -
getFunctionDeclarationBuilder
protected BasicMaestroExpansionPlugin.FunctionDeclarationBuilder getFunctionDeclarationBuilder(String name) -
getConfigRequirement
Description copied from interface:IMaestroExpansionPluginGet the configuration requirement for this expansion plugin- Specified by:
getConfigRequirementin interfaceIMaestroExpansionPlugin- Returns:
- the requirement
-
requireConfig
public boolean requireConfig()- Specified by:
requireConfigin interfaceIMaestroExpansionPlugin
-
parseConfig
- Specified by:
parseConfigin interfaceIMaestroExpansionPlugin- Throws:
IOException
-
expandWithRuntimeAddition
public <R> Map.Entry<List<org.intocps.maestro.ast.node.PStm>,IMaestroExpansionPlugin.RuntimeConfigAddition<R>> expandWithRuntimeAddition(AFunctionDeclaration declaredFunction, List<org.intocps.maestro.ast.node.PExp> formalArguments, IPluginConfiguration config, ISimulationEnvironment env, IErrorReporter errorReporter) throws ExpandException Function to use for building using the raw interface This is search order 2- Specified by:
expandWithRuntimeAdditionin interfaceIMaestroExpansionPlugin- Type Parameters:
R- the runtime type- Parameters:
declaredFunction- the function within the plugin that is selected to be expandedformalArguments- the formal arguments given to the expansion. these will match the function signatures formalsconfig- the configuration of null is not requiredenv- the runtime environmenterrorReporter- the error reported that must be used for reporting any errors or warnings- Returns:
- a map entry containing the list of raw entries and a runtime contribution or
IMaestroExpansionPlugin.EmptyRuntimeConfig - Throws:
ExpandException- if expansion fails
-
expand
public List<org.intocps.maestro.ast.node.PStm> expand(AFunctionDeclaration declaredFunction, List<org.intocps.maestro.ast.node.PExp> formalArguments, IPluginConfiguration config, ISimulationEnvironment env, IErrorReporter errorReporter) throws ExpandException Fallback function for raw expansion- Specified by:
expandin interfaceIMaestroExpansionPlugin- Parameters:
declaredFunction- the function within the plugin that is selected to be expandedformalArguments- the formal arguments given to the expansion. these will match the function signatures formalsconfig- the configuration of null is not requiredenv- the runtime environmenterrorReporter- the error reported that must be used for reporting any errors or warnings- Returns:
- a list of raw statements
- Throws:
ExpandException- if expansion fails
-
expandWithRuntimeAddition
public <R> IMaestroExpansionPlugin.RuntimeConfigAddition<R> expandWithRuntimeAddition(AFunctionDeclaration declaredFunction, FmiBuilder<org.intocps.maestro.ast.node.PStm, org.intocps.maestro.ast.node.ASimulationSpecificationCompilationUnit, throws ExpandExceptionorg.intocps.maestro.ast.node.PExp, ?> builder, List<FmiBuilder.Variable<org.intocps.maestro.ast.node.PStm, ?>> formalArguments, IPluginConfiguration config, ISimulationEnvironment env, IErrorReporter errorReporter) Function to use for building using the builder interface.
This is search order 1- Specified by:
expandWithRuntimeAdditionin interfaceIMaestroExpansionPlugin- Type Parameters:
R- the runtime type- Parameters:
declaredFunction- the function within the plugin that is selected to be expandedbuilder- the builder object to use for building the outputformalArguments- the formal arguments given to the expansion. these will match the function signatures formalsconfig- the configuration of null is not requiredenv- the runtime environmenterrorReporter- the error reported that must be used for reporting any errors or warnings- Returns:
- either a runtime contribution or
IMaestroExpansionPlugin.EmptyRuntimeConfig - Throws:
ExpandException- if expansion fails
-