ptolemy.domains.giotto.kernel
Class GiottoCodeGenerator

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.domains.giotto.kernel.GiottoCodeGenerator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class GiottoCodeGenerator
extends Attribute

This attribute is a visible attribute that when configured (by double clicking on it or by invoking Configure in the context menu) it generates Giotto code and displays it a text editor. It is up to the user to save the Giotto code in an appropriate file, if necessary.

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 :

  1. Removal of its mention in the output drivers
  2. Removal of its mention in task (...) output (...)
  3. Removal of driver code for tasks without inputs

Since:
Ptolemy II 2.0
Version:
$Id: GiottoCodeGenerator.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee, Steve Neuendorffer, Haiyang Zheng, Christopher Brooks
See Also:
Serialized Form
Accepted Rating:
Red (johnr)
Proposed Rating:
Red (eal)

Nested Class Summary
protected  class GiottoCodeGenerator.GiottoEditorFactory
          An attribute that can create an Giotto code editor for a Giotto model.
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
GiottoCodeGenerator()
          Construct a factory with the default workspace and "" as name.
GiottoCodeGenerator(NamedObj container, java.lang.String name)
          Construct a factory with the specified container and name.
 
Method Summary
private  void _init()
           
protected  void _instantiateEditorFactoryClass()
          Method to instantiate the Editor Factory class called from the constructor.
 java.lang.String generateGiottoCode(TypedCompositeActor model)
          Generate Giotto code for the given Giotto model.
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, 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, _recordDecoratedAttributes, _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, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, 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
 

Constructor Detail

GiottoCodeGenerator

public GiottoCodeGenerator()
                    throws IllegalActionException,
                           NameDuplicationException
Construct a factory with the default workspace and "" as name.

Throws:
IllegalActionException - If the factory is not of an acceptable attribute for the container.
NameDuplicationException - If the name coincides with an attribute already in the container.

GiottoCodeGenerator

public GiottoCodeGenerator(NamedObj container,
                           java.lang.String name)
                    throws IllegalActionException,
                           NameDuplicationException
Construct a factory with the specified container and name.

Parameters:
container - The container.
name - The name of the factory.
Throws:
IllegalActionException - If the factory is not of an acceptable attribute for the container.
NameDuplicationException - If the name coincides with an attribute already in the container.
Method Detail

generateGiottoCode

public java.lang.String generateGiottoCode(TypedCompositeActor model)
                                    throws IllegalActionException
Generate Giotto code for the given Giotto model.

Parameters:
model - The given Giotto model.
Returns:
The Giotto code.
Throws:
IllegalActionException - If code can not be generated.

_instantiateEditorFactoryClass

protected void _instantiateEditorFactoryClass()
                                       throws IllegalActionException,
                                              NameDuplicationException
Method to instantiate the Editor Factory class called from the constructor. The reason for having this is that it can be overridden by subclasses

Throws:
IllegalActionException - If the editor factory can not be created.
NameDuplicationException - If there is already another editor factory with the same name.

_init

private void _init()
            throws IllegalActionException,
                   NameDuplicationException
Throws:
IllegalActionException
NameDuplicationException