|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.domains.giotto.kernel.GiottoCodeGeneratorUtilities
public class GiottoCodeGeneratorUtilities
Utilities for generating Giotto code.
The Giotto Code Generator has been changed from the earlier generator implemented by Haiyang and Steve in the following respect :-
Any and all unconnected ports are ignored. This includes :
This class is separate from GiottoCodeGenerator so that we can easily generate Giotto code without using a UI.
Red (johnr) |
Red (eal) |
Constructor Summary | |
---|---|
private |
GiottoCodeGeneratorUtilities()
Instances of this class cannot be created. |
Method Summary | |
---|---|
protected static java.lang.String |
_actuatorCode(TypedCompositeActor model)
Generate code for the actuator. |
protected static java.lang.String |
_driverCode(TypedCompositeActor model,
Actor actor)
Generate code for the driver. |
protected static java.lang.String |
_driversCode(TypedCompositeActor model)
Generate code for the drivers. |
protected static java.lang.String |
_getTypeString(TypedIOPort port)
Return the correct Giotto type string for the given port. |
protected static java.lang.String |
_headerCode(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 Giotto model. |
protected static java.lang.String |
_modeCode(TypedCompositeActor model)
Generate code for the modes. |
protected static java.lang.String |
_outputCode(TypedCompositeActor model)
Generate code for the output ports. |
protected static java.lang.String |
_sensorCode(TypedCompositeActor model)
Generate code for the sensors. |
protected static java.lang.String |
_taskCode(TypedCompositeActor model,
Actor actor)
Generate code for the task. |
protected static java.lang.String |
_tasksCode(TypedCompositeActor model)
Generate code for the tasks. |
static void |
checkGiottoID(java.lang.String string)
Throw an exception if the given string is a valid giotto reserved word, which prevents it from being used as an identifier. |
static java.lang.String |
generateGiottoCode(TypedCompositeActor model)
Generate Giotto code for the given Giotto model. |
static void |
main(java.lang.String[] args)
Create an instance of a model and generate Giotto code for it The Giotto 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 |
Constructor Detail |
---|
private GiottoCodeGeneratorUtilities()
Method Detail |
---|
public static void checkGiottoID(java.lang.String string) throws IllegalActionException
string
- A string to be used in Giotto program.
IllegalActionException
- If the string can not be used.public static java.lang.String generateGiottoCode(TypedCompositeActor model) throws IllegalActionException
model
- The given Giotto 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 java.lang.String _actuatorCode(TypedCompositeActor model) throws IllegalActionException
model
- The model.
IllegalActionException
- If there is a problem accessing
the ports.protected static java.lang.String _driverCode(TypedCompositeActor model, Actor actor) throws IllegalActionException
model
- The given model.actor
- The given actor.
IllegalActionException
- If there is a problem accessing
the ports.protected static java.lang.String _driversCode(TypedCompositeActor model) throws IllegalActionException
model
- The model.
IllegalActionException
- If there is a problem accessing
the ports.protected static java.lang.String _getTypeString(TypedIOPort port)
port
- An IO port.
protected static java.lang.String _headerCode(TypedCompositeActor model) throws IllegalActionException
model
- The model.
IllegalActionException
- If there is a problem
getting the model name.protected static boolean _initialize(TypedCompositeActor model)
model
- A model to generate Giotto code from.
protected static java.lang.String _modeCode(TypedCompositeActor model) throws IllegalActionException
model
- The model.
IllegalActionException
- If there is a problem
getting the director or accessing the ports.protected static java.lang.String _outputCode(TypedCompositeActor model) throws IllegalActionException
model
- The model.
IllegalActionException
- If there is a problem
accessing the ports.protected static java.lang.String _sensorCode(TypedCompositeActor model) throws IllegalActionException
model
- The model from which we generate code.
IllegalActionException
- If there is a problem iterating
over the actors.protected static java.lang.String _taskCode(TypedCompositeActor model, Actor actor) throws IllegalActionException
model
- The model from which we generate code.actor
- The actor we are generating code for.
IllegalActionException
- If there is a problem iterating
over the ports of the actorprotected static java.lang.String _tasksCode(TypedCompositeActor model) throws IllegalActionException
model
- The model from which we generate code.
IllegalActionException
- If there is a problem iterating
over the actors.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |