ptolemy.codegen.c.actor
Class Receiver

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.codegen.kernel.CodeGeneratorHelper
          extended by ptolemy.codegen.c.kernel.CCodeGeneratorHelper
              extended by ptolemy.codegen.c.actor.Receiver
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ActorCodeGenerator, ComponentCodeGenerator, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Direct Known Subclasses:
DEReceiver

public class Receiver
extends CCodeGeneratorHelper

Base class implementation of a ptolemy.actor.Receiver.

Since:
Ptolemy II 8.0
Version:
$Id: Receiver.java 59167 2010-09-21 17:08:02Z cxh $
Author:
Jia Zou, Man-Kit Leung, Isaac Liu
See Also:
Serialized Form
Accepted Rating:
Red (mankit)
Proposed Rating:
Red (mankit)

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
Receiver(Receiver receiver)
          Construct the Receiver helper.
 
Method Summary
 java.lang.String generateCodeForGet(int channel)
          Generate code for getting tokens from the receiver.
 java.lang.String generateCodeForHasToken(int channel)
          Generate code to check if the receiver has a token.
 java.lang.String generateCodeForPut(java.lang.String token)
          Generate code for putting tokens to the receiver.
 Receiver getReceiver()
          Get the corresponding component.
 
Methods inherited from class ptolemy.codegen.c.kernel.CCodeGeneratorHelper
_generateInputVariableDeclaration, _generateOutputVariableDeclaration, _generateReferencedParameterDeclaration, _generateTypeConvertStatement, _generateTypeConvertVariableDeclaration, _getFireFunctionArguments, _replaceMacro, generateVariableDeclaration, getCodeGenerator, getHeaderFiles, getJVMHeaderFiles, getParseTreeCodeGenerator
 
Methods inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper
_createBufferSizeAndOffsetMap, _createInputBufferSizeAndOffsetMap, _findClosedParen, _generateBlockCode, _generateBlockCode, _generateFireCode, _generateTypeConvertMethod, _generateTypeConvertStatements, _getCastType, _getChannelAndOffset, _getHelper, _getHelper, _getIndentPrefix, _getReference, _getReferenceChannels, _getTypeConvertChannels, _getTypeConvertReference, _indexOf, addFunctionUsed, addNewTypeUsed, analyzeTypeConvert, checkLocal, checkRemote, codeGenType, copyFilesToCodeDirectory, createOffsetVariablesIfNeeded, generateChannelOffset, generateFireCode, generateFireFunctionCode, generateFireFunctionCode2, generateInitializeCode, generateModeTransitionCode, generateName, generateOffset, generatePortReference, generatePostfireCode, generatePrefireCode, generatePreinitializeCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, generateVariableInitialization, generateVariableName, generateWrapupCode, getBufferSize, getBufferSize, getComponent, getDefaultBlocks, getDirector, getDirectorHelper, getFunctionInvocation, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getNewInvocation, getObject, getParameterValue, getPort, getRates, getReadOffset, getReference, getReference, getReference, getReference, getSharedCode, 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

Receiver

public Receiver(Receiver receiver)
Construct the Receiver helper.

Parameters:
receiver - The ptolemy.actor.receiver that corresponds with this helper.
Throws:
IllegalActionException - If thrown by the super class.
Method Detail

generateCodeForGet

public java.lang.String generateCodeForGet(int channel)
                                    throws IllegalActionException
Generate code for getting tokens from the receiver.

Parameters:
channel - The channel for which to generate the get code.
Returns:
The code to check if the reciever has a token, in this base class, the empty string is returned.
Throws:
IllegalActionException - Not thrown in this base class.

generateCodeForHasToken

public java.lang.String generateCodeForHasToken(int channel)
                                         throws IllegalActionException
Generate code to check if the receiver has a token.

Parameters:
channel - The channel for which to generate the hasToken() code.
Returns:
The code to check if the reciever has a token, in this case, the String "1" is returned, which indicates that the receiver always has a token.
Throws:
IllegalActionException - Not thrown in this base class.

generateCodeForPut

public java.lang.String generateCodeForPut(java.lang.String token)
                                    throws IllegalActionException
Generate code for putting tokens to the receiver. Note the type conversion is also done in this put method.

Parameters:
token - The token to be sent.
Returns:
The code to put tokens to the receiver, in this case, the empty string is returned.
Throws:
IllegalActionException - Not thrown in this base class.

getReceiver

public Receiver getReceiver()
Get the corresponding component.

Returns:
the component that corresponds with this receiver.