/* 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_IInputJack_HPP
#define NMM_IInputJack_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/Interface.hpp"
#include "nmm/comm/messaging/Event.hpp"
#include "nmm/comm/messaging/IllegalStateException.hpp"
#include <memory>

#include "IJack.hpp"

#include "visibility.hpp"

namespace NMM
{

  class InstreamChannel;

  class IInstreamCompositeStrategy;

  class IOutputJack;
  /** 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 IInputJack : virtual public IJack { 
  public:
    IInputJack() : NMM::Interface(IInputJack::IInputJack_type, "NMM") { };

    IInputJack(NMM::NMMObject& parent) : NMM::Interface (parent, IInputJack::IInputJack_type, "NMM") { };

    virtual ~IInputJack() {};

    static const char* IInputJack_type;

    virtual  string getInterfaceType() const { return IInputJack_type; }

    NMM::Interface* copy() const { return new IInputJack(*this); }
    static void used(); 
    static const char* connectTo_event;
    static const char* getDataPartner_event;
    static const char* getTransportStrategy_event;
    /** Connect this input jack to an output 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 IOutputJack& jack)
      throw(const NMM::SerializedException&, const BindingException&);
    /** 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 IOutputJack* getDataPartner()
      throw(const NMM::SerializedException&);
    /** 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
      throw(const NMM::SerializedException&);


  };

  typedef auto_ptr<IInputJack> IInputJack_var;




}

#include "nmm/nmm_suffix.hpp"

#endif
