/* 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_IBufferManagerImpl_HPP
#define NMM_IBufferManagerImpl_HPP

#include "nmm/nmm_prefix.hpp"

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


#include "visibility.hpp"

namespace NMM
{
  /** Buffer manager interface.
   *
   * This interface can be used for assigning buffer managers to nodes.
   * By default, each node uses its own buffer manager. This behaviour can be changed
   * using this interface.
   */

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

    virtual ~IBufferManagerImpl() {};

  protected:
    /** Get the buffer manager of this node.
     *
     * This method returns the NMM reference of the buffer manager of this node.
     *
     * @return The NMM reference of the buffer manager of this node
     */

    virtual NMMReference getBufferManager() = 0;
    /** Set the buffer manager to use by this node.
     *
     * This method configures this node to use the given buffer manager.
     * The given buffer manager must belong to a node which is local to this node,
     * otherwise this method will fail.
     *
     * @param manager Interface to the buffer manager to use
     * @return @c SUCCESS if the method succeeded, otherwise @c FAILURE
     */

    virtual Result useBufferManager(const IBufferManager& manager) = 0;
    /** Release the buffer manager used by this node.
     */

    virtual void releaseBufferManager() = 0;


  private:
    void registerEvents();
  };

}

#include "nmm/nmm_suffix.hpp"

#endif
