Class TypedCompositeActor

    • Constructor Detail

      • TypedCompositeActor

        public TypedCompositeActor​(TypedCompositeActor component)
        Construct the code generator adapter associated with the given TypedCompositeActor.
        Parameters:
        component - The associated component.
    • Method Detail

      • generateInitializeCode

        public java.lang.String generateInitializeCode()
                                                throws IllegalActionException
        Generate the initialize code of the associated composite actor. It first resets the read and write offset of all input ports of all contained actors and all output ports. It then gets the result of generateInitializeCode() method of the local director adapter.
        Overrides:
        generateInitializeCode in class TypedCompositeActor
        Returns:
        The initialize code of the associated composite actor.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating initialize code for the actor or while resetting read and write offset.
      • generateModeTransitionCode

        public void generateModeTransitionCode​(java.lang.StringBuffer code)
                                        throws IllegalActionException
        Generate mode transition code. It delegates to the director adapter of the local director. The mode transition code generated in this method is executed after each global iteration, e.g., in HDF model.
        Overrides:
        generateModeTransitionCode in class NamedProgramCodeGeneratorAdapter
        Parameters:
        code - The string buffer that the generated code is appended to.
        Throws:
        IllegalActionException - If the director adapter throws it while generating mode transition code.
      • generatePostfireCode

        public java.lang.String generatePostfireCode()
                                              throws IllegalActionException
        Generate the postfire code of the associated composite actor. It returns the result of generatePostfireCode() method of the local director adapter.
        Overrides:
        generatePostfireCode in class NamedProgramCodeGeneratorAdapter
        Returns:
        The postfire code of the associated composite actor.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating postfire code for the actor.
      • generateWrapupCode

        public java.lang.String generateWrapupCode()
                                            throws IllegalActionException
        Generate the wrapup code of the associated composite actor. It returns the result of generateWrapupCode() method of the local director adapter.
        Overrides:
        generateWrapupCode in class TypedCompositeActor
        Returns:
        The wrapup code of the associated composite actor.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating wrapup code for the actor.
      • getHeaderFiles

        public java.util.Set<java.lang.String> getHeaderFiles()
                                                       throws IllegalActionException
        Get the header files needed by the code generated from this adapter class. It returns the result of calling getHeaderFiles() method of the adapters of all contained actors.
        Overrides:
        getHeaderFiles in class NamedProgramCodeGeneratorAdapter
        Returns:
        A set of strings that are header files.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating header files for the actor.
      • getModifiedVariables

        public java.util.Set<Parameter> getModifiedVariables()
                                                      throws IllegalActionException
        Return a set of parameters that will be modified during the execution of the model. These parameters are those returned by getModifiedVariables() method of directors or actors that implement ExplicitChangeContext interface.
        Overrides:
        getModifiedVariables in class NamedProgramCodeGeneratorAdapter
        Returns:
        a set of parameters that will be modified.
        Throws:
        IllegalActionException - If the adapter associated with an actor or director throws it while getting modified variables.
      • getDeclareSharedCode

        public java.util.Set<java.lang.String> getDeclareSharedCode()
                                                             throws IllegalActionException
        Generate a set of declaration shared code fragments of the associated composite actor. It returns the result of calling getDeclareSharedCode() method of the adapters of all contained actors.
        Overrides:
        getDeclareSharedCode in class NamedProgramCodeGeneratorAdapter
        Returns:
        a set of shared code fragments.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating shared code for the actor.
      • getSharedCode

        public java.util.Set<java.lang.String> getSharedCode()
                                                      throws IllegalActionException
        Generate a set of shared code fragments of the associated composite actor. It returns the result of calling getSharedCode() method of the adapters of all contained actors.
        Overrides:
        getSharedCode in class TypedCompositeActor
        Returns:
        a set of shared code fragments.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating shared code for the actor.
      • setupAdapter

        public void setupAdapter()
                          throws IllegalActionException
        Set up adapters contained by the composite actor. This method is run very early in the code generation sequence, so adapters that need to set up code generation-time variables may have setupAdapter() methods that need to be invoked. Variables and shared code that are to be generated should be in generateSharedCode() or other methods, not this method.
        Overrides:
        setupAdapter in class NamedProgramCodeGeneratorAdapter
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while being set up.
      • _generateFireCode

        protected java.lang.String _generateFireCode()
                                              throws IllegalActionException
        Generate the fire code of the associated composite actor. This method first generates code for transferring any data from the input ports of this composite to the ports connected on the inside by calling the generateTransferInputsCode() method of the local director adapter. It then invokes the generateFireCode() method of its local director adapter. After the generateFireCode() method of the director adapter returns, generate code for transferring any output data created by calling the local director adapter's generateTransferOutputsCode() method.
        Overrides:
        _generateFireCode in class TypedCompositeActor
        Returns:
        The generated fire code.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating fire code for the actor, or the director adapter throws it while generating code for transferring data.