|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.domains.tdl.kernel.TDLCodeGeneratorUtilities
public class TDLCodeGeneratorUtilities
Utilities for generating TDL code.
Field Summary | |
---|---|
private static java.util.List |
_modules
All TDL modules in the model. |
private static java.util.Set |
_portsConnectedToModuleOutputPorts
Input ports of a module that are connected to another TDL module's output ports. |
Constructor Summary | |
---|---|
private |
TDLCodeGeneratorUtilities()
Instances of this class cannot be created. |
Method Summary | |
---|---|
protected static void |
_actuatorCode(java.lang.StringBuffer sb,
TDLModule module)
Generate code for the actuator. |
private static java.util.List |
_getModes(TDLModule module)
Get all modes of a module. |
private static void |
_getModules(TypedCompositeActor model)
Add all modules to the global list of modules. |
private static java.lang.String |
_getRefinementPortParameter(IOPort port,
java.lang.String paramName)
for whatever reason, the parameter specified at the modalport is not stored there but at the refinement port one level inside modalport.insideReceivers[0][0].getParameter("getter") returns the correct value. |
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. |
private static java.lang.StringBuffer |
_portList(java.lang.StringBuffer sb,
Actor actor,
java.lang.String type)
Generate code for the ports. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.util.List _modules
private static java.util.Set _portsConnectedToModuleOutputPorts
Constructor Detail |
---|
private TDLCodeGeneratorUtilities()
Method Detail |
---|
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
run
java.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.
IllegalActionException
protected 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.
IllegalActionException
protected static void _headerCode(java.lang.StringBuffer sb, TypedCompositeActor model) throws IllegalActionException
sb
- Buffer used store the parts of the generated code.model
- The model
IllegalActionException
- 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 module
IllegalActionException
- 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.private static java.lang.String _getRefinementPortParameter(IOPort port, java.lang.String paramName)
port
- refinement port.
private static java.lang.StringBuffer _portList(java.lang.StringBuffer sb, Actor actor, java.lang.String type) throws IllegalActionException
sb
- Buffer used store the parts of the generated code.actor
- Actor containing the ports that code should be generated for.type
- Input or output port.
IllegalActionException
- Thrown if port type could not be defined.private static void _getModules(TypedCompositeActor model)
model
- Model containing TDL modules.private static java.util.List _getModes(TDLModule module) throws IllegalActionException
module
- TDL module.
IllegalActionException
- if controller of module could not be retrieved.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |