/* 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_FACOTRY_OBJECT_HPP
#define NMM_FACTORY_OBJECT_HPP NMM_FACTORY_OBJECT_HPP

#include "nmm/nmm_prefix.hpp"

#include <string>

#include "visibility.hpp"

namespace NMM {
  
  class Node;
  
  /** A factory object of a node factory.
   */
  class DLLEXPORT FactoryObject {
  public:
    /** @name Constructor & Destructor
     */
    //@{
    /** Create a new factory object.
     *
     * @param plugin_name Name of the plug-in which provides the node class
     * @param node_name Name of the node class
     */
    FactoryObject(const std::string& plugin_name, const std::string& node_name);

    /** Virtual destructor.
     */
    virtual ~FactoryObject() {}
    //@}

    /** @name Factory Methods
     */
    //@{
    /** Create an instance of this node class.
     *
     * @return A pointer to the new node
     */
    virtual Node* createNode()         = 0;

    /** Release a node.
     *
     * @param n A node created by this factory object
     */
    virtual void  releaseNode(Node* n)    = 0;

    /** Virtual copy constructor
     *
     * @return A pointer to a copy of this factory object
     */
    virtual FactoryObject* copy()        const = 0;
    //@}

    /** @name Node information
     */
    //@{
    /** Get the name of the node class.
     *
     * @return Name of the node class
     */
    inline const std::string& getNodeName()   const {return __node_name;}

    /** Get the name of the plug-in which provides the node class.
     *
     * @return Name of the plug-in which provides the node class
     */
    inline const std::string& getPluginName() const {return __plugin_name;}
    //@}
    
  private:
    std::string __plugin_name;   ///< Name of the plug-in which provides the node class
    std::string __node_name;     ///< Name of the node class
  };


}

#include "nmm/nmm_suffix.hpp"

#endif
