ptolemy.codegen.actor
Class TypedCompositeActor

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.codegen.kernel.CodeGeneratorHelper
          extended by ptolemy.codegen.actor.TypedCompositeActor
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ActorCodeGenerator, ComponentCodeGenerator, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class TypedCompositeActor
extends CodeGeneratorHelper

Code generator helper for typed composite actor.

Since:
Ptolemy II 8.0
Version:
$Id: TypedCompositeActor.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Man-Kit Leung
See Also:
Serialized Form
Accepted Rating:
Red (zgang)
Proposed Rating:
Yellow (cxh)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper
CodeGeneratorHelper.Channel, CodeGeneratorHelper.VariableScope
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper
_codeGenerator, _codeStream, _eol, _INDENT1, _INDENT2, _parseTreeCodeGenerator, _portConversions, _referencedParameters
 
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
TypedCompositeActor(TypedCompositeActor component)
          Construct the code generator helper associated with the given TypedCompositeActor.
 
Method Summary
protected  java.lang.String _generateFireCode()
          Generate the fire code.
 java.lang.String generateInitializeCode()
          Generate the initialize code.
 java.lang.String generatePreinitializeCode()
          Generate the preinitialize code.
 java.lang.String generateWrapupCode()
          Generate the wrapup code.
 java.util.Set getSharedCode()
          Generate the shared code.
 
Methods inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper
_createBufferSizeAndOffsetMap, _createInputBufferSizeAndOffsetMap, _findClosedParen, _generateBlockCode, _generateBlockCode, _generateTypeConvertMethod, _generateTypeConvertStatement, _generateTypeConvertStatements, _getCastType, _getChannelAndOffset, _getFireFunctionArguments, _getHelper, _getHelper, _getIndentPrefix, _getReference, _getReferenceChannels, _getTypeConvertChannels, _getTypeConvertReference, _indexOf, _replaceMacro, addFunctionUsed, addNewTypeUsed, analyzeTypeConvert, checkLocal, checkRemote, codeGenType, copyFilesToCodeDirectory, createOffsetVariablesIfNeeded, generateChannelOffset, generateFireCode, generateFireFunctionCode, generateFireFunctionCode2, generateModeTransitionCode, generateName, generateOffset, generatePortReference, generatePostfireCode, generatePrefireCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, generateVariableDeclaration, generateVariableInitialization, generateVariableName, getBufferSize, getBufferSize, getCodeGenerator, getComponent, getDefaultBlocks, getDirector, getDirectorHelper, getFunctionInvocation, getHeaderFiles, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getNewInvocation, getObject, getParameterValue, getParseTreeCodeGenerator, getPort, getRates, getReadOffset, getReference, getReference, getReference, getReference, getSinkChannels, getSize, getSourceChannel, getWCET, getWriteOffset, isPrimitive, isPrimitive, parseList, processCode, resetInputPortsOffset, setBufferSize, setCodeGenerator, setReadOffset, setWriteOffset, targetType, toString
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getContainedObject, _isMoMLSuppressed, _markContentsDerived, _propagateExistence, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getContainer, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TypedCompositeActor

public TypedCompositeActor(TypedCompositeActor component)
Construct the code generator helper associated with the given TypedCompositeActor.

Parameters:
component - The associated component.
Method Detail

_generateFireCode

protected java.lang.String _generateFireCode()
                                      throws IllegalActionException
Description copied from class: CodeGeneratorHelper
Generate the fire code. This method is intended to be overwritten by sub-classes to generate actor-specific code.

Overrides:
_generateFireCode in class CodeGeneratorHelper
Returns:
The generated code.
Throws:
IllegalActionException - Not thrown in this base class.

generatePreinitializeCode

public java.lang.String generatePreinitializeCode()
                                           throws IllegalActionException
Description copied from class: CodeGeneratorHelper
Generate the preinitialize code. In this base class, return an empty string. This method generally does not generate any execution code and returns an empty string. Subclasses may generate code for variable declaration, defining constants, etc.

Specified by:
generatePreinitializeCode in interface ActorCodeGenerator
Overrides:
generatePreinitializeCode in class CodeGeneratorHelper
Returns:
A string of the preinitialize code for the helper.
Throws:
IllegalActionException - Not thrown in this base class.

generateInitializeCode

public java.lang.String generateInitializeCode()
                                        throws IllegalActionException
Description copied from class: CodeGeneratorHelper
Generate the initialize code. In this base class, return empty string. Subclasses may extend this method to generate initialize code of the associated component and append the code to the given string buffer.

Specified by:
generateInitializeCode in interface ComponentCodeGenerator
Overrides:
generateInitializeCode in class CodeGeneratorHelper
Returns:
The initialize code of the containing composite actor.
Throws:
IllegalActionException - If thrown while appending to the the block or processing the macros.

generateWrapupCode

public java.lang.String generateWrapupCode()
                                    throws IllegalActionException
Description copied from class: CodeGeneratorHelper
Generate the wrapup code. In this base class, do nothing. Subclasses may extend this method to generate the wrapup code of the associated component and append the code to the given string buffer.

Specified by:
generateWrapupCode in interface ComponentCodeGenerator
Overrides:
generateWrapupCode in class CodeGeneratorHelper
Returns:
The generated wrapup code.
Throws:
IllegalActionException - If thrown while appending to the the block or processing the macros.

getSharedCode

public java.util.Set getSharedCode()
                            throws IllegalActionException
Description copied from class: CodeGeneratorHelper
Generate the shared code. This is the first generate method invoked out of all, so any initialization of variables of this helper should be done in this method. In this base class, return an empty set. Subclasses may generate code for variable declaration, defining constants, etc.

Specified by:
getSharedCode in interface ActorCodeGenerator
Overrides:
getSharedCode in class CodeGeneratorHelper
Returns:
An empty set in this base class.
Throws:
IllegalActionException - Not thrown in this base class.