001/* Interface for actors to allow for different firing modes.
002
003 Copyright (c) 1997-2014 The Regents of the University of California.
004 All rights reserved.
005 Permission is hereby granted, without written agreement and without
006 license or royalty fees, to use, copy, modify, and distribute this
007 software and its documentation for any purpose, provided that the above
008 copyright notice and the following two paragraphs appear in all copies
009 of this software.
010
011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
015 SUCH DAMAGE.
016
017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
022 ENHANCEMENTS, OR MODIFICATIONS.
023 PT_COPYRIGHT_VERSION_2
024 COPYRIGHTENDKEY
025
026 */
027package ptolemy.domains.sdf.optimize;
028
029import ptolemy.kernel.util.IllegalActionException;
030
031///////////////////////////////////////////////////////////////////
032////BufferingProfile
033
034/**
035<h1>Class comments</h1>
036BufferingProfile is an interface which when implemented by SDF actors
037Lets the OptimizingSDFDirector choose from different firings with different properties
038For now there are two firing modes define, one where the actor may assume it has
039exclusive access to the information encapsulated by the input tokens. In particular,
040this is used for models where tokens communicate references to shared data structures
041such as video frames in image processing.
042In the alternative firing mode, the actor may not assume exclusive access and hence is
043not allowed to modify the frame.It may have to copy the frame first instead.
044
045FIXME: we may want to generalize the notion of a profile to make it more generic and allow
046more than two modes of firing.
047
048<p>
049See {@link ptolemy.domains.sdf.optimize.OptimizingSDFDirector} for more information.
050</p>
051@see ptolemy.domains.sdf.optimize.OptimizingSDFScheduler
052
053@author Marc Geilen
054@version $Id$
055@since Ptolemy II 10.0
056@Pt.ProposedRating Red (mgeilen)
057@Pt.AcceptedRating Red ()
058 */
059public interface BufferingProfile {
060    /****
061     * returns the number of buffers required upon calling shared fire in excess of
062     * the input and output buffer.
063     * @return the number of buffers required for a shared buffer firing
064     */
065    int sharedBuffers();
066
067    /****
068     * returns the number of buffers required upon calling exclusive fire in excess of
069     * the input and output buffer.
070     * @return the number of buffers required for an exclusive buffer firing
071     */
072    int exclusiveBuffers();
073
074    /****
075     * returns (an estimate of) the execution time of a shared buffer firing of the actor.
076     * @return execution time of a shared buffer firing
077     */
078    int sharedExecutionTime();
079
080    /****
081     * returns (an estimate of) the execution time of an exclusive buffer firing of the actor.
082     * @return execution time of an exclusive buffer firing
083     */
084    int exclusiveExecutionTime();
085
086    /**
087     * Invoke a specified number of iterations of the actor in either shared or
088     * exclusive mode as indicated by the fireExclusive argument.
089     *
090     * @param iterationCount The number of iterations to perform.
091     * @param fireExclusive whether to fire exclusive or not.
092     * @return NOT_READY, STOP_ITERATING, or COMPLETED.
093     * @exception IllegalActionException If iterating is not
094     *  permitted, or if prefire(), fire(), or postfire() throw it.
095     **/
096    int iterate(int iterationCount, boolean fireExclusive)
097            throws IllegalActionException;
098
099}