Package org.hlacerti.lib
Class HlaPublisher
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,HlaUpdatable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class HlaPublisher extends TypedAtomicActor implements HlaUpdatable
This actor provides updates to shared objects in an HLA (High Level Architecture) federation. The shared objects are are instances of classes defined in a FED file (Federation Execution Data). Each class has attributes, and this actor sends updates to an attribute of an instance of a class when it receives data on its input. If there are instances ofHlaSubscriber
that refer to the same attribute of the same instance, then those will be notified of the update. The HlaSubscriber will produce an output event with the same data and a time stamp that depends on the time management parameters of theHlaManager
. This actor requires that there be an instance ofHlaManager
in the same model. That instance references the FED file that is required to define the class referred to in this HlaPublisher, and that class is required to have an attribute with a name matching the name given here. The name of the instance is arbitrary. If an instance with the specified name does not already exist, it will be created during initialization of the model. If two instances of this HlaPublisher actor refer to the same instance name, then they will send updates to the same HLA instance, but they are required to update distinct attributes of that instance. During initialization, the HlaManager will notify the RTI (Run Time Infrastructure) of the intent to update this particular attribute of this particular instance of the class. This actor throws an exception if the attribute name or the class name or the instance name is empty. An exception is also thrown if the class name or the attribute name is not defined in the FED file.- Since:
- Ptolemy II 11.0
- Version:
- $Id: HlaPublisher.java 214 2018-04-01 13:32:02Z j.cardoso $
- Author:
- Gilles Lasnier, Contributors: Patricia Derler, David Come
- Pt.AcceptedRating:
- Red (glasnier)
- Pt.ProposedRating:
- Yellow (glasnier)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
attributeName
The HLA attribute name the HLASubscriber is mapped to.Parameter
classInstanceName
The name of the HLA class instance for this HlaSubscriber.Parameter
classObjectName
The object class of the HLA attribute to publish.TypedIOPort
input
The input port.Parameter
useCertiMessageBuffer
Indicate if the event is wrapped in a CERTI message buffer.-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
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 HlaPublisher(CompositeEntity container, java.lang.String name)
Construct the HlaPublisher actor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attributeChanged(Attribute attribute)
Call the attributeChanged method of the parent.java.lang.Object
clone(Workspace workspace)
Clone the actor into the specified workspace.void
fire()
All tokens, received in the input port, are transmitted to theHlaManager
for a publication to the HLA/CERTI Federation.java.lang.String
getHlaAttributeName()
Return the HLA attribute name indicated in the HlaPublisher actor that will be used by HLA services (publish and update).java.lang.String
getHlaClassName()
Return the HLA class object name indicated in the HlaPublisher actor.java.lang.String
getHlaInstanceName()
Return the name of the HLA class instance indicated in the HlaPublisher actor that will be used by HLA services (register and update).TypedIOPort
getInputPort()
FIXME: This should probably not be here.void
initialize()
Retrieve and check if there is one and only oneHlaManager
deployed in the Ptolemy model.boolean
useCertiMessageBuffer()
Indicate if the HLA publisher actor uses the CERTI message buffer API.-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, 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, requestChange, 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.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
attributeName
public Parameter attributeName
The HLA attribute name the HLASubscriber is mapped to.
-
classObjectName
public Parameter classObjectName
The object class of the HLA attribute to publish.
-
classInstanceName
public Parameter classInstanceName
The name of the HLA class instance for this HlaSubscriber.
-
input
public TypedIOPort input
The input port.
-
useCertiMessageBuffer
public Parameter useCertiMessageBuffer
Indicate if the event is wrapped in a CERTI message buffer.
-
-
Constructor Detail
-
HlaPublisher
public HlaPublisher(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct the HlaPublisher actor.- Parameters:
container
- The container.name
- The name of this actor.- Throws:
IllegalActionException
- If the entity cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
Call the attributeChanged method of the parent. Check if the user has set all information related to HLA to publish.- Overrides:
attributeChanged
in classNamedObj
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If one of the parameters is empty.
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the actor into the specified workspace.- Overrides:
clone
in classTypedAtomicActor
- Parameters:
workspace
- The workspace for the new object.- Returns:
- A new actor.
- Throws:
java.lang.CloneNotSupportedException
- If a derived class contains an attribute that cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
initialize
public void initialize() throws IllegalActionException
Retrieve and check if there is one and only oneHlaManager
deployed in the Ptolemy model. TheHlaManager
provides the method to publish the attributes of a class, register an instance of a class and update the value of a HLA attribute of a class instance to the HLA/CERTI Federation.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If there is zero or more than oneHlaManager
per Ptolemy model.
-
fire
public void fire() throws IllegalActionException
All tokens, received in the input port, are transmitted to theHlaManager
for a publication to the HLA/CERTI Federation.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class.
-
getHlaAttributeName
public java.lang.String getHlaAttributeName() throws IllegalActionException
Return the HLA attribute name indicated in the HlaPublisher actor that will be used by HLA services (publish and update). The attribute must be defined in the FED file. It belongs to the class classObjectName.- Specified by:
getHlaAttributeName
in interfaceHlaUpdatable
- Returns:
- the HLA Attribute name.
- Throws:
IllegalActionException
- if a bad token string value is provided
-
getHlaInstanceName
public java.lang.String getHlaInstanceName() throws IllegalActionException
Return the name of the HLA class instance indicated in the HlaPublisher actor that will be used by HLA services (register and update). It is chosen by the user.- Specified by:
getHlaInstanceName
in interfaceHlaUpdatable
- Returns:
- the HLA class instance name.
- Throws:
IllegalActionException
- if a bad token string value is provided.
-
getHlaClassName
public java.lang.String getHlaClassName() throws IllegalActionException
Return the HLA class object name indicated in the HlaPublisher actor. The class must be defined in the FED file and has the attribute attributeName.- Specified by:
getHlaClassName
in interfaceHlaUpdatable
- Returns:
- the HLA object class name.
- Throws:
IllegalActionException
- if a bad token string value is provided.
-
getInputPort
public TypedIOPort getInputPort()
FIXME: This should probably not be here. See HlaManager.- Specified by:
getInputPort
in interfaceHlaUpdatable
-
useCertiMessageBuffer
public boolean useCertiMessageBuffer()
Indicate if the HLA publisher actor uses the CERTI message buffer API.- Specified by:
useCertiMessageBuffer
in interfaceHlaUpdatable
- Returns:
- true if the HLA publisher actor uses the CERTI message and false if it doesn't.
-
-