/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

module NMM {

  /** Queue control interface.
   *
   * This interface provides methods for configuring and querying the current state of
   * a stream queue. For nodes, this interface controls downstream queues, and stream IDs
   * are mapped to input stream IDs. Note that objects implementing this interface are not
   * necessarily nodes.
   *
   * @see IBiDirQueuedNode, StreamQueue
   */
  interface IQueued
  {
    /** Queue mode
     *
     * The queue mode of a queue specifies what to do when the queue is full
     * and a new message arrives.
     */
    enum Mode {
      /** Default queue mode. */
      DEFAULT_MODE = 1,

      /** Suspend until queue has free slot. */
      MODE_SUSPEND = 1,

      /** Keep oldest element in queue. */
      MODE_KEEP_OLDEST,

      /** Keep newest element in queue. */
      MODE_KEEP_NEWEST
    };

    /** Get the current size of a queue.
     * This method returns the number of buffers currently queued.
     *
     * @param id Stream ID which identifies the queue
     * @return Current size of the queue (in number of buffers)
     */
    unsigned int getSize(in string id = "default") const;

    /** Get the maximum size of a queue.
     * This method returns the maximum number of buffers that may be queued.
     *
     * @param id Stream ID which identifies the queue
     * @return Maximum size of the queue (in number of buffers)
     */
    nmm_uint32 getMaxSize(in string id = "default") const;
    
    /** Set the maximum size of a queue.
     * This method sets the maximum number of buffers that may be queued.
     *
     * @param size Maximum size of the queue (in number of buffers)
     * @param id Stream ID which identifies the queue
     */
    Result setMaxSize(in nmm_uint32 size, in string id = "default");
    
    /** Get the mode of a queue.
     * This method returns the queue mode.
     *
     * @param id Stream ID which identifies the queue
     * @return Queue mode
     */
    IQueued::Mode getMode(in string id = "default") const;

    /** Set the mode of a queue.
     * This method sets the queue mode.
     *
     * @param mode Queue mode
     * @param id Stream ID which identifies the queue
     */
    Result setMode(in IQueued::Mode mode, in string id = "default");

  };

}
