ptolemy.actor.lib.jni
Class EmbeddedCFileActor

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.kernel.CompositeEntity
                      extended by ptolemy.actor.CompositeActor
                          extended by ptolemy.actor.TypedCompositeActor
                              extended by ptolemy.actor.lib.jni.CompiledCompositeActor
                                  extended by ptolemy.actor.lib.jni.EmbeddedCActor
                                      extended by ptolemy.actor.lib.jni.EmbeddedCFileActor
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class EmbeddedCFileActor
extends EmbeddedCActor

The embeddedCFileActor executes compiled embedded C Code.

This actor extends the EmbeddedCActor and has most of the same functionality. The only difference is that a file specifying the C code can be passed into the actor as a parameter to avoid having multiple instances of the same code in different copies of the EmbeddedCActor.

Since:
Ptolemy II 8.0
Version:
$Id: EmbeddedCFileActor.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Christine Avanessians, Edward Lee, and Man-Kit Leung
See Also:
Serialized Form
Accepted Rating:
Red (cavaness)
Proposed Rating:
Red (cavaness)

Nested Class Summary
static class EmbeddedCFileActor.EmbeddedFileActor
          An actor inside the EmbeddedCFileActor that is used as a dummy placeholder.
 
Nested classes/interfaces inherited from class ptolemy.actor.lib.jni.EmbeddedCActor
EmbeddedCActor.EmbeddedActor
 
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
 FileParameter codeBlockFile
          The file parameter that specifies the file that contains the C Code that this actor should use during execution and/or code generation.
 
Fields inherited from class ptolemy.actor.lib.jni.EmbeddedCActor
_embeddedActor, embeddedCCode
 
Fields inherited from class ptolemy.actor.lib.jni.CompiledCompositeActor
codeDirectory, generatorPackage, inline, invokeJNI, overwriteFiles
 
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _initializables, _notifyingActorFiring, _publishedPorts, _publisherRelations, _stopRequested
 
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
EmbeddedCFileActor(CompositeEntity container, java.lang.String name)
          Construct an actor with the given container and name.
 
Method Summary
protected  void _generateAndCompileCCode()
          Generate and compile the code.
 void changeEmbeddedCCode()
          Set the embeddedCCode parameter in the EmbeddedCActor to contain the contents of the file specifed by codeBlockFile.
protected  void setEmbeddedActor()
          Create a new instance of EmbeddedFileActor and set _embeddedActor in the embeddedCActor.
 
Methods inherited from class ptolemy.actor.lib.jni.EmbeddedCActor
_getFileDependencies, _getFireBlock, _getInitBlock, _getPreinitBlock, _getWrapupBlock, preinitialize, wrapup
 
Methods inherited from class ptolemy.actor.lib.jni.CompiledCompositeActor
_compileJavaCode, _generateAndCompileJavaCode, fire, getSanitizedName, initialize
 
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _getPublishedPort, _setDirector, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inferringWidths, inferWidths, inputPortList, isFireFunctional, isOpaque, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, recordFiring, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _deepOpaqueEntityList, _description, _exportMoMLContents, _recordDecoratedAttributes, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allCompositeEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, removeInitializable
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 

Field Detail

codeBlockFile

public FileParameter codeBlockFile
The file parameter that specifies the file that contains the C Code that this actor should use during execution and/or code generation.

Constructor Detail

EmbeddedCFileActor

public EmbeddedCFileActor(CompositeEntity container,
                          java.lang.String name)
                   throws NameDuplicationException,
                          IllegalActionException
Construct an actor with the given container and name. Invoke the super class constructor and create the codeBlockFile file parameter and initialize it to the empty string.

Parameters:
container - The container.
name - The name of this actor.
Throws:
NameDuplicationException - If the container already has an actor with this name.
IllegalActionException - If the actor cannot be contained by the proposed container.
Method Detail

changeEmbeddedCCode

public void changeEmbeddedCCode()
                         throws IllegalActionException
Set the embeddedCCode parameter in the EmbeddedCActor to contain the contents of the file specifed by codeBlockFile.

Throws:
IllegalActionException - If there is a problem reading the code block file.

_generateAndCompileCCode

protected void _generateAndCompileCCode()
                                 throws IllegalActionException
Generate and compile the code. This method calls changeEmbeddedCCode() and then generates adn compiles the code.

Overrides:
_generateAndCompileCCode in class CompiledCompositeActor
Throws:
IllegalActionException - If the helper class cannot be found, or if the static generateCode(TypedCompositeActor) method in the helper class cannot be found or invoked.

setEmbeddedActor

protected void setEmbeddedActor()
                         throws IllegalActionException,
                                NameDuplicationException
Create a new instance of EmbeddedFileActor and set _embeddedActor in the embeddedCActor.

Overrides:
setEmbeddedActor in class EmbeddedCActor
Throws:
NameDuplicationException - If the container already has an actor with this name.
IllegalActionException - If the actor cannot be contained by the proposed container.