/* 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.
 *
 */

#include "nmm/multimedia/IUsageNotify.idl"

module NMM{

  /** Interface for managing the usage of a shared node.
   *
   * @deprecated Usage management is not supported
   */
  interface IUsage
  {
    /** Set the Usage of the node.
     *
     * @param usage usage of the node
     * @param user %IUsageNotify interface of this user so it will be notified, if its status (master or slave) changes
     */
    void setUsage(in nmm_int32 usage, in IUsageNotify* user);

    /** Unset the Usage of the node.
     *
     * @param usage usage of the node
     * @param user %IUsageNotify interface of this user to identify the user
     */
    void unsetUsage(in nmm_int32 usage, in IUsageNotify* user);
    
    /** Get the current Usage of this node.
     *
     * @return The current usage
     */
    nmm_int32 getUsage();
    
    /** Get the usage rank.
     * This method returns the number of users wich have requested this node before the given
     * user with the given usage.
     *
     * @param usage usage of the node
     * @param user %IUsageNotify interface of this user to identify the user
     * @return The usage rank of this node
     */
    nmm_int32 getRank(in nmm_int32 usage, in IUsageNotify* user);

    /** Checks if the given user will be master with the given usage.
     *
     * @param usage usage of the node
     * @param user %IUsageNotify interface of this user to identify the user
     * @return @c SUCCESS if the user will be master, @c FAILURE if the user will be slave
     */
    Result isMaster(in nmm_int32 usage, in IUsageNotify* user);

  };

}
