Index: /XIOS/trunk/src/type/type.hpp
===================================================================
--- /XIOS/trunk/src/type/type.hpp	(revision 747)
+++ /XIOS/trunk/src/type/type.hpp	(revision 748)
@@ -13,10 +13,10 @@
 
   template <typename T> class CType_ref ;
-    
-  template <typename T> 
+
+  template <typename T>
   class CType : public  virtual CBaseType
   {
     public:
-  
+
     CType(void) ;
     CType(const T& val) ;
@@ -35,5 +35,6 @@
     CType& operator = (const CType_ref<T>& val) ;
     operator T&() ;
-    
+    operator const T&() const ;
+
     inline virtual CBaseType* clone(void) const   { return _clone(); }
     virtual void fromString(const string& str)   { _fromString(str); }
@@ -42,17 +43,17 @@
     virtual bool toBuffer(CBufferOut& buffer) const { return _toBuffer(buffer); }
     virtual void reset(void) { _reset(); }
-    virtual bool isEmpty() const { return _isEmpty(); } 
+    virtual bool isEmpty() const { return _isEmpty(); }
     virtual size_t size(void) const { return _size(); }
-    
+
     void allocate(void) ;
     void checkEmpty(void) const;
-       
+
     T* ptrValue ;
     bool empty ;
-      
-    friend class CType_ref<T> ; 
- 
+
+    friend class CType_ref<T> ;
+
     private :
- 
+
     CType* _clone(void) const;
     void _fromString(const string& str) ;
@@ -61,17 +62,17 @@
     bool _toBuffer(CBufferOut& buffer) const;
     void _reset(void) ;
-    bool _isEmpty() const ;  
+    bool _isEmpty() const ;
     size_t _size(void) const ;
- 
+
   } ;
 
 
   template<typename T> class CType ;
-    
-  template <typename T> 
+
+  template <typename T>
   class CType_ref : public virtual CBaseType
   {
     public:
-  
+
     CType_ref(void) ;
     CType_ref(T& val) ;
@@ -89,5 +90,5 @@
     void set_ref(CType<T>& val) ;
     void set_ref(const CType_ref& val) ;
-    
+
     const CType_ref& operator = (T& val) const ;
     const CType_ref& operator = (CType<T>& val) const ;
@@ -103,16 +104,16 @@
     virtual bool toBuffer(CBufferOut& buffer) const { return _toBuffer(buffer); }
     virtual void reset(void) { _reset(); }
-    virtual bool isEmpty() const { return _isEmpty(); } 
+    virtual bool isEmpty() const { return _isEmpty(); }
     virtual size_t size(void) const { return _size(); }
 
     void checkEmpty(void) const;
-    
+
 
     T mutable * ptrValue ;
     bool empty ;
     friend class CType<T> ;
-    
+
     private :
-    
+
     CType_ref* _clone(void) const;
     void _fromString(const string& str) ;
@@ -123,11 +124,11 @@
     bool _toBuffer(CBufferOut& buffer) const;
     void _reset(void) ;
-    bool _isEmpty() const ;  
+    bool _isEmpty() const ;
     size_t _size(void) const ;
   } ;
-  
-  
+
+
   class CMessage ;
-  
+
   template <typename T>
   CBufferOut& operator<<(CBufferOut& buffer, const CType<T>& type) ;
@@ -135,8 +136,8 @@
   template <typename T>
   CBufferOut& operator<<(CBufferOut& buffer, const CType_ref<T>& type) ;
-  
+
   template <typename T>
   CBufferOut& operator<<(CBufferOut& buffer, const T& type) ;
-  
+
   template <typename T>
   CBufferOut& operator<<(CBufferOut& buffer, T& type) ;
@@ -158,6 +159,6 @@
   template <typename T>
   CMessage& operator<<(CMessage& msg, const CType_ref<T>& type) ;
-*/  
-  
+*/
+
   template <typename T>
   CMessage& operator<<(CMessage& msg, const T& type) ;
Index: /XIOS/trunk/src/type/type_impl.hpp
===================================================================
--- /XIOS/trunk/src/type/type_impl.hpp	(revision 747)
+++ /XIOS/trunk/src/type/type_impl.hpp	(revision 748)
@@ -13,7 +13,7 @@
 namespace xios
 {
- 
+
   using namespace std;
-  
+
   template <typename T>
   CType<T>::CType(void)
@@ -21,5 +21,5 @@
     empty=true ;
   }
-    
+
   template <typename T>
   CType<T>::CType(const T& val)
@@ -28,5 +28,5 @@
     set(val) ;
   }
-  
+
   template <typename T>
   CType<T>::CType(const CType<T>& type)
@@ -41,11 +41,11 @@
     empty=true ;
     set(type) ;
-  }  
-  
+  }
+
   template <typename T>
   void CType<T>::set(const T& val)
   {
-    if (empty) 
-    { 
+    if (empty)
+    {
       ptrValue = new T(val) ;
       empty=false ;
@@ -61,5 +61,5 @@
     {
       if (empty)
-      { 
+      {
         ptrValue = new T(*type.ptrValue) ;
         empty=false ;
@@ -76,5 +76,5 @@
     {
       if (empty)
-      { 
+      {
         ptrValue = new T(*type.ptrValue) ;
         empty=false ;
@@ -97,5 +97,5 @@
     return *ptrValue ;
   }
-  
+
   template <typename T>
   CType<T>& CType<T>::operator = (const T& val)
@@ -104,5 +104,5 @@
     return *this ;
   }
-  
+
   template <typename T>
   CType<T>& CType<T>::operator = (const CType<T>& type)
@@ -111,5 +111,5 @@
     return *this ;
   }
-  
+
   template <typename T>
   CType<T>& CType<T>::operator = (const CType_ref<T>& type)
@@ -118,7 +118,14 @@
     return *this ;
   }
-  
+
    template <typename T>
    CType<T>::operator T&()
+   {
+    checkEmpty();
+    return *ptrValue ;
+   }
+
+   template <typename T>
+   CType<T>::operator const T&() const
    {
     checkEmpty();
@@ -133,5 +140,5 @@
    }
 
-  
+
   template <typename T>
   void CType<T>::_fromString(const string& str)
@@ -147,5 +154,5 @@
     return sizeof(T) ;
   }
-  
+
   template <typename T>
   bool CType<T>::_isEmpty(void) const
@@ -153,5 +160,5 @@
     return empty ;
   }
-  
+
   template <typename T>
   string CType<T>::_toString(void) const
@@ -162,5 +169,5 @@
     return oss.str() ;
   }
-  
+
   template <typename T>
   bool CType<T>::_toBuffer(CBufferOut& buffer) const
@@ -169,5 +176,5 @@
     return buffer.put(*ptrValue) ;
   }
-  
+
   template <typename T>
   bool CType<T>::_fromBuffer(CBufferIn& buffer)
@@ -176,10 +183,10 @@
     return buffer.get(*ptrValue) ;
   }
- 
+
 
   template <typename T>
   void CType<T>::allocate(void)
   {
-    if (empty) 
+    if (empty)
     {
       ptrValue = new T ;
@@ -187,9 +194,9 @@
     }
   }
-  
+
   template <typename T>
   void CType<T>::_reset(void)
   {
-    if (!empty) 
+    if (!empty)
     {
       delete ptrValue ;
@@ -197,12 +204,12 @@
     }
   }
-  
+
   template <typename T>
   void CType<T>::checkEmpty(void) const
   {
     if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ;
-  }  
-
-  
+  }
+
+
   template <typename T>
   CBufferOut& operator<<(CBufferOut& buffer, const CType<T>& type)
