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

#ifndef NMM_IObjectAcceptorImpl_HPP
#define NMM_IObjectAcceptorImpl_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/NMMObject.hpp"
#include "IObjectAcceptor.hpp"


#include "visibility.hpp"

namespace NMM
{
  /** Object acceptor interface.
   * This interface is used for connecting a %TransportStrategy to its
   * partner object. It is implemented by subclasses of
   * %ObjectAcceptor.
   */

  class DLLEXPORT IObjectAcceptorImpl  : public virtual NMM::NMMObject { 
  public:
    IObjectAcceptorImpl() { addInterface(new IObjectAcceptor(*this)); registerEvents(); };

    virtual ~IObjectAcceptorImpl() {};

  protected:
    /** Connects strategy to object.
     *
     * This event connects the %OutOfBandCompositeStrategy over which
     * it was received to the given object.
     *
     * @param reference NMM reference of object to connect to
     * @exception BindingException if the connection fails
     */

    virtual void connectToObject(const NMMReference& reference) 
      throw(const BindingException&) = 0;
    /** Connects strategy to service.
     *
     * This event connects the %OutOfBandCompositeStrategy over which
     * it was received to the given service.
     *
     * @param service Name of service to connect to
     * @exception BindingException if the connection fails
     */

    virtual void connectToService(const string& service) 
      throw(const BindingException&) = 0;
    /** Connects strategy to jack.
     *
     * This event connects the %InstreamCompositeStrategy over which
     * it was received to the given jack.
     *
     * @param reference NMM reference of jack to connect to
     * @exception BindingException if the connection fails
     */

    virtual void connectToJack(const NMMReference& reference) 
      throw(const BindingException&) = 0;
    /** Connects strategy to an %OutOfBandCompositeStrategy.
     *
     * This event connects the leaf strategy over which it was received to an
     * %OufOfBandCompositeStrategy. If the @c reference argument is 0, a new
     * composite strategy is created and its %NMMReference is returned in
     * @c reference. Otherwise, the leaf strategy is connected to the existing
     * composite strategy with the given %NMMReference.
     *
     * @param reference %NMMReference of composite strategy to connect to
     * @param roles Set of transport roles that this leaf strategy should have
     */

    virtual void connectToOutOfBandCompositeStrategy(NMMReference& reference, const nmm_uint32& roles) 
      throw(const BindingException&) = 0;
    /** Connects strategy to an %InstreamCompositeStrategy.
     *
     * This event connects the leaf strategy over which it was received to an
     * %OufOfBandCompositeStrategy. If the @c reference argument is 0, a new
     * composite strategy is created and its %NMMReference is returned in
     * @c reference. Otherwise, the leaf strategy is connected to the existing
     * composite strategy with the given %NMMReference.
     *
     * @param reference %NMMReference of composite strategy to connect to
     * @param roles Set of transport roles that this leaf strategy should have
     */

    virtual void connectToInstreamCompositeStrategy(NMMReference& reference, const nmm_uint32& roles) 
      throw(const BindingException&) = 0;
    /** Returns service list.
     *
     * This method returns the list of registered services.
     *
     * @return The list of services
     */

    virtual list<string >  getServiceList() const = 0;


  private:
    void registerEvents();
  };

}

#include "nmm/nmm_suffix.hpp"

#endif
