Class CActorBase

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class CActorBase
    extends TypedAtomicActor
    This is a base class for actors that are intended to be used with an instance of GiottoCEmachineFrameworkGenerator, an attribute that is placed in the model and that generates code when the user double clicks on its icon. This class provides a parameter source that is used to identify the C source file that provides the functionality of the actor. The .c file along with the generated code can then be compiled with emachine files for a specific platform to generate an executable that runs on that platform. This actor also has a second parameter frequency that is Giotto specific, and is used to specify the number of times the C task associated with this class is executed in a Giotto iteration (a "super iteration" in Giotto). It works in conjunction with the CActor MoML class, which attaches a tableau factory so that look inside will open the C source file.
    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    N. Vinay Krishnan, Edward A. Lee
    See Also:
    GiottoCEmachineFrameworkGenerator
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (vkris)
    • Field Detail

      • source

        public FileParameter source
        The source code file or URL.
      • frequency

        public Parameter frequency
        The number of times this actor gets executed in one super-period time frame specified by the Giotto director.
    • Constructor Detail

      • CActorBase

        public CActorBase​(Workspace workspace)
        Construct an actor in the specified workspace with an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. The object is added to the workspace directory. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the entity.
    • Method Detail

      • newPort

        public Port newPort​(java.lang.String name)
                     throws NameDuplicationException
        Create a new instance of CPort with the specified name. The container of the port is set to this actor. This method is write-synchronized on the workspace.
        Overrides:
        newPort in class TypedAtomicActor
        Parameters:
        name - The name for the new port.
        Returns:
        The new port.
        Throws:
        NameDuplicationException - If the actor already has a port with the specified name.
        See Also:
        CPort
      • _addPort

        protected void _addPort​(CPort port)
                         throws IllegalActionException,
                                NameDuplicationException
        Override the base class to throw an exception if the added port is not an instance of CPort. This method should not be used directly. Call the setContainer() method of the port instead. This method does not set the container of the port to point to this entity. It assumes that the port is in the same workspace as this actor. Derived classes may override this method to further constrain the port to be a subclass of CPort. This method is not synchronized on the workspace, so the caller should be.
        Parameters:
        port - The port to add to this actor.
        Throws:
        IllegalActionException - If the port is not an instance of CPort, or the port has no name.
        NameDuplicationException - If the port name coincides with the name of another port already in the actor.