Package ptolemy.domains.metroII.kernel
Class MetroIISystemCDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.domains.metroII.kernel.MetroIISystemCDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,GetFirable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class MetroIISystemCDirector extends Director implements GetFirable
MetroIISystemCDirector wraps a Metro-SystemC model as a Metro actor in Ptolemy.- Since:
- Ptolemy II 11.0
- Version:
- $Id: MetroIISystemCDirector.java 67896 2013-11-20 02:27:48Z hudson@moog.eecs.berkeley.edu $
- Author:
- Liangpeng Guo
- Pt.AcceptedRating:
- Red (glp)
- Pt.ProposedRating:
- Red (glp)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description FileParameter
configFileName
The configuration file name of the MetroII SystemC model.Parameter
metroII
The environmental variable METROII.FileParameter
modelFileName
The executable file name of the MetroII SystemC model.Parameter
printDebug
Option parameter whether debug info is printed out.-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
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
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description MetroIISystemCDirector(CompositeEntity container, java.lang.String name)
Constructs a MetroIISystemCDirector with a name and a container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description net.jimblackler.Utils.YieldAdapterIterable<java.lang.Iterable<metroIIcomm.Event.Builder>>
adapter()
Returns the iterator for the caller function of getfire().void
attributeChanged(Attribute attribute)
Override the base class to update local variables.java.lang.Object
clone(Workspace workspace)
Clones the object into the specified workspace.void
getfire(net.jimblackler.Utils.ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler)
Fires the wrapped Metro-SystemC model.void
initialize()
Initializes the pipe connecting to Metro-SystemC.void
pushEvents(java.lang.Iterable<metroIIcomm.Event.Builder> events)
Pushes Metro events into the pipe.void
stop()
Stop firing as soon as possible.void
syncEvents(java.util.LinkedList<metroIIcomm.Event.Builder> events)
Synchronizes the status of events from the pipe.-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fire, fireAt, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, invalidateSchedule, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, newReceiver, notifyTokenSentToCommunicationAspect, postfire, prefire, preinitialize, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stopFire, suggestedModalModelDirectors, supportMultirateFiring, suspend, terminate, transferInputs, transferOutputs, transferOutputs, wrapup
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, 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
-
-
-
-
Field Detail
-
metroII
public Parameter metroII
The environmental variable METROII.
-
modelFileName
public FileParameter modelFileName
The executable file name of the MetroII SystemC model.
-
configFileName
public FileParameter configFileName
The configuration file name of the MetroII SystemC model.
-
printDebug
public Parameter printDebug
Option parameter whether debug info is printed out.
-
-
Constructor Detail
-
MetroIISystemCDirector
public MetroIISystemCDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Constructs a MetroIISystemCDirector with a name and a container. The container argument must not be null, or a NullPointerException will be thrown.- Parameters:
container
- The container.name
- The name of this actor.- Throws:
IllegalActionException
- If the container is incompatible with this actor.NameDuplicationException
- If the name coincides with an actor already in the container.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
Description copied from class:Director
Override the base class to update local variables.- Overrides:
attributeChanged
in classDirector
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If timeResolution is being changed and the model is executing (and not in preinitialize()).
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clones the object into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there).- Overrides:
clone
in classDirector
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- The new Attribute.
- Throws:
java.lang.CloneNotSupportedException
- Not thrown in this base class- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
pushEvents
public void pushEvents(java.lang.Iterable<metroIIcomm.Event.Builder> events) throws IllegalActionException
Pushes Metro events into the pipe.- Parameters:
events
- the events to be added into the pipe.- Throws:
IllegalActionException
-
syncEvents
public void syncEvents(java.util.LinkedList<metroIIcomm.Event.Builder> events) throws IllegalActionException
Synchronizes the status of events from the pipe.- Parameters:
events
- the events to be synchronized from the pipe.- Throws:
IllegalActionException
- If the pipe file cannot be found or written.
-
getfire
public void getfire(net.jimblackler.Utils.ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler) throws net.jimblackler.Utils.CollectionAbortedException, IllegalActionException
Fires the wrapped Metro-SystemC model.- Specified by:
getfire
in interfaceGetFirable
- Parameters:
resultHandler
- iterable of events 'yield returned'.- Throws:
net.jimblackler.Utils.CollectionAbortedException
IllegalActionException
-
adapter
public net.jimblackler.Utils.YieldAdapterIterable<java.lang.Iterable<metroIIcomm.Event.Builder>> adapter()
Returns the iterator for the caller function of getfire().- Specified by:
adapter
in interfaceGetFirable
- Returns:
- iterator the iterator for the caller function of getfire().
-
initialize
public void initialize() throws IllegalActionException
Initializes the pipe connecting to Metro-SystemC.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classDirector
- Throws:
IllegalActionException
- If the initialize() method of one of the associated actors throws it.
-
stop
public void stop()
Stop firing as soon as possible. IMPORTANT: stop() can only be called after getfire() returns.- Specified by:
stop
in interfaceExecutable
- Overrides:
stop
in classDirector
-
-