/* 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_NODEFACTORYID_HPP
#define NMM_NODEFACTORYID_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/serialize/SerializedValue.hpp"
#include "nmm/comm/serialize/TValue.hpp"
#include "visibility.hpp"

namespace NMM {

  /** The NodeFactoryID is used to identify a NodeFactory. To identify a NodeFactory its class name
   * is used.
   */
  class DLLEXPORT NodeFactoryID  :  public SerializedValue
  {
  public:
    /** @name Constructor & Destructor
     */
    //@{
    /** Constructor.
     * @param fac_name Name of the NodeFactory
     */
    NodeFactoryID(const string& fac_name = "");

    /** Copy constructor.
     *
     * @param f_id NodeFactoryID to copy
     */
    NodeFactoryID(const NodeFactoryID& f_id);

    /** Virtual copy constructor.
     *
     * This mehtod creates a copy from this object.
     *
     * @return pointer to copy of this object
     */
    virtual NodeFactoryID* copy()              const { return new NodeFactoryID(*this); }
    //@}

    /** @name Access stored information
     */
    //@{
    /** This method returns the name of the NodeFactory.
     *
     * @return name of the NodeFactory
     */
    inline const string&    getFactoryName()   const {return __fac_name.getRValue();}

    /** This method returns the host oname of the NodeFactory.
     *
     * @return hostname 
     */
    inline const string&    getHostname()      const {return __hostname.getRValue();}
    //@}

    /** @name Operator
     */
    //@{
    /** The assignment operator copies the information stored in given f_id to this NodeFactoryID.
     *
     * @param f_id NodeFactoryID to copy information from
     * @return reference to this NodeFactoryID
     */
    NodeFactoryID& operator=(const NodeFactoryID& f_id);

    /** Tests if this and given NodeFactoryID are equal.
     *
     * The operator== compares the given f_id with this NodeFactoryID and returns true
     * if the name of the NodeFactoryIDs are identical, otherwise false.
     *
     * @param f_id NodeFactoryID to compare with
     * @return true if NodeFactoryIDs are identical, false otherwise
     */
    bool operator==(const NodeFactoryID& f_id) const;

    /** Tests if this and given NodeFactoryID are unequal.
     *
     * The operator!= compares the given f_id with this NodeFactoryID and returns false
     * if the name of the NodeFactory are identicall, otherwise true.
     *
     * @param f_id NodeFactoryID to compare with
     * @return true if NodeFactoryIDs are identical, false otherwise
     */
    bool operator!=(const NodeFactoryID& f_id) const {return !(*this == f_id);}
    //@}

  private: //methods
    /** Registers attributes for serialization/deserialization.
     */
    void registerAttributes();

  private: //attributes
    TValue<string>    __hostname;          ///< stores the hostname (for debug reason)
    TValue<string>    __fac_name;          ///< stores the name of the NodeFactory
  };

}

#include "nmm/nmm_suffix.hpp"

#endif
