Package ptolemy.codegen.kernel

Examples of ptolemy.codegen.kernel.Director


     */
    public Set getModifiedVariables() throws IllegalActionException {
        Set set = new HashSet();
        set.addAll(super.getModifiedVariables());

        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());
        set.addAll(directorHelper.getModifiedVariables());
        return set;
    }
View Full Code Here


            CodeGeneratorHelper helperObject = (CodeGeneratorHelper) _getHelper((NamedObj) actor);
            sharedCode.addAll(helperObject.getSharedCode());
        }

        // Get shared code used by the director helper.
        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());
        sharedCode.addAll(directorHelper.getSharedCode());

        return sharedCode;
    }
View Full Code Here

            int length = port.getWidthInside();

            int[] bufferSizes = new int[length];
            _bufferSizes.put(port, bufferSizes);

            Director directorHelper = (Director) _getHelper((((Actor) getComponent())
                    .getDirector()));

            for (int i = 0; i < port.getWidthInside(); i++) {
                // If the local director is an SDF director, then the buffer
                // size got from the director helper is final. Otherwise
                // the buffer size will be updated later on with the maximum
                // for all possible schedules.
                int bufferSize = directorHelper.getBufferSize(port, i);
                setBufferSize(port, i, bufferSize);
            }

            Object[] readOffsets = new Object[length];
            _readOffsets.put(port, readOffsets);
View Full Code Here

     @return A string containing declared read and write offset variables.
     *  @exception IllegalActionException If the helper class cannot be found
     *   or the director helper throws it.
     */
    public String createOffsetVariablesIfNeeded() throws IllegalActionException {
        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());
        return directorHelper.createOffsetVariablesIfNeeded();
    }
View Full Code Here

        //code.append(_codeGenerator.comment(2,
        //                "Fire Composite "
        //                + getComponent().getName()));
        code.append(super.generateFireCode());

        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());

        Iterator inputPorts = ((ptolemy.actor.CompositeActor) getComponent())
                .inputPortList().iterator();

        // Update port parameters.
        StringBuffer tempCode = new StringBuffer();
        while (inputPorts.hasNext()) {
            IOPort inputPort = (IOPort) inputPorts.next();
            if (inputPort instanceof ParameterPort && inputPort.getWidth() > 0) {

                PortParameter portParameter = ((ParameterPort) inputPort)
                        .getParameter();
                tempCode.append(CodeStream.indent(_codeGenerator
                        .generateVariableName(portParameter)));
                // FIXME: The = sign is language specific.
                tempCode.append(" = ");
                tempCode.append(getReference(inputPort.getName()));
                tempCode.append(";" + _eol);
            }
        }
        if (tempCode.length() > 0) {
            code.append(CodeStream.indent(_codeGenerator.comment("Update "
                    + getComponent().getName() + "'s port parameters")));
            code.append(tempCode);
        }

        // Transfer the data to the inside.
        inputPorts = ((ptolemy.actor.CompositeActor) getComponent())
                .inputPortList().iterator();

        while (inputPorts.hasNext()) {
            IOPort inputPort = (IOPort) inputPorts.next();
            if (!(inputPort instanceof ParameterPort)) {
                directorHelper.generateTransferInputsCode(inputPort, code);
            }
        }

        // Generate the fire code by the director helper.
        code.append(directorHelper.generateFireCode());

        // Transfer the data to the outside.
        Iterator outputPorts = ((ptolemy.actor.CompositeActor) getComponent())
                .outputPortList().iterator();

        while (outputPorts.hasNext()) {
            IOPort outputPort = (IOPort) outputPorts.next();
            directorHelper.generateTransferOutputsCode(outputPort, code);
        }
        return code.toString();
    }
View Full Code Here

     */
    public String generateFireFunctionCode() throws IllegalActionException {
        StringBuffer code = new StringBuffer();
        CompositeActor compositeActor = (CompositeActor) getComponent();
        ptolemy.actor.Director director = compositeActor.getDirector();
        Director directorHelper = (Director) _getHelper(director);
        code.append(directorHelper.generateFireFunctionCode());
        if (!(compositeActor instanceof ptolemy.actor.lib.jni.CompiledCompositeActor && ((BooleanToken) _codeGenerator.generateJNI
                .getToken()).booleanValue())) {
            code.append(super.generateFireFunctionCode());
        }
        return code.toString();
View Full Code Here

     @return A string containing declared read and write offset variables.
     *  @exception IllegalActionException If the helper class cannot be found
     *   or the director helper throws it.
     */
    public String createOffsetVariablesIfNeeded() throws IllegalActionException {
        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());
        return directorHelper.createOffsetVariablesIfNeeded();
    }
View Full Code Here

        //code.append(_codeGenerator.comment(2,
        //                "Fire Composite "
        //                + getComponent().getName()));
        code.append(super.generateFireCode());

        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());

        Iterator inputPorts = ((ptolemy.actor.CompositeActor) getComponent())
                .inputPortList().iterator();

        // Update port parameters.
        StringBuffer tempCode = new StringBuffer();
        while (inputPorts.hasNext()) {
            IOPort inputPort = (IOPort) inputPorts.next();
            if (inputPort instanceof ParameterPort && inputPort.getWidth() > 0) {

                PortParameter portParameter = ((ParameterPort) inputPort)
                        .getParameter();
                tempCode.append(CodeStream.indent(_codeGenerator
                        .generateVariableName(portParameter)));
                // FIXME: The = sign is language specific.
                tempCode.append(" = ");
                tempCode.append(getReference(inputPort.getName()));
                tempCode.append(";" + _eol);
            }
        }
        if (tempCode.length() > 0) {
            code.append(CodeStream.indent(_codeGenerator.comment("Update "
                    + getComponent().getName() + "'s port parameters")));
            code.append(tempCode);
        }

        // Transfer the data to the inside.
        inputPorts = ((ptolemy.actor.CompositeActor) getComponent())
                .inputPortList().iterator();

        while (inputPorts.hasNext()) {
            IOPort inputPort = (IOPort) inputPorts.next();
            if (!(inputPort instanceof ParameterPort)) {
                directorHelper.generateTransferInputsCode(inputPort, code);
            }
        }

        // Generate the fire code by the director helper.
        code.append(directorHelper.generateFireCode());

        // Transfer the data to the outside.
        Iterator outputPorts = ((ptolemy.actor.CompositeActor) getComponent())
                .outputPortList().iterator();

        while (outputPorts.hasNext()) {
            IOPort outputPort = (IOPort) outputPorts.next();
            directorHelper.generateTransferOutputsCode(outputPort, code);
        }
        return code.toString();
    }
View Full Code Here

     */
    public String generateFireFunctionCode() throws IllegalActionException {
        StringBuffer code = new StringBuffer();
        CompositeActor compositeActor = (CompositeActor) getComponent();
        ptolemy.actor.Director director = compositeActor.getDirector();
        Director directorHelper = (Director) _getHelper(director);
        code.append(directorHelper.generateFireFunctionCode());
        if (!(compositeActor instanceof ptolemy.actor.lib.jni.CompiledCompositeActor && ((BooleanToken) _codeGenerator.generateJNI
                .getToken()).booleanValue())) {
            code.append(super.generateFireFunctionCode());
        }
        return code.toString();
View Full Code Here

                            getComponent().getName()
                                    + "'s output offset initialization")));
            initializeCode.append(code);
        }

        Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
                .getDirector());

        // Generate the initialize code by the director helper.
        initializeCode.append(directorHelper.generateInitializeCode());

        return initializeCode.toString();
    }
View Full Code Here

TOP

Related Classes of ptolemy.codegen.kernel.Director

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.