/* 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_IOutputJackImpl_HPP
#define NMM_IOutputJackImpl_HPP

#include "nmm/nmm_prefix.hpp"

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

#include "IJackImpl.hpp"

#include "visibility.hpp"

namespace NMM
{
  /** Interface of an input jack.
   * An input jack is an instance of an input stream of a node.
   * Input jacks are connected to output jacks to exchange messages using either a transport strategy
   * or a direct local connection.
   */

  class DLLEXPORT IOutputJackImpl  : virtual public IJackImpl { 
  public:
    IOutputJackImpl() { addInterface(new IOutputJack(*this)); registerEvents(); };

    virtual ~IOutputJackImpl() {};

  protected:
    /** Connect this output jack to an input jack.
     * This method creates an instream communication channel which connects this jack with a partner jack.
     * The returned InstreamChannel object must be deleted by the caller.
     *
     * @param jack Partner jack
     * @return Pointer to a new InstreamChannel object which represents the instream communication channel
     * @exception BindingException if the connection fails
     */

    virtual InstreamChannel* connectTo(const IInputJack& jack) 
      throw(const BindingException&) = 0;
    /** Get the partner jack of this jack.
     * This method gets an interface to the jack to which this jack is connected.
     * The returned interface must be deleted by the caller.
     * If this jack is not connected, a null pointer is returned.
     *
     * @return An interface to the partner jack of this jack.
     */

    virtual IInputJack* getDataPartner() = 0;
    /** Get the transport strategy of this jack.
     * This method returns an interface to the InstreamCompositeStrategy object which represents the endpoint
     * of this jack of the transport strategy used to connect this jack with its partner jack.
     * The returned interface must be deleted by the caller.
     * If this jack is not connected, or no transport strategy is used, this method returns a null pointer.
     *
     * @return An interface to the transport strategy of this jack
     */

    virtual IInstreamCompositeStrategy* getTransportStrategy() const = 0;


  private:
    void registerEvents();
  };

}

#include "nmm/nmm_suffix.hpp"

#endif
