public class EmbeddedCodeActor extends CompiledCompositeActor
To use this actor within Vergil, double click on the actor and insert Java code into the code templates, as indicated by the sample template. Normally you will also need to add ports to the actor. You may need to set the types of these ports as well.
This actor is actually a composite actor that contains a single embedded actor that actually executes the generated code. The reason for the extra level of hierarchy is so that the director adapter code that handles conversion and transport across the boundary can be consolidated in one place. In its preinitialize() method, this actor will create an instance of whatever director is in charge of executing it. The presumption is that that director has a code generation adapter that knows how to transport data from the simulation world in Java to the generated code world within.
Modifier and Type | Class and Description |
---|---|
static class |
EmbeddedCodeActor.EmbeddedActor
An actor inside the embeddedJavaActor that is used as a dummy
placeholder.
|
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected EmbeddedCodeActor.EmbeddedActor |
_embeddedActor
The embedded actor used to contain the ports to the C
implementation.
|
StringAttribute |
embeddedCode
The Java code that specifies the function of this actor.
|
codeDirectory, executeEmbeddedCode, generatorPackage, inline, overwriteFiles
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
_levelCrossingLinks
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
EmbeddedCodeActor(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
_getFileDependencies()
Get the fileDependencies part of the generated code.
|
protected java.lang.String |
_getFireBlock()
Get the fireBlock part of the generated code.
|
protected java.lang.String |
_getInitBlock()
Get the initBlock part of the generated code.
|
protected java.lang.String |
_getPreinitBlock()
Get the preinitBlock part of the generated code.
|
protected java.lang.String |
_getWrapupBlock()
Get the wrapupBlock part of the generated code.
|
void |
preinitialize()
Create the embedded actor and add ports to it.
|
protected void |
setEmbeddedActor()
Create a new instance instance of EmbeddedActor.
|
void |
wrapup()
Remove inside relations.
|
_compileJNICode, _generateAndCompileEmbeddedCode, _generateAndCompileJNICode, _transferOutputs, fire, getSanitizedName, initialize
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeChanged, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, 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, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public StringAttribute embeddedCode
protected EmbeddedCodeActor.EmbeddedActor _embeddedActor
public EmbeddedCodeActor(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.NameDuplicationException
- If the container already
has an actor with this name.IllegalActionException
- If the actor cannot be contained
by the proposed container.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class CompositeActor
IllegalActionException
- If there is no director, or if
the director's preinitialize() method throws it, or if this actor
is not opaque.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class CompiledCompositeActor
IllegalActionException
- If there is no director,
or if the director's wrapup() method throws it, or if this
actor is not opaque.protected void setEmbeddedActor() throws IllegalActionException, NameDuplicationException
NameDuplicationException
- If the container already
has an actor with this name.IllegalActionException
- If the actor cannot be contained
by the proposed container.protected java.lang.String _getFileDependencies()
protected java.lang.String _getFireBlock()
protected java.lang.String _getInitBlock()
protected java.lang.String _getPreinitBlock()
protected java.lang.String _getWrapupBlock()