public class TDLCodeGeneratorUtilities
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
protected static void |
_actuatorCode(java.lang.StringBuffer sb,
TDLModule module)
Generate code for the actuator.
|
protected static java.lang.String |
_getTypeString(IOPort port)
Get the datatype of a port.
|
protected static void |
_headerCode(java.lang.StringBuffer sb,
TypedCompositeActor model)
Generate header code for the file.
|
protected static boolean |
_initialize(TypedCompositeActor model)
Initialize the code generation process by checking whether the given
model is a TDL model.
|
protected static void |
_modeCode(java.lang.StringBuffer sb,
State state,
TDLModule module)
Generate code for the modes.
|
protected static void |
_sensorCode(java.lang.StringBuffer sb,
TDLModule module)
Generate code for the sensors.
|
protected static void |
_tasksCode(java.lang.StringBuffer sb,
TDLModule module)
Generate code for the tasks.
|
static void |
checkTDLID(java.lang.String string)
Throw an exception if the given string is a valid TDL reserved word,
which prevents it from being used as an identifier.
|
static java.lang.String |
generateTDLCode(TypedCompositeActor model)
Generate TDL code for the given TDL model.
|
static void |
main(java.lang.String[] args)
Create an instance of a model and generate TDL code for it The TDL
code is printed on standard out.
|
static boolean |
needsInputDriver(Actor actor)
Return true if the given actor has at least one connected input port,
which requires it to have an input driver.
|
public static void checkTDLID(java.lang.String string)
throws IllegalActionException
string - A string to be used in TDL program.IllegalActionException - If the string can not be used.public static java.lang.String generateTDLCode(TypedCompositeActor model) throws IllegalActionException
model - The given TDL model.IllegalActionException - If code can not be generated.public static void main(java.lang.String[] args)
throws java.lang.Throwable
args - The command-line arguments naming the .xml or .moml file to
runjava.lang.Throwable - If there is a problem reading the model or generating
code.public static boolean needsInputDriver(Actor actor) throws IllegalActionException
actor - The actor to test.IllegalActionExceptionprotected static void _actuatorCode(java.lang.StringBuffer sb,
TDLModule module)
throws IllegalActionException
sb - Buffer used store the parts of the generated code.module - The module.IllegalActionException - If there is a problem
accessing the ports.protected static java.lang.String _getTypeString(IOPort port) throws IllegalActionException
port - An IO port.IllegalActionExceptionprotected static void _headerCode(java.lang.StringBuffer sb,
TypedCompositeActor model)
throws IllegalActionException
sb - Buffer used store the parts of the generated code.model - The modelIllegalActionException - If there is a problem
getting the model name.protected static boolean _initialize(TypedCompositeActor model)
model - A model to generate TDL code from.protected static void _modeCode(java.lang.StringBuffer sb,
State state,
TDLModule module)
throws IllegalActionException
sb - Buffer used store the parts of the generated code.state - The statemodule - The moduleIllegalActionException - If there is a problem
getting the director or accessing the ports.protected static void _sensorCode(java.lang.StringBuffer sb,
TDLModule module)
throws IllegalActionException
sb - Buffer used store the parts of the generated code.module - The model from which we generate code.IllegalActionException - If there is a problem
iterating over the actors.protected static void _tasksCode(java.lang.StringBuffer sb,
TDLModule module)
throws IllegalActionException
sb - Buffer used store the parts of the generated code.module - The model from which we generate code.IllegalActionException - If there is a problem iterating over the actors.