jni.gui
Class JNICodeGenerator
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
jni.gui.JNICodeGenerator
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class JNICodeGenerator
- extends Attribute
Generate Java Native Interface (JNI) support code and create ports
that correspond with the native method arguments.
- Since:
- Ptolemy II 6.0
- Version:
- $Id: JNICodeGenerator.java,v 1.6 2007/12/07 06:32:12 cxh Exp $
- Author:
- Christopher Brooks
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
JNICodeGenerator
public JNICodeGenerator(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Create a new instance of JNI Generator.
- Parameters:
container - The container.name - The name of the JNI generator.
- Throws:
IllegalActionException - If the super class throws the
exception or error occurs when setting the file path.
NameDuplicationException - If the super class throws the
exception or an error occurs when setting the file path.
generateCode
public int generateCode(java.lang.StringBuffer code)
throws java.lang.Exception
- Generate code and append it to the given string buffer.
Write the code to the directory specified by the codeDirectory
parameter. The file name is a sanitized version of the model
name with a suffix that is based on last package name of the
generatorPackage parameter. Thus if the
codeDirectory is
$HOME, the name of the
model is Foo and the generatorPackage
is ptolemy.codegen.c, then the file that is
written will be $HOME/Foo.c
This method is the main entry point.
- Parameters:
code - The given string buffer.
- Returns:
- The return value of the last subprocess that was executed.
or -1 if no commands were executed.
- Throws:
java.lang.Exception - If there was a problem creating the JNI files.
getExecuteCommands
public static ExecuteCommands getExecuteCommands()
- Get the command executor, which can be either non-graphical
or graphical. The initial default is non-graphical, which
means that stderr and stdout from subcommands is written
to the console.
- Returns:
- executeCommands The subprocess command executor.
- See Also:
setExecuteCommands(ExecuteCommands)
setExecuteCommands
public static void setExecuteCommands(ExecuteCommands executeCommands)
- Set the command executor, which can be either non-graphical
or graphical. The initial default is non-graphical, which
means that stderr and stdout from subcommands is written
to the console.
- Parameters:
executeCommands - The subprocess command executor.- See Also:
getExecuteCommands()
setContainer
public void setContainer(NamedObj container)
throws IllegalActionException,
NameDuplicationException
- Set the container of this object to be the given container.
- Overrides:
setContainer in class Attribute
- Parameters:
container - The given container.
- Throws:
IllegalActionException - If the given container
is not null and not an instance of CompositeEntity.
NameDuplicationException - If there already exists a
container with the same name.- See Also:
Attribute.getContainer()