Index: XIOS/trunk/src/array_new.hpp
===================================================================
--- XIOS/trunk/src/array_new.hpp	(revision 1104)
+++ XIOS/trunk/src/array_new.hpp	(revision 1105)
@@ -300,4 +300,20 @@
         Array<T_numtype,N_rank>::reference(array);
         initialized = true;
+      }
+
+      bool operator== (const CArray<T_numtype,N_rank>& array)
+      {
+        size_t nbThis = this->numElements();
+        size_t nbArr  = array.numElements();
+        if (nbThis != nbArr) return false;
+        for (size_t idx = 0; idx < nbThis; ++idx)
+          if ((*this)(idx) != array(idx)) return false;
+
+        return true;
+      }
+
+      bool operator== (const Array<T_numtype,N_rank>& array)
+      {
+        return ((*this) == (dynamic_cast<const CArray<T_numtype,N_rank>& >(array)));
       }
 
Index: XIOS/trunk/src/attribute.hpp
===================================================================
--- XIOS/trunk/src/attribute.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute.hpp	(revision 1105)
@@ -16,4 +16,9 @@
 {
       /// ////////////////////// DÃ©clarations ////////////////////// ///
+   /*!
+   \class CAttribute
+      The fundamental class which describes the attributes of other different class in XIOS.
+      This class only plays a role of interface, its class child will have specific implelemtation corresponding to type of attribute
+   */
       class CAttribute : public CObject, public virtual CBaseType
       {
@@ -24,21 +29,8 @@
             /// Constructeurs ///
             explicit CAttribute(const StdString & id);
-//            CAttribute(const CAttribute & attribut);
-//            CAttribute(const CAttribute * const attribut); // Not implemented.
 
             /// Accesseurs ///
             const StdString & getName(void) const;
-//            const boost::any & getAnyValue(void) const;
-//            template <typename T> inline T getValue(void) const;
-//            template <typename T> inline T* getRef(void);
 
-//            /// Mutateurs ///
-//            template <typename T> inline void setValue(const T & value);
-//            void setAnyValue(const boost::any & value);
-//            void clear(void);
-
-            /// Test ///
-//            bool isEmpty(void) const;
-//            template <typename T> inline bool isType(void) const;
             virtual void set(const CAttribute& ) =0 ;
             virtual void reset(void ) =0 ;
@@ -49,11 +41,12 @@
             virtual StdString toString(void) const = 0;
             virtual void fromString(const StdString & str) = 0;
-
-//            virtual void toBinary  (StdOStream & os) const = 0;
-//            virtual void fromBinary(StdIStream & is) = 0;
+            virtual bool isEqual(const CAttribute& ) = 0;
 
             //! Returns true if and only if the attribute should be publicly exposed in the API
             virtual bool isPublic() const { return true; }
 
+            /*
+              Groupd of functions to generate C and Fortran interface 
+            */
             virtual void generateCInterface(ostream& oss, const string& className) = 0 ;
             virtual void generateCInterfaceIsDefined(ostream& oss, const string& className) ;
@@ -73,41 +66,8 @@
             virtual bool hasInheritedValue(void) const = 0;
             
-         protected :
-
-            /// Constructeurs ///
-//            CAttribute(void);  // Not implemented.
-
-            /// PropriÃ©tÃ© ///
-//            boost::any value;
+         protected : 
 
       }; // class CAttribute
 
-      /// ////////////////////// DÃ©finitions ////////////////////// ///
-/*
-      template <typename T>
-         T CAttribute::getValue(void) const
-      { 
-         return (boost::any_cast<T>(this->value)); 
-      }
-
-      template <typename T>
-         T* CAttribute::getRef(void)
-      { 
-         return (boost::any_cast<T>(&value)); 
-      }
-
-      template <typename T>
-         void CAttribute::setValue(const T & value)
-      { 
-         this->value = value; 
-      }
-
-      template<typename T>
-         bool CAttribute::isType(void) const
-      { 
-         return (this->value.type() == typeid(T)); 
-      }
-*/
- 
    CMessage& operator<<(CMessage& msg,CAttribute& type) ;
    CMessage& operator<<(CMessage& msg, const CAttribute&  type) ;
Index: XIOS/trunk/src/attribute_array.hpp
===================================================================
--- XIOS/trunk/src/attribute_array.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_array.hpp	(revision 1105)
@@ -40,4 +40,7 @@
             CArray<T_numtype, N_rank> getInheritedValue(void) const ;
             bool hasInheritedValue(void) const;
+            
+            bool isEqual(const CAttributeArray& attr);
+            bool isEqual(const CAttribute& attr);
 
             /// Destructeur ///
Index: XIOS/trunk/src/attribute_array_impl.hpp
===================================================================
--- XIOS/trunk/src/attribute_array_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_array_impl.hpp	(revision 1105)
@@ -103,4 +103,15 @@
     }
 
+    template <typename T_numtype, int N_rank>
+    bool CAttributeArray<T_numtype,N_rank>::isEqual(const CAttributeArray& attr)
+    {
+      return ((dynamic_cast<CArray<T_numtype,N_rank>& >(*this)) == (dynamic_cast<const CArray<T_numtype,N_rank>& >(attr)));      
+    }
+
+    template <typename T_numtype, int N_rank>
+    bool CAttributeArray<T_numtype,N_rank>::isEqual(const CAttribute& attr)
+    {
+      return ((*this) == (dynamic_cast<const CAttributeArray<T_numtype,N_rank>& >(attr)));      
+    }
 
     template <typename T_numtype, int N_rank>
Index: XIOS/trunk/src/attribute_enum.hpp
===================================================================
--- XIOS/trunk/src/attribute_enum.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_enum.hpp	(revision 1105)
@@ -47,4 +47,7 @@
             bool hasInheritedValue(void) const;          
           
+            bool isEqual(const CAttributeEnum& attr );
+            bool isEqual(const CAttribute& attr );
+
             /// Destructeur ///
             virtual ~CAttributeEnum(void) { }
Index: XIOS/trunk/src/attribute_enum_impl.hpp
===================================================================
--- XIOS/trunk/src/attribute_enum_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_enum_impl.hpp	(revision 1105)
@@ -111,4 +111,16 @@
   }
 
+  template <class T>
+  bool CAttributeEnum<T>::isEqual(const CAttribute& attr)
+  {
+    return (this->isEqual(dynamic_cast<const CAttributeEnum<T>& >(attr)));
+  }
+
+  template <class T>
+  bool CAttributeEnum<T>::isEqual(const CAttributeEnum& attr)
+  {
+    return ((dynamic_cast<const CEnum<T>& >(*this)) == (dynamic_cast<const CEnum<T>& >(attr)));
+  }
+
   //---------------------------------------------------------------
 
Index: XIOS/trunk/src/attribute_map.cpp
===================================================================
--- XIOS/trunk/src/attribute_map.cpp	(revision 1104)
+++ XIOS/trunk/src/attribute_map.cpp	(revision 1105)
@@ -16,4 +16,7 @@
       ///--------------------------------------------------------------
 
+      /*!
+         Clear all attributes of an object and reset them to empty state
+      */
       void CAttributeMap::clearAllAttributes(void)
       {
@@ -29,4 +32,8 @@
       //---------------------------------------------------------------
 
+      /*
+        Clear an attribute and reset its value
+        \param[in] key id of attribute
+      */
       void CAttributeMap::clearAttribute(const StdString& key)
       {
@@ -36,4 +43,9 @@
       //---------------------------------------------------------------
 
+      /*!
+        Set an attribute of certain id with a value
+        \param[in] key id of the attribute
+        \param[in] attr value of attribute
+      */
       void CAttributeMap::setAttribute(const StdString& key, CAttribute* const attr)
       {
@@ -50,4 +62,7 @@
       //---------------------------------------------------------------
 
+      /*!
+        Subscript operator. Return attribute with a specific id
+      */
       CAttribute* CAttributeMap::operator[](const StdString& key)
       {
@@ -103,4 +118,30 @@
          }
       }
+
+      /*!
+         Compare two attribute maps
+         \param [in] another attribute map to compare
+         \return true if these two maps have same attributes whose value are identical
+      */
+      bool CAttributeMap::isEqual(const CAttributeMap& another)
+      {
+         SuperClassMap::const_iterator itb = another.begin(), ite = another.end(), it;
+         for (it = itb; it !=ite; ++it)
+         {
+            if ((*it).first.compare(StdString("id")) != 0 && (*it).first.compare(StdString("src")) != 0)
+            {
+              if (this->hasAttribute(it->first))
+              { 
+                if (!((*it).second->isEqual(*(*this)[it->first])))
+                return false;
+              }
+              else
+                return false;
+            }
+         }
+
+         return true;
+      }
+
 
       //---------------------------------------------------------------
@@ -139,4 +180,9 @@
       }
 
+      /*!
+        Duplicate attribute map with a specific attribute map.
+        Copy all non-empty attribute of the current attribute map
+        \param [in] srcAttr attribute map which is copied from.
+      */
       void CAttributeMap::duplicateAttributes(const CAttributeMap* const srcAttr)
       {
@@ -216,4 +262,6 @@
       }
  */
+
+      
       void CAttributeMap::generateCInterface(ostream& oss, const string& className)
       {
Index: XIOS/trunk/src/attribute_map.hpp
===================================================================
--- XIOS/trunk/src/attribute_map.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_map.hpp	(revision 1105)
@@ -12,4 +12,9 @@
 {
       /// ////////////////////// DÃ©clarations ////////////////////// ///
+      /*!
+        \class CAttributeMap
+        This class represents the set of attributes which an object can have.
+      */
+
       class CAttributeMap
          : public xios_map<StdString, CAttribute*>
@@ -34,4 +39,5 @@
 
             void clearAttribute(const StdString& key);
+            bool isEqual(const CAttributeMap& another);
 
             /// Destructeur ///
Index: XIOS/trunk/src/attribute_template.hpp
===================================================================
--- XIOS/trunk/src/attribute_template.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_template.hpp	(revision 1105)
@@ -54,4 +54,7 @@
             bool hasInheritedValue(void) const;
 
+            bool isEqual(const CAttributeTemplate& attr );
+            bool isEqual(const CAttribute& attr );
+            
             /// Destructeur ///
             virtual ~CAttributeTemplate(void) { }
Index: XIOS/trunk/src/attribute_template_impl.hpp
===================================================================
--- XIOS/trunk/src/attribute_template_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/attribute_template_impl.hpp	(revision 1105)
@@ -139,4 +139,23 @@
     {
       return !this->isEmpty() || !inheritedValue.isEmpty() ;
+    }
+
+    template <class T>
+    bool CAttributeTemplate<T>::isEqual(const CAttribute& attr)
+    {
+      const CAttributeTemplate<T>& tmp = dynamic_cast<const CAttributeTemplate<T>& >(attr);
+      this->isEqual(tmp);
+
+    }
+
+    template <class T>
+    bool CAttributeTemplate<T>::isEqual(const CAttributeTemplate& attr)
+    {
+      if ((!this->hasInheritedValue() && !attr.hasInheritedValue()))
+          return true;
+      if (this->hasInheritedValue() && attr.hasInheritedValue())
+          return (this->getInheritedValue() == attr.getInheritedValue());
+      else 
+        return false;
     }
 
Index: XIOS/trunk/src/date.cpp
===================================================================
--- XIOS/trunk/src/date.cpp	(revision 1104)
+++ XIOS/trunk/src/date.cpp	(revision 1105)
@@ -62,4 +62,12 @@
          hour = date.hour; minute = date.minute; second = date.second;
          return (*this);
+      }
+
+      bool CDate::operator==(const CDate& date)
+      {         
+         return (&(*relCalendar) == &(*date.relCalendar) &&
+                 year == date.year && month  == date.month  && day == date.day &&
+                 hour == date.hour && minute == date.minute && second == date.second);
+         
       }
 
Index: XIOS/trunk/src/date.hpp
===================================================================
--- XIOS/trunk/src/date.hpp	(revision 1104)
+++ XIOS/trunk/src/date.hpp	(revision 1105)
@@ -32,4 +32,5 @@
             /// OpÃ©rateurs ///
             CDate& operator=(const CDate& date);
+            bool operator==(const CDate& date);
             friend StdOStream& operator<<(StdOStream& out, const CDate& date);
             friend StdIStream& operator>>(StdIStream& in, CDate& date);
Index: XIOS/trunk/src/duration.cpp
===================================================================
--- XIOS/trunk/src/duration.cpp	(revision 1104)
+++ XIOS/trunk/src/duration.cpp	(revision 1105)
@@ -24,4 +24,13 @@
         hour = duration.hour; minute = duration.minute; second = duration.second; timestep = duration.timestep;
         return *this;
+      }
+
+      /*!
+        This operation may not serve much, it's here because of the need of operator== from generic class CType<T>
+      */
+      bool CDuration::operator==(const CDuration& duration)
+      {
+        return (year == duration.year && month  == duration.month  && day == duration.day &&
+                hour == duration.hour && minute == duration.minute && second == duration.second && timestep == duration.timestep);        
       }
 
Index: XIOS/trunk/src/duration.hpp
===================================================================
--- XIOS/trunk/src/duration.hpp	(revision 1104)
+++ XIOS/trunk/src/duration.hpp	(revision 1105)
@@ -22,4 +22,5 @@
             /// OpÃ©rateurs ///
             CDuration& operator=(const CDuration& duration);
+            bool operator==(const CDuration& duration);
 
             friend StdOStream& operator<<(StdOStream& out, const CDuration& duration);
Index: XIOS/trunk/src/object_template.hpp
===================================================================
--- XIOS/trunk/src/object_template.hpp	(revision 1104)
+++ XIOS/trunk/src/object_template.hpp	(revision 1105)
@@ -61,4 +61,7 @@
          static bool dispatchEvent(CEventServer& event) ;
 
+         bool isEqual(const string& id);
+         bool isEqual(T* obj);
+
          /// Accesseur statique ///
          static std::vector<boost::shared_ptr<DerivedType> > &
Index: XIOS/trunk/src/object_template_impl.hpp
===================================================================
--- XIOS/trunk/src/object_template_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/object_template_impl.hpp	(revision 1105)
@@ -136,4 +136,23 @@
    }
 
+   /*!
+     Compare two object of same type
+   */
+   template <class T>
+   bool CObjectTemplate<T>::isEqual(const string& id)
+   {
+      T* obj = CObjectTemplate<T>::get(id);
+      return this->isEqual(obj);
+   }
+
+   template <class T>
+   bool CObjectTemplate<T>::isEqual(T* obj)
+   {
+
+      CAttributeMap& attrMapThis = *this;
+      CAttributeMap& attrMapObj  = *obj;
+      return (attrMapThis.isEqual(attrMapObj));
+   }
+
    //---------------------------------------------------------------
 
Index: XIOS/trunk/src/type/enum.hpp
===================================================================
--- XIOS/trunk/src/type/enum.hpp	(revision 1104)
+++ XIOS/trunk/src/type/enum.hpp	(revision 1105)
@@ -100,5 +100,5 @@
     __INLINE__ const CEnum_ref& operator = (const CEnum_ref& val) const;
     __INLINE__ operator T_enum&() const;
-    bool operator == (const CEnum_ref &other) {return this->get()==other.get() ;}
+    
 
     inline virtual CBaseType* clone(void) const   { return _clone(); }
@@ -134,4 +134,13 @@
   } ;
   
+  template <typename T> __INLINE__ bool operator== (const CEnum<T>& lhs, const typename T::t_enum& rhs);
+  template <typename T> __INLINE__ bool operator== (const typename T::t_enum& lhs, const CEnum<T>& rhs);
+  template <typename T> __INLINE__ bool operator== (const CEnum<T>& lhs, const CEnum<T>& rhs);  
+  template <typename T> __INLINE__ bool operator== (const CEnum_ref<T>& lhs, const CEnum_ref<T>& rhs);
+  template <typename T> __INLINE__ bool operator== (const CEnum_ref<T>& lhs, const typename T::t_enum& rhs);
+  template <typename T> __INLINE__ bool operator== (const typename T::t_enum& lhs, const CEnum_ref<T>& rhs);
+  template <typename T> __INLINE__ bool operator== (const CEnum<T>& lhs, const CEnum_ref<T>& rhs) {return (lhs.get() == rhs.get());}
+  template <typename T> __INLINE__ bool operator== (const CEnum_ref<T>& lhs, const CEnum<T>& rhs) {return (rhs == lhs); }
+
   template <typename T> __INLINE__ CBufferOut& operator<<(CBufferOut& buffer, const CEnum<T>& type) ;
   template <typename T> __INLINE__ CBufferOut& operator<<(CBufferOut& buffer, const typename T::t_enum & type) ;  
Index: XIOS/trunk/src/type/enum_impl.hpp
===================================================================
--- XIOS/trunk/src/type/enum_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/type/enum_impl.hpp	(revision 1105)
@@ -249,6 +249,27 @@
                      << "Enum is not initialized.");
   }  
-
-  
+  
+  template <typename T> 
+  bool operator== (const CEnum<T>& lhs, const typename T::t_enum& rhs)
+  {
+     if (lhs.isEmpty()) return false;
+     return (lhs.get() == rhs);
+  }
+
+  template <typename T> 
+  bool operator== (const typename T::t_enum& lhs, const CEnum<T>& rhs)
+  {
+    return rhs == lhs;
+  }
+
+  template <typename T> 
+  bool operator== (const CEnum<T>& lhs, const CEnum<T>& rhs)
+  {
+    if ((lhs.isEmpty() && !rhs.isEmpty()) || (!lhs.isEmpty() && rhs.isEmpty())) return false;
+    if (lhs.isEmpty() && rhs.isEmpty()) return true;
+    return (lhs.get() == rhs.get());
+  }
+
+
   template <typename T>
   CBufferOut& operator<<(CBufferOut& buffer, const CEnum<T>& type)
Index: XIOS/trunk/src/type/enum_ref_impl.hpp
===================================================================
--- XIOS/trunk/src/type/enum_ref_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/type/enum_ref_impl.hpp	(revision 1105)
@@ -263,5 +263,24 @@
   }
                      
-
+  template <typename T> 
+  bool operator== (const CEnum_ref<T>& lhs, const typename T::t_enum& rhs)
+  {
+     if (lhs.isEmpty()) return false;
+     return (lhs.get() == rhs);
+  }
+
+  template <typename T> 
+  bool operator== (const typename T::t_enum& lhs, const CEnum_ref<T>& rhs)
+  {
+    return rhs == lhs;
+  }
+
+  template <typename T> 
+  bool operator== (const CEnum_ref<T>& lhs, const CEnum_ref<T>& rhs)
+  {
+    if ((lhs.isEmpty() && !rhs.isEmpty()) || (!lhs.isEmpty() && rhs.isEmpty())) return false;
+    if (lhs.isEmpty() && rhs.isEmpty()) return true;
+    return (lhs.get() == rhs.get());
+  }
   
   template <typename T>
Index: XIOS/trunk/src/type/type.hpp
===================================================================
--- XIOS/trunk/src/type/type.hpp	(revision 1104)
+++ XIOS/trunk/src/type/type.hpp	(revision 1105)
@@ -94,5 +94,5 @@
     const CType_ref& operator = (CType<T>& val) const ;
     const CType_ref& operator = (const CType_ref& val) const;
-    operator T&() const;
+    operator T&() const;    
 
     inline virtual CBaseType* clone(void) const   { return _clone(); }
@@ -127,4 +127,24 @@
     size_t _size(void) const ;
   } ;
+
+  template <typename T> inline bool operator==(const CType<T>& lhs, const T& rhs);   
+  template <typename T> inline bool operator==(const T& lhs, const CType<T>& rhs);   
+  template <typename T> inline bool operator==(const CType_ref<T>& lhs, const T& rhs);   
+  template <typename T> inline bool operator==(const T& lhs, const CType_ref<T>& rhs); 
+  template <typename T> inline bool operator==(const CType_ref<T>& lhs, const CType_ref<T>& rhs); 
+
+  template <typename T>
+  inline bool operator==(const CType_ref<T>& lhs, const CType<T>& rhs)
+  {
+    if ((lhs.isEmpty() && !rhs.isEmpty()) || (!lhs.isEmpty() && rhs.isEmpty())) return false;
+    if (lhs.isEmpty() && rhs.isEmpty()) return true;
+    return (*lhs.ptrValue == *rhs.ptrValue);
+  } 
+
+  template <typename T>
+  inline bool operator==(const CType<T>& lhs, const CType_ref<T>& rhs)
+  {
+    return (rhs == lhs);
+  }
 
 
Index: XIOS/trunk/src/type/type_decl.cpp
===================================================================
--- XIOS/trunk/src/type/type_decl.cpp	(revision 1104)
+++ XIOS/trunk/src/type/type_decl.cpp	(revision 1105)
@@ -22,5 +22,12 @@
 /*  template CMessage& operator<< <decl_type> (CMessage& msg, const CType_ref<decl_type>& type) ;*/ \
   template CMessage& operator<< <decl_type> (CMessage& msg, const decl_type& type) ; \
-  template CMessage& operator<< <decl_type> (CMessage& msg, decl_type& type) ;
+  template CMessage& operator<< <decl_type> (CMessage& msg, decl_type& type) ;       \    
+  template bool operator==(const CType<decl_type>& lhs, const decl_type& rhs);                 \          
+  template bool operator==(const decl_type& lhs, const CType<decl_type>& rhs);                \
+  template bool operator==(const CType_ref<decl_type>& lhs, const decl_type& rhs);             \
+  template bool operator==(const decl_type& lhs, const CType_ref<decl_type>& rhs);             \
+  template bool operator==(const CType_ref<decl_type>& lhs, const CType<decl_type>& rhs);      \
+  template bool operator==(const CType<decl_type>& lhs, const CType_ref<decl_type>& rhs);     \
+  template bool operator==(const CType_ref<decl_type>& lhs, const CType_ref<decl_type>& rhs);    
   
   macro(string)
Index: XIOS/trunk/src/type/type_impl.hpp
===================================================================
--- XIOS/trunk/src/type/type_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/type/type_impl.hpp	(revision 1105)
@@ -211,4 +211,25 @@
   }
 
+  template <typename T>
+  bool operator==(const CType<T>& lhs, const T& rhs)
+  {
+    if (lhs.isEmpty()) return false;
+    return (*lhs.ptrValue == rhs);    
+  }
+
+  template <typename T>
+  bool operator==(const T& lhs, const CType<T>& rhs)
+  {
+    return (rhs == lhs);
+  }
+
+  template <typename T>
+  bool operator==(const CType<T>& lhs, const CType<T>& rhs)
+  {
+    if ((lhs.isEmpty() && !rhs.isEmpty()) || (!lhs.isEmpty() && rhs.isEmpty())) return false;
+    if (lhs.isEmpty() && rhs.isEmpty()) return true;
+    
+    return (*lhs.ptrValue == *rhs.ptrValue);
+  }
 
   template <typename T>
Index: XIOS/trunk/src/type/type_ref_impl.hpp
===================================================================
--- XIOS/trunk/src/type/type_ref_impl.hpp	(revision 1104)
+++ XIOS/trunk/src/type/type_ref_impl.hpp	(revision 1105)
@@ -201,5 +201,25 @@
   }
                      
-
+  template <typename T>
+  bool operator==(const CType_ref<T>& lhs, const T& rhs)
+  {
+    if (lhs.isEmpty()) return false;
+    return (*lhs.ptrValue == rhs);    
+  }
+
+  template <typename T>
+  bool operator==(const T& lhs, const CType_ref<T>& rhs)
+  {
+    return (rhs == lhs);
+  }
+
+  template <typename T>
+  bool operator==(const CType_ref<T>& lhs, const CType_ref<T>& rhs)
+  {
+    if ((lhs.isEmpty() && !rhs.isEmpty()) || (!lhs.isEmpty() && rhs.isEmpty())) return false;
+    if (lhs.isEmpty() && rhs.isEmpty()) return true;
+    
+    return (*lhs.ptrValue == *rhs.ptrValue);
+  }
   
   template <typename T>
