/* 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_TYPE_INFO_HPP
#define NMM_TYPE_INFO_HPP NMM_TYPE_INFO_HPP

#include "nmm/nmm_prefix.hpp"

#include <string>
#include <iosfwd>

#include "visibility.hpp"

namespace NMM {

  /** Type information
   * This class represents type information of a type. Type information consists of two strings,
   * the type name and the type namespace. For example the type information of "std::string"
   * has type name "string" and type namespace "std".
   */
  class DLLEXPORT TypeInfo {
  public:
    /** @name Constructor & Destructor
     */
    //@{
    /** Create type information.
     *
     * @param name Type name
     * @param name_space Type namespace
     */
    explicit TypeInfo(const std::string& name, const std::string& name_space) : t_name(name), t_namespace(name_space) {}

    /** Create type information.
     *
     * @param name Type name
     */
    explicit TypeInfo(const std::string& name) : t_name(name) {}

    /** Default constructor.
     */
    explicit TypeInfo() {}

    /** Get the name of this type.
     */
    const std::string& getName() const { return t_name; }

    /** Get the namespace of this type.
     */
    const std::string& getNamespace() const { return t_namespace; }

    /** Equality operator.
     *
     * @param to Another type information object
     * @return @c true if both type information objects are equal, @c false otherwise
     */
    bool operator==(const TypeInfo& to) const ;

    /** Inequality operator.
     *
     * @param to Another type information object
     * @return @c false if both type information objects are equal, @c true otherwise
     */
    inline bool operator!=(const TypeInfo& to) const { return !( *this == to ); }

    /** Ordering operator.
     * This operator defines a partial order on type information objects.
     *
     * @param to Another type information object
     * @return @c true if this type information is less than the other type information, @c false otherwise
     */
    inline bool operator<(const TypeInfo& to) const {
      return (t_name < to.t_name) || (t_name == to.t_name && t_namespace < to.t_namespace);
    }

    std::string t_name;                ///< Type name
    std::string t_namespace;           ///< Type namespace
  };

  /** Output operator for TypeInfo.
   */
  DLLEXPORT std::ostream& operator<<(std::ostream& os, const TypeInfo& ti);
  
}

#include "nmm/nmm_suffix.hpp"

#endif
