Package ptolemy.domains.giotto.kernel
Class GiottoCodeGenerator
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.domains.giotto.kernel.GiottoCodeGenerator
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
GiottoCEmachineFrameworkGenerator
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 :
- Removal of its mention in the output drivers
- Removal of its mention in task (...) output (...)
- Removal of driver code for tasks without inputs
- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Steve Neuendorffer, Haiyang Zheng, Christopher Brooks
- Pt.AcceptedRating:
- Red (johnr)
- Pt.ProposedRating:
- Red (eal)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
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.
-
-