Index: /XMLIO_V2/dev/common/Doxyfile
===================================================================
--- /XMLIO_V2/dev/common/Doxyfile	(revision 299)
+++ /XMLIO_V2/dev/common/Doxyfile	(revision 300)
@@ -620,5 +620,5 @@
 # with spaces.
 
-INPUT                  = src/xmlio
+INPUT                  = src
 
 # This tag can be used to specify the character encoding of the source files 
Index: /XMLIO_V2/dev/common/bld.cfg
===================================================================
--- /XMLIO_V2/dev/common/bld.cfg	(revision 299)
+++ /XMLIO_V2/dev/common/bld.cfg	(revision 300)
@@ -27,5 +27,6 @@
 bld::lib xios
 bld::target libxios.a
-bld::target main_server.exe 
+#bld::target main_server.exe test_xios.exe 
+bld::target server_main.exe test_cs.exe 
 bld::exe_dep
 
@@ -43,4 +44,5 @@
 bld::pp              false
 bld::excl_dep        use::mod_prism_get_comm
+bld::excl_dep        use::mod_prism_get_localcomm_proto
 bld::excl_dep        use::mod_prism_proto
 bld::excl_dep        inc::mpif.h
Index: /XMLIO_V2/dev/common/src/array.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/array.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/array.hpp	(revision 300)
@@ -9,7 +9,16 @@
 /// xmlioserver headers ///
 #include "xmlioserver_spl.hpp"
+#include "buffer_in.hpp"
+#include "buffer_out.hpp"
+
 
 namespace xmlioserver
 {
+   template<size_t numDims>
+   detail::multi_array::extent_gen<numDims> getExtentNull(void) { return getExtentNull<numDims-1>()[0];}
+   
+   template<>
+   detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; }
+
    /// ////////////////////// DÃ©clarations ////////////////////// ///
    template <typename ValueType, StdSize  NumDims,
@@ -29,4 +38,6 @@
             explicit CArray(const ExtentList & sizes);
 
+         explicit CArray();
+
          template <typename ExtentList>
             CArray(const ExtentList & sizes, const boost::general_storage_order<NumDims> & store);
@@ -36,5 +47,5 @@
 
       public:
-      
+
          /// Flux ///
          template <typename U, StdSize V, typename W>
@@ -51,8 +62,14 @@
          void fromBinary(StdIStream & is);
 
+         size_t getSize(void) const ;
+         bool toBuffer  (CBufferOut& buffer) const;
+         bool fromBuffer(CBufferIn& buffer);
+
+
          /// Destructeur ///
          virtual ~CArray(void);
 
    }; // class CArray
+   
 
    ///---------------------------------------------------------------
Index: /XMLIO_V2/dev/common/src/array_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/array_impl.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/array_impl.hpp	(revision 300)
@@ -3,4 +3,6 @@
 
 #include "array_mac.hpp"
+#include "buffer_in.hpp"
+#include "buffer_out.hpp"
 
 namespace xmlioserver
@@ -16,4 +18,10 @@
    { /* Ne rien faire de plus */ }
 
+   template <typename ValueType, StdSize NumDims, typename Allocator>
+       CArray<ValueType, NumDims, Allocator>::CArray()
+            : boost::multi_array<ValueType, NumDims, Allocator>
+                  (getExtentNull<NumDims>(), boost::fortran_storage_order())
+   { /* Ne rien faire de plus */ }
+   
    template <typename ValueType, StdSize NumDims, typename Allocator>
       template <typename ExtentList>
@@ -33,8 +41,9 @@
                                 const CArray<ValueType, NumDims, Allocator> & array)
    {
-      os << (array.data()[0]) << "(" << array.shape()[0];
+      os << "CArray (" ;
       for (StdSize i = 1; i < array.num_dimensions(); i++)
          os << ", " << array.shape()[i];
-      os << ")" << (array.data()[array.num_elements()-1]);
+      os << ") = " ; 
+      for (StdSize i = 0; i < array.num_elements(); i++) os << (array.data()[i])<<"  ";
       return (os);
    }
@@ -108,4 +117,59 @@
       is.read (reinterpret_cast<char*>(this->data()), nelem * sizeof(ValueType));
    }
+  
+    template <typename ValueType, StdSize NumDims, typename Allocator>
+    size_t CArray<ValueType, NumDims, Allocator>::getSize(void) const
+   {
+      typedef boost::multi_array_types::size_type LSize;
+      LSize nelem = this->num_elements();
+      LSize ndim  = this->num_dimensions();
+      const LSize * shape = this->shape();
+      const ValueType * data = this->data();
+      size_t ret ;
+      ret=sizeof(ndim) ;
+      for (LSize i = 0; i < ndim; i++ ) ret+=sizeof(shape[i]) ;
+      ret+=sizeof(nelem) ;
+      ret+=sizeof(ValueType)*nelem ;
+      return ret ;
+   }
+
+   template <typename ValueType, StdSize NumDims, typename Allocator>
+   bool CArray<ValueType, NumDims, Allocator>::toBuffer(CBufferOut& buffer) const
+   {
+      typedef boost::multi_array_types::size_type LSize;
+
+      LSize nelem = this->num_elements();
+      LSize ndim  = this->num_dimensions();
+      const LSize* shape = this->shape();
+      const ValueType* data = this->data();
+      bool ret ;
+      
+      ret=buffer.put(ndim) ;
+      for (LSize i = 0; i < ndim; i++ ) ret&=buffer.put(shape[i]) ;
+      ret&=buffer.put(nelem) ;
+      ret&=buffer.put(data,nelem) ;
+      return ret ;
+  }
+
+   template <typename ValueType, StdSize NumDims, typename Allocator>
+   bool CArray<ValueType, NumDims, Allocator>::fromBuffer(CBufferIn& buffer)
+   {
+      typedef boost::multi_array_types::size_type LSize;
+      LSize ndim = 0, nelem = 0, temp = 0;
+      std::vector<LSize> shape;
+      bool ret ;
+      
+      ret=buffer.get(ndim) ;
+      for (LSize i = 0; i < ndim; i++ )
+      {
+         ret&=buffer.get(temp) ;
+         shape.push_back(temp);
+      }
+      this->resize(shape);
+      ret&=buffer.get(nelem) ;
+      ret&=buffer.get(this->data(),nelem) ;
+      return ret ;
+   }
+   
 
    ///---------------------------------------------------------------
Index: /XMLIO_V2/dev/common/src/attribute.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/attribute.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/attribute.cpp	(revision 300)
@@ -1,3 +1,4 @@
 #include "attribute.hpp"
+#include "base_type.hpp"
 
 namespace xmlioserver
@@ -7,10 +8,10 @@
       /// ////////////////////// DÃ©finitions ////////////////////// ///
       CAttribute::CAttribute(const StdString & id)
-         : CObject(id)
+         : CObject(id), CBaseType()
          , value()
       { /* Ne rien faire de plus */ }
 
       CAttribute::CAttribute(const CAttribute & attribut)
-         : CObject(attribut.getId())
+         : CObject(attribut.getId()),CBaseType()
       { 
          this->value = attribut.getAnyValue(); 
@@ -50,6 +51,36 @@
       }
       
+
       ///--------------------------------------------------------------
 
    } // namespace tree
+      
+      CMessage& operator<<(CMessage& msg,tree::CAttribute& type)
+      {
+        msg.push(type) ;
+        return msg ;
+      }
+
+     CMessage& operator<<(CMessage& msg, const tree::CAttribute&  type)
+     {
+       msg.push(*type.duplicate()) ;
+       return msg ;
+     }
+ 
+      CBufferOut& operator<<(CBufferOut& buffer, tree::CAttribute&  type)
+     {
+    
+       if (!type.toBuffer(buffer)) ERROR("CBufferOut& operator<<(CBufferOut& buffer, tree::CAttribute&  type)",
+                                           <<"Buffer remain size is to low for size type") ;
+      return buffer ;
+     }
+     
+     CBufferIn& operator>>(CBufferIn& buffer, tree::CAttribute&  type)
+     {
+    
+       if (!type.fromBuffer(buffer)) ERROR("CBufferInt& operator>>(CBufferIn& buffer, tree::CAttribute&  type)",
+                                           <<"Buffer remain size is to low for size type") ;
+       return buffer ;
+     }
+
 } // namespace xmlioserver
Index: /XMLIO_V2/dev/common/src/attribute.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/attribute.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/attribute.hpp	(revision 300)
@@ -8,4 +8,8 @@
 #include "xmlioserver_spl.hpp"
 #include "object.hpp"
+#include "base_type.hpp"
+#include "message.hpp"
+#include "buffer_in.hpp"
+#include "buffer_out.hpp"
 
 namespace xmlioserver
@@ -14,5 +18,5 @@
    {
       /// ////////////////////// DÃ©clarations ////////////////////// ///
-      class CAttribute : public CObject
+      class CAttribute : public CObject, public CBaseType
       {
             typedef CObject SuperClass;
@@ -29,4 +33,5 @@
             const boost::any & getAnyValue(void) const;
             template <typename T> inline T getValue(void) const;
+            template <typename T> inline T* getRef(void);
 
             /// Mutateurs ///
@@ -54,6 +59,4 @@
             CAttribute(void);  // Not implemented.
 
-         private :
-
             /// PropriÃ©tÃ© ///
             boost::any value;
@@ -66,4 +69,10 @@
       { 
          return (boost::any_cast<T>(this->value)); 
+      }
+
+      template <typename T>
+         T* CAttribute::getRef(void)
+      { 
+         return (boost::any_cast<T>(&value)); 
       }
 
@@ -81,5 +90,12 @@
 
    } // namespace tree
-} // namespace xmlioserver
+ 
+   CMessage& operator<<(CMessage& msg,tree::CAttribute& type) ;
+   CMessage& operator<<(CMessage& msg, const tree::CAttribute&  type) ;
+ 
+   CBufferOut& operator<<(CBufferOut& buffer,tree::CAttribute& type) ;
+   CBufferIn& operator>>(CBufferIn& buffer, tree::CAttribute&  type) ;
+}
+  // namespace xmlioserver
 
 #endif // __XMLIO_CAttribute__
Index: /XMLIO_V2/dev/common/src/attribute_template.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/attribute_template.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/attribute_template.cpp	(revision 300)
@@ -99,4 +99,5 @@
 
          iss >> d; vect.push_back(d);
+         size = vect.size();
          if (!iss.eof ())
          {
@@ -138,5 +139,5 @@
          array.resize(boost::extents[size]);
          for (int i = 0; i < size; i++)
-            array[i] = vect[i];
+            array[i] = vect[i]; 
 
       }
Index: /XMLIO_V2/dev/common/src/attribute_template.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/attribute_template.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/attribute_template.hpp	(revision 300)
@@ -10,4 +10,7 @@
 #include "array.hpp"
 #include "attribute.hpp"
+#include "buffer_in.hpp"
+#include "buffer_out.hpp"
+
 
 namespace xmlioserver
@@ -40,4 +43,5 @@
             /// Accesseur ///
             inline ValueType getValue(void) const;
+            inline ValueType* getRef(void) ;
 
             /// Mutateurs ///
@@ -57,4 +61,9 @@
             virtual void fromBinary(StdIStream & is);            
 
+            virtual bool toBuffer  (CBufferOut& buffer) const;
+            virtual bool fromBuffer(CBufferIn& buffer) ;
+            virtual size_t size(void) const;
+   
+
          protected :
 
Index: /XMLIO_V2/dev/common/src/attribute_template_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/attribute_template_impl.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/attribute_template_impl.hpp	(revision 300)
@@ -3,4 +3,7 @@
 
 #include "array.hpp"
+#include "type.hpp"
+#include "buffer_in.hpp"
+#include "buffer_out.hpp"
 
 namespace xmlioserver
@@ -69,4 +72,16 @@
 
       template <class T>
+         T* CAttributeTemplate<T>::getRef(void)
+      {
+         if (SuperClass::isEmpty())
+         {
+            ERROR("T CAttributeTemplate<T>::getValue(void) const",
+                  << "[ id = " << this->getId() << "]"
+                  << " L'attribut est requis mais n'est pas dÃ©fini !");
+          }
+         return (SuperClass::getRef<T>());
+      }
+
+      template <class T>
          void CAttributeTemplate<T>::setValue(const T & value)
       {
@@ -115,4 +130,53 @@
          FromBinary(is, value);
          this->setValue(value);
+      }
+
+      template <class T>
+         bool CAttributeTemplate<T>::toBuffer (CBufferOut& buffer) const
+      {
+         if (isEmpty()) return buffer.put(true) ;
+         else
+         {
+           bool ret=true ;
+           CType<T> val(*boost::any_cast<T>(&value)) ;
+           ret&=buffer.put(false) ;
+           ret&=val.toBuffer(buffer) ;
+           return ret ;
+         }
+      }
+
+      template <class T>
+      bool CAttributeTemplate<T>::fromBuffer(CBufferIn& buffer)
+      {
+        bool empty ;
+        bool ret=true ;
+        ret&=buffer.get(empty) ;
+        if (empty) 
+        {
+          clear() ;
+          return ret ;
+        }
+        else
+        {
+          if (isEmpty())
+          {
+            T val ;
+            setValue(val) ;
+          }
+          T* V=const_cast<T*>(boost::any_cast<T>(&value)) ;
+          CType<T> val(*V) ;
+          return val.fromBuffer(buffer) ;
+        }
+      }
+
+      template <class T>
+      size_t CAttributeTemplate<T>::size(void) const
+      {
+        if (isEmpty()) return sizeof(bool) ;
+        else
+        {
+          CType<T> val(*const_cast<T*>(boost::any_cast<T>(&value))) ;
+          return val.size()+sizeof(bool) ;
+        }
       }
 
Index: /XMLIO_V2/dev/common/src/buffer_client.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_client.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_client.cpp	(revision 300)
@@ -0,0 +1,99 @@
+#include "xmlioserver_spl.hpp"
+#include "exception.hpp"
+#include "buffer_out.hpp"
+#include "buffer_client.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  int CClientBuffer::bufferSizeByServer=50*1024*1024 ;
+//  int CClientBuffer::bufferSizeByServer=1024*10 ;
+
+  CClientBuffer::CClientBuffer(MPI_Comm interComm_,int serverRank_)
+  {
+    interComm=interComm_ ;
+    serverRank=serverRank_ ;
+    bufferSize=bufferSizeByServer/2 ;
+    buffer[0]=new char[bufferSize] ; // transform it with MPI_ALLOC_MEM later
+    buffer[1]=new char[bufferSize] ;
+    current=0 ;
+    count=0 ;
+    pending=false ;
+    retBuffer=new CBufferOut(buffer[current],bufferSize) ;
+  }
+  
+  CClientBuffer::~CClientBuffer()
+  {
+   delete [] buffer[0] ;
+   delete [] buffer[1] ;
+   delete retBuffer ;
+  }
+  
+  int CClientBuffer::remain(void)
+  {
+    return bufferSize-count ;
+  }
+  
+  bool CClientBuffer::isBufferFree(int size)
+  {
+    if (size>bufferSize) ERROR("CClientBuffer::hasSpace(int size)",
+                               <<"request size is too big for buffer, increase buffer client size");
+ 
+    if (size<=remain()) return true ;
+    else return false ;
+  }
+    
+  
+  CBufferOut*  CClientBuffer::getBuffer(int size)
+  {
+    if (size<=remain())
+    {
+      retBuffer->realloc(buffer[current]+count,size) ;
+      count+=size ;
+      return retBuffer ;
+    }
+    else
+    {
+       ERROR("CBufferOut*  CClientBuffer::getSpace(int size) ;",
+               <<"No ennough space in buffer, that may not happen...");
+       return NULL ;
+    }
+ 
+  }  
+  
+  bool CClientBuffer::checkBuffer(void)
+  {
+    MPI_Status status ;
+    int flag ;
+    
+    if (pending)
+    {
+      MPI_Test(&request,&flag,&status) ;
+      if (flag==true) pending=false ;
+    }
+
+    if (!pending)
+    {
+      if (count>0)
+      {
+        MPI_Issend(buffer[current],count,MPI_CHAR,serverRank,20,interComm,&request) ;
+        pending=true ;
+        if (current==1) current=0 ;
+        else current=1 ;
+        count=0 ;
+      }
+    }
+    return pending ;
+  }
+  
+  bool CClientBuffer::hasPendingRequest(void)
+  {
+    if (pending) return true ;
+    else if (count>0) return true ;
+    else return false ;
+  }
+    
+  
+  
+}    
+    
Index: /XMLIO_V2/dev/common/src/buffer_client.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_client.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_client.hpp	(revision 300)
@@ -0,0 +1,42 @@
+#ifndef __BUFFER_CLIENT_HPP__
+#define __BUFFER_CLIENT_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "buffer_out.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  class CClientBuffer
+  {
+    
+    public:
+    
+    CClientBuffer(MPI_Comm intercomm,int serverRank) ;
+    ~CClientBuffer() ;
+    bool isBufferFree(int size) ;
+    CBufferOut*  getBuffer(int size) ;    
+    bool checkBuffer(void) ;
+    bool hasPendingRequest(void) ;
+    
+    char* buffer[2] ;
+    int remain(void) ;
+
+    int current ;
+    int count ;
+    int bufferSize ;
+    int serverRank ;
+    bool pending ;
+    
+    static int bufferSizeByServer ;
+    
+    MPI_Request request ;
+    
+    CBufferOut* retBuffer;    
+    MPI_Comm interComm ;
+  } ;
+
+}
+
+#endif
+
Index: /XMLIO_V2/dev/common/src/buffer_in.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_in.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_in.cpp	(revision 300)
@@ -0,0 +1,69 @@
+#include "xmlioserver_spl.hpp"
+#include "buffer_in.hpp"
+
+
+namespace xmlioserver
+{
+    CBufferIn::CBufferIn(void* buffer,size_t size)
+    {
+      own=false ;
+      realloc(buffer,size) ;
+    }
+    
+    CBufferIn::CBufferIn(size_t size)
+    {
+      own=false ;
+      realloc(size) ;
+    }
+
+    CBufferIn::CBufferIn(void)
+    {
+      own=false ;
+      realloc(0,0) ;      
+    }
+
+    void CBufferIn::realloc(size_t size)
+    {
+      realloc(new char[size_],size) ;
+      own=true ;
+    }
+
+    void CBufferIn::realloc(void* buffer,size_t size)
+    {
+      if (own) delete [] begin ;
+      begin=(char*)buffer ;
+      size_=size ;
+      current=begin ;
+      end=begin+size_ ;
+      count_=0 ;
+      own=false ;
+    }
+
+    bool CBufferIn::advance(size_t n) { return advance<char>(n); }
+
+    size_t CBufferIn::remain(void)
+    {
+      return size_-count_ ;
+    }    
+
+    size_t CBufferIn::count(void)
+    {
+      return count_ ;
+    }
+
+    size_t CBufferIn::size(void)
+    {
+      return size_ ;
+    }
+    
+    CBufferIn::~CBufferIn()
+    {
+      if (own) delete [] begin ;
+    }
+
+    void* CBufferIn::ptr(void) { return current; }
+    
+}
+    
+      
+    
Index: /XMLIO_V2/dev/common/src/buffer_in.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_in.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_in.hpp	(revision 300)
@@ -0,0 +1,64 @@
+#ifndef __BUFFER_IN_HPP__
+#define __BUFFER_IN_HPP__
+
+
+#include "xmlioserver_spl.hpp"
+
+namespace xmlioserver
+{
+  
+    class CBufferIn
+    {
+    
+      public:
+      
+      CBufferIn(size_t size) ;
+      CBufferIn(void) ;
+      CBufferIn(void* buffer,size_t size) ;
+
+      void realloc(size_t size) ;
+      void realloc(void* buffer,size_t size) ;
+      
+
+      template<class T>
+      bool advance(size_t n) ;
+
+      bool advance(size_t n) ;
+      
+      template<class T>
+      bool get(T& data) ;
+
+      template<class T>
+      bool get(T* data, size_t n) ;
+
+      template<class T>
+      bool advance_template(size_t n) ;
+      
+      template<class T>
+      bool get_template(T& data) ;
+
+      template<class T>
+      bool get_template(T* data, size_t n) ;
+
+      void* ptr(void) ;
+
+      
+      size_t remain(void) ;
+      size_t count(void) ;                          
+      size_t size(void) ;                         
+      ~CBufferIn() ;
+
+       char* begin ;
+       char* end ;
+       char* current ;
+       size_t count_ ;
+       size_t size_ ;   
+       bool own ; 
+    } ;
+  
+}
+
+#include "buffer_in_impl.hpp" 
+
+
+#endif
Index: /XMLIO_V2/dev/common/src/buffer_in_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_in_impl.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_in_impl.hpp	(revision 300)
@@ -0,0 +1,94 @@
+#ifndef __BUFFER_IN_IMPL_HPP__
+#define __BUFFER_IN_IMPL_HPP__
+
+namespace xmlioserver
+{
+
+// template spectialisation : CBufferIn::get
+
+    template <> bool CBufferIn::get<char>(char& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<bool>(bool& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<int>(int& data)   { return get_template(data) ; }
+    template <> bool CBufferIn::get<short>(short& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<long>(long& data)  { return get_template(data) ; }  
+    template <> bool CBufferIn::get<uint>(uint& data)  { return get_template(data) ; }  
+    template <> bool CBufferIn::get<ushort>(ushort& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<ulong>(ulong& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<float>(float& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<double>(double& data) { return get_template(data) ; }  
+    template <> bool CBufferIn::get<long double>(long double& data) { return get_template(data) ;}  
+
+    template <> bool CBufferIn::get<char>(char* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<bool>(bool* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<int>(int* data, size_t n)   { return get_template(data,n) ; }
+    template <> bool CBufferIn::get<short>(short* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<long>(long* data, size_t n)  { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<uint>(uint* data, size_t n)  { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<ushort>(ushort* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<ulong>(ulong* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<float>(float* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<double>(double* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBufferIn::get<long double>(long double* data, size_t n) { return get_template(data,n) ;}  
+
+    template <> bool CBufferIn::advance<char>(size_t n) { return advance_template<char>(n) ; }  
+    template <> bool CBufferIn::advance<bool>(size_t n) { return advance_template<bool>(n) ; }  
+    template <> bool CBufferIn::advance<int>(size_t n)   { return advance_template<int>(n) ; }
+    template <> bool CBufferIn::advance<short>(size_t n) { return advance_template<short>(n) ; }  
+    template <> bool CBufferIn::advance<long>(size_t n)  { return advance_template<long>(n) ; }  
+    template <> bool CBufferIn::advance<uint>(size_t n)  { return advance_template<uint>(n) ; }  
+    template <> bool CBufferIn::advance<ushort>(size_t n) { return advance_template<ushort>(n) ; }  
+    template <> bool CBufferIn::advance<ulong>(size_t n) { return advance_template<ulong>(n) ; }  
+    template <> bool CBufferIn::advance<float>(size_t n) { return advance_template<float>(n) ; }  
+    template <> bool CBufferIn::advance<double>(size_t n) { return advance_template<double>(n) ; }  
+    template <> bool CBufferIn::advance<long double>(size_t n) { return advance_template<long double>(n) ;}  
+
+    template <class T>
+    bool CBufferIn::get_template(T& data)
+    {
+      return get_template<T>(&data,1) ;
+    }
+        
+    template <class T>
+    bool CBufferIn::get_template(T* data, size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (count_+dataSize<=size_)
+      {
+        dataBuff=(char*) data ;
+        for(size_t i=0;i<dataSize;i++) dataBuff[i]=current[i] ;
+        current+=dataSize ;
+        count_+=dataSize ;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }
+
+    template <class T>
+    bool CBufferIn::advance_template(size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (count_+dataSize<=size_)
+      {
+        current+=dataSize ;
+        count_+=dataSize ;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }    
+
+}
+  
+
+#endif
Index: /XMLIO_V2/dev/common/src/buffer_list.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_list.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/buffer_list.cpp	(revision 300)
@@ -36,5 +36,4 @@
                   if (SuperClass::operator[](i-1).isAvailable(size))
                   {
-                     //std::cout << "DonnÃ©es reÃ§ues de " << i << std::endl;
                      CMPIManager::ReceiveCircularBuffer
                         (com_client_server, i, SuperClass::operator[](i-1));
@@ -51,12 +50,5 @@
          }
          
-         //static int u = 0;
-         //std::cout << "Nouvelle requÃªte disponible " << u++ << std::endl;
-         /*if (u == 3046)
-            for (int i = 1; i < CMPIManager::GetCommSize(com_client_server); i++)
-            {
-               StdOStringStream oss; oss << "data/buffer"<<i<<".txt";
-               SuperClass::operator[](i-1).printToTextFile (oss.str());
-            }*/
+
             
          return (true);
@@ -67,5 +59,4 @@
          for (StdSize i = 0; i < this->nbbuffer; i++)
          {
-            //std::cout << "RÃ©cupÃ©ration de la requÃªte " << (i+1) << std::endl;
             lbuffer.push_back(SuperClass::operator[](i).getNextRequest());
          }
Index: /XMLIO_V2/dev/common/src/buffer_out.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_out.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_out.cpp	(revision 300)
@@ -0,0 +1,75 @@
+#include "xmlioserver_spl.hpp"
+#include "buffer_out.hpp"
+
+
+namespace xmlioserver
+{
+  namespace ym
+  {
+    CBufferOut::CBufferOut(void* buffer,size_t size)
+    {
+      own=false ;
+      realloc(buffer,size) ;
+    }
+    
+    CBufferOut::CBufferOut(void)
+    {
+      own=false ;
+      realloc(0,0) ;      
+    }
+
+    CBufferOut::CBufferOut(size_t size)
+    {
+      own=false ;
+      realloc(size) ;
+    }
+
+    void CBufferOut::realloc(size_t size)
+    {
+      realloc(new char[size],size) ;
+      own=true ;
+    }
+
+    void CBufferOut::realloc(void* buffer,size_t size)
+    {
+      if (own) delete [] begin ;
+      begin=(char*)buffer ;
+      size_=size ;
+      end=begin+size_ ;
+      count_=0 ;
+      current=begin ;
+      own=false ;
+    }
+
+    bool CBufferOut::advance(size_t n) { return advance<char>(n); }
+
+    void* CBufferOut::ptr(void)
+    {
+      return current ;
+    }
+    
+    size_t CBufferOut::remain(void)
+    {
+      return size_-count_ ;
+    }    
+
+    size_t CBufferOut::count(void)
+    {
+      return count_ ;
+    }
+
+    size_t CBufferOut::size(void)
+    {
+      return size_ ;
+    }
+        
+    CBufferOut::~CBufferOut()
+    {
+      if (own) delete [] begin ;
+    }
+    
+  }
+}
+    
+      
+    
Index: /XMLIO_V2/dev/common/src/buffer_out.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_out.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_out.hpp	(revision 300)
@@ -0,0 +1,66 @@
+#ifndef __BUFFER_OUT_HPP__
+#define __BUFFER_OUT_HPP__
+
+
+#include "xmlioserver_spl.hpp"
+
+namespace xmlioserver
+{
+  
+    class CBufferOut
+    {
+    
+      public:
+      
+      CBufferOut(size_t size) ;
+      CBufferOut(void) ;
+      CBufferOut(void* buffer,size_t size) ;
+
+      void realloc(size_t size) ;
+      void realloc(void* buffer,size_t size) ;
+      
+      template<class T>
+      bool put(const T& data) ;
+
+      template<class T>
+      bool put(const T* data, size_t n) ;
+
+    
+      template<class T>
+      bool advance(size_t n) ;
+
+      bool advance(size_t n) ;
+      
+       
+ 
+      template<class T>
+      bool put_template(const T& data) ;
+
+      template<class T>
+      bool put_template(const T* data, size_t n) ;
+
+      template<class T>
+      bool advance_template(size_t n) ;
+      
+      void* ptr(void) ;
+            
+      size_t remain(void) ;
+      size_t count(void) ;
+      size_t size(void) ;
+                            
+      ~CBufferOut() ;
+       char* begin ;
+       char* current ;
+       char* end;
+       size_t count_ ;
+       size_t size_ ;
+       bool own ; 
+    } ;
+    
+
+}
+
+#include "buffer_out_impl.hpp" 
+
+
+#endif
Index: /XMLIO_V2/dev/common/src/buffer_out_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_out_impl.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_out_impl.hpp	(revision 300)
@@ -0,0 +1,94 @@
+#ifndef __BUFFER_OUT_IMPL_HPP__
+#define __BUFFER_OUT_IMPL_HPP__
+
+namespace xmlioserver
+{
+
+// template spectialisation : CBufferIn::put
+    template <> bool CBufferOut::put<char>(const char& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<bool>(const bool& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<int>(const int& data)   { return put_template(data) ; }
+    template <> bool CBufferOut::put<short>(const short& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<long>(const long& data)  { return put_template(data) ; }  
+    template <> bool CBufferOut::put<uint>(const uint& data)  { return put_template(data) ; }  
+    template <> bool CBufferOut::put<ushort>(const ushort& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<ulong>(const ulong& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<float>(const float& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<double>(const double& data) { return put_template(data) ; }  
+    template <> bool CBufferOut::put<long double>(const long double& data) { return put_template(data) ;}  
+
+    template <> bool CBufferOut::put<char>(const char* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<bool>(const bool* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<int>(const int* data, size_t n)   { return put_template(data,n) ; }
+    template <> bool CBufferOut::put<short>(const short* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<long>(const long* data, size_t n)  { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<uint>(const uint* data, size_t n)  { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<ushort>(const ushort* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<ulong>(const ulong* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<float>(const float* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<double>(const double* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBufferOut::put<long double>(const long double* data, size_t n) { return put_template(data,n) ;}  
+
+
+    template <> bool CBufferOut::advance<char>(size_t n) { return advance_template<char>(n) ; }  
+    template <> bool CBufferOut::advance<bool>(size_t n) { return advance_template<bool>(n) ; }  
+    template <> bool CBufferOut::advance<int>(size_t n)   { return advance_template<int>(n) ; }
+    template <> bool CBufferOut::advance<short>(size_t n) { return advance_template<short>(n) ; }  
+    template <> bool CBufferOut::advance<long>(size_t n)  { return advance_template<long>(n) ; }  
+    template <> bool CBufferOut::advance<uint>(size_t n)  { return advance_template<uint>(n) ; }  
+    template <> bool CBufferOut::advance<ushort>(size_t n) { return advance_template<ushort>(n) ; }  
+    template <> bool CBufferOut::advance<ulong>(size_t n) { return advance_template<ulong>(n) ; }  
+    template <> bool CBufferOut::advance<float>(size_t n) { return advance_template<float>(n) ; }  
+    template <> bool CBufferOut::advance<double>(size_t n) { return advance_template<double>(n) ; }  
+    template <> bool CBufferOut::advance<long double>(size_t n) { return advance_template<long double>(n) ;}  
+
+    template <class T>
+    bool CBufferOut::put_template(const T& data)
+    {
+      return put_template<T>(&data,1);
+    }
+    
+    template <class T>
+    bool CBufferOut::put_template(const T* data, size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (count_+dataSize<=size_)
+      {
+        dataBuff=(char*) data ;
+        for(size_t i=0;i<dataSize;i++) current[i]=dataBuff[i] ;
+        current+=dataSize ;
+        count_+=dataSize;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }
+
+    template <class T>
+    bool CBufferOut::advance_template(size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (count_+dataSize<=size_)
+      {
+        current+=dataSize ;
+        count_+=dataSize;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }
+    
+}
+  
+
+#endif
Index: /XMLIO_V2/dev/common/src/buffer_server.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_server.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_server.cpp	(revision 300)
@@ -0,0 +1,172 @@
+#include "xmlioserver_spl.hpp"
+#include "exception.hpp"
+#include "buffer_server.hpp"
+
+namespace xmlioserver
+{
+  size_t CServerBuffer::bufferSizeByClient=100*1024*1024 ;
+//  size_t CServerBuffer::bufferSizeByClient=20*1024 ;
+
+  CServerBuffer::CServerBuffer(void)
+  {
+    size=bufferSizeByClient ;
+    first=0 ;
+    current=1 ;
+    end=size ;
+    buffer=new char[size] ;  // change later for MPI_ALLOC_MEM later
+  }
+
+  CServerBuffer::~CServerBuffer()
+  {
+    delete [] buffer ;
+  }
+  
+
+  bool CServerBuffer::isBufferFree(size_t count)
+  {
+    bool ret ;
+    
+    if (count==0) return true ;
+    
+    if (current>first)
+    {
+      if (current+count<size)
+      {
+        ret=true ;
+      }
+      else if (current+count==size)
+      {
+        if (first>0)
+        {
+          ret=true ;
+        }
+        else
+        {
+          ret=false ;
+        }
+      }
+      else
+      {
+        if (count<first)
+        {
+          ret=true ;
+        }
+        else
+        {
+          ret=false ;
+        }
+      }
+    }
+    else
+    {
+      if (current+count<first)
+      {
+        ret=true ;
+      }
+      else
+      {
+         ret=false ;
+      }
+    }
+
+    return ret ;
+  }
+  
+
+  void* CServerBuffer::getBuffer(size_t count)
+  {
+    char* ret ;
+    
+    if (count==0) return buffer+current ;
+    
+    if (current>first)
+    {
+      if (current+count<size)
+      {
+        ret=buffer+current ;
+        current+=count ;
+      }
+      else if (current+count==size)
+      {
+        if (first>0)
+        {
+          ret=buffer+current ;
+          current=0 ;
+        }
+        else
+        {
+          ERROR("void* CServerBuffer::getBuffer(size_t count)",
+                 <<"cannot allocate required size in buffer") ;
+        }
+      }
+      else
+      {
+        end=current ;
+        if (count<first)
+        {
+          ret=buffer ;
+          current=count ;
+        }
+        else
+        {
+          ERROR("void* CServerBuffer::getBuffer(size_t count)",
+                 <<"cannot allocate required size in buffer") ;
+        }
+      }
+    }
+    else
+    {
+      if (current+count<first)
+      {
+        ret=buffer+current ;
+        current+=count ;
+      }
+      else
+      {
+          ERROR("void* CServerBuffer::getBuffer(size_t count)",
+                 <<"cannot allocate required size in buffer") ;
+      }
+    }
+
+    return ret ;
+  }
+  
+  void CServerBuffer::freeBuffer(size_t count)
+  {
+    if (count==0) return ;
+
+    if (first==end-1) 
+    {
+      first=0 ;
+      count-- ;
+      end=size ;
+    }
+
+    if (first<=current)
+    {
+      if (first+count <current) 
+      {
+        first+=count ;
+      }
+      else
+      {
+          ERROR("void CServerBuffer::freeBuffer(size_t count)",
+                 <<"cannot free required size in buffer") ;
+      }
+    
+    }
+    else
+    {
+      if (first+count<end)
+      {
+        first+=count ;
+      }
+      else
+      {
+          ERROR("void CServerBuffer::freeBuffer(size_t count)",
+                 <<"cannot free required size in buffer") ;
+      }
+    }
+  }      
+       
+}
Index: /XMLIO_V2/dev/common/src/buffer_server.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_server.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_server.hpp	(revision 300)
@@ -0,0 +1,34 @@
+#ifndef __BUFFER_SERVER_HPP__
+#define __BUFFER_SERVER_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "buffer_ym.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+
+  class CServerBuffer
+  {
+    
+    public:
+    
+    CServerBuffer(void) ;
+    ~CServerBuffer() ;
+    char* buffer ;
+    
+    bool isBufferFree(size_t count) ;
+    void* getBuffer(size_t count) ;
+    void freeBuffer(size_t count) ;
+  
+    size_t first ;   // first occupied element
+    size_t current ; // first free element
+    size_t end ;
+    size_t size ;
+    static size_t bufferSizeByClient ;
+  } ;
+  
+
+}
+
+#endif
Index: /XMLIO_V2/dev/common/src/buffer_ym.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_ym.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_ym.cpp	(revision 300)
@@ -0,0 +1,52 @@
+#include "xmlioserver_spl.hpp"
+#include "buffer_ym.hpp"
+
+
+namespace xmlioserver
+{
+  namespace ym
+  {
+    CBuffer::CBuffer(void* buffer_,size_t size_)
+    {
+      own=false ;
+      realloc(buffer_,size_) ;
+    }
+    
+    CBuffer::CBuffer(size_t size_)
+    {
+      own=false ;
+      realloc(size_) ;
+    }
+
+    void CBuffer::realloc(size_t size_)
+    {
+      realloc(new char[size_],size_) ;
+      own=true ;
+    }
+
+    void CBuffer::realloc(void* buffer_,size_t size_)
+    {
+      if (own) delete [] buffer ;
+      buffer=(char*)buffer_ ;
+      size=size_ ;
+      count=0 ;
+      read=buffer ;
+      write=buffer ;
+      own=false ;
+    }
+
+    size_t CBuffer::remain(void)
+    {
+      return size-count ;
+    }    
+    
+    CBuffer::~CBuffer()
+    {
+      if (own) delete [] buffer ;
+    }
+    
+  }
+}
+    
+      
+    
Index: /XMLIO_V2/dev/common/src/buffer_ym.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_ym.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_ym.hpp	(revision 300)
@@ -0,0 +1,81 @@
+#ifndef __BUFFER_YM_HPP__
+#define __BUFFER_YM_HPP__
+
+
+#include "xmlioserver_spl.hpp"
+
+namespace xmlioserver
+{
+  namespace ym
+  {
+  
+    class CBuffer
+    {
+    
+      public:
+      
+      CBuffer(size_t size) ;
+      CBuffer(void* buffer,size_t size) ;
+
+      void realloc(size_t size) ;
+      void realloc(void* buffer,size_t size) ;
+      
+      template<class T>
+      bool put(const T& data) ;
+
+      template<class T>
+      bool put(const T* data, size_t n) ;
+
+      template<class T>
+      bool put_ptr(const T*& data_ptr, size_t n) ;
+      
+      template<class T>
+      bool get(T& data) ;
+
+      template<class T>
+      bool get(T* data, size_t n) ;
+
+      template<class T>
+      bool get_ptr(T*& data, size_t n) ;
+
+      
+ 
+      template<class T>
+      bool put_template(const T& data) ;
+
+      template<class T>
+      bool put_template(const T* data, size_t n) ;
+
+      template<class T>
+      bool put_ptr_template(const T*& data, size_t n) ;
+      
+      template<class T>
+      bool get_template(T& data) ;
+
+      template<class T>
+      bool get_template(T* data, size_t n) ;
+
+      template<class T>
+      bool get_ptr_template(T*& data, size_t n) ;
+      
+      size_t remain(void) ;
+                            
+      ~CBuffer() ;
+       char* buffer ;
+       char* read ;
+       char* write ;
+       size_t count ;
+       bool own ; 
+       size_t size ;   
+    } ;
+    
+    
+  
+ 
+  }
+}
+
+#include "buffer_ym_impl.hpp" 
+
+
+#endif
Index: /XMLIO_V2/dev/common/src/buffer_ym_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/buffer_ym_impl.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/buffer_ym_impl.hpp	(revision 300)
@@ -0,0 +1,178 @@
+#ifndef __BUFFER_YM_IMPL_HPP__
+#define __BUFFER_YM_IMPL_HPP__
+
+namespace xmlioserver
+{
+  namespace ym
+  {
+
+// template spectialisation : CBuffer::put
+    template <> bool CBuffer::put<char>(const char& data) { return put_template(data) ; }  
+    template <> bool CBuffer::put<int>(const int& data)   { return put_template(data) ; }
+    template <> bool CBuffer::put<short>(const short& data) { return put_template(data) ; }  
+    template <> bool CBuffer::put<long>(const long& data)  { return put_template(data) ; }  
+    template <> bool CBuffer::put<uint>(const uint& data)  { return put_template(data) ; }  
+    template <> bool CBuffer::put<ushort>(const ushort& data) { return put_template(data) ; }  
+    template <> bool CBuffer::put<ulong>(const ulong& data) { return put_template(data) ; }  
+    template <> bool CBuffer::put<float>(const float& data) { return put_template(data) ; }  
+    template <> bool CBuffer::put<double>(const double& data) { return put_template(data) ; }  
+    template <> bool CBuffer::put<long double>(const long double& data) { return put_template(data) ;}  
+
+    template <> bool CBuffer::put<char>(const char* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<int>(const int* data, size_t n)   { return put_template(data,n) ; }
+    template <> bool CBuffer::put<short>(const short* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<long>(const long* data, size_t n)  { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<uint>(const uint* data, size_t n)  { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<ushort>(const ushort* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<ulong>(const ulong* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<float>(const float* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<double>(const double* data, size_t n) { return put_template(data,n) ; }  
+    template <> bool CBuffer::put<long double>(const long double* data, size_t n) { return put_template(data,n) ;}  
+
+
+    template <> bool CBuffer::put_ptr<char>(const char*& data, size_t n) { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<int>(const int*& data, size_t n)   { return put_ptr_template(data,n) ; }
+    template <> bool CBuffer::put_ptr<short>(const short*& data, size_t n) { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<long>(const long*& data, size_t n)  { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<uint>(const uint*& data, size_t n)  { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<ushort>(const ushort*& data, size_t n) { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<ulong>(const ulong*& data, size_t n) { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<float>(const float*& data, size_t n) { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<double>(const double*& data, size_t n) { return put_ptr_template(data,n) ; }  
+    template <> bool CBuffer::put_ptr<long double>(const long double*& data, size_t n) { return put_ptr_template(data,n) ;}  
+
+
+// template spectialisation : CBuffer::get
+    template <> bool CBuffer::get<char>(char& data) { return get_template(data) ; }  
+    template <> bool CBuffer::get<int>(int& data)   { return get_template(data) ; }
+    template <> bool CBuffer::get<short>(short& data) { return get_template(data) ; }  
+    template <> bool CBuffer::get<long>(long& data)  { return get_template(data) ; }  
+    template <> bool CBuffer::get<uint>(uint& data)  { return get_template(data) ; }  
+    template <> bool CBuffer::get<ushort>(ushort& data) { return get_template(data) ; }  
+    template <> bool CBuffer::get<ulong>(ulong& data) { return get_template(data) ; }  
+    template <> bool CBuffer::get<float>(float& data) { return get_template(data) ; }  
+    template <> bool CBuffer::get<double>(double& data) { return get_template(data) ; }  
+    template <> bool CBuffer::get<long double>(long double& data) { return get_template(data) ;}  
+
+    template <> bool CBuffer::get<char>(char* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<int>(int* data, size_t n)   { return get_template(data,n) ; }
+    template <> bool CBuffer::get<short>(short* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<long>(long* data, size_t n)  { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<uint>(uint* data, size_t n)  { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<ushort>(ushort* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<ulong>(ulong* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<float>(float* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<double>(double* data, size_t n) { return get_template(data,n) ; }  
+    template <> bool CBuffer::get<long double>(long double* data, size_t n) { return get_template(data,n) ;}  
+
+    template <> bool CBuffer::get_ptr<char>(char*& data, size_t n) { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<int>(int*& data, size_t n)   { return get_ptr_template(data,n) ; }
+    template <> bool CBuffer::get_ptr<short>(short*& data, size_t n) { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<long>(long*& data, size_t n)  { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<uint>(uint*& data, size_t n)  { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<ushort>(ushort*& data, size_t n) { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<ulong>(ulong*& data, size_t n) { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<float>(float*& data, size_t n) { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<double>(double*& data, size_t n) { return get_ptr_template(data,n) ; }  
+    template <> bool CBuffer::get_ptr<long double>(long double*& data, size_t n) { return get_ptr_template(data,n) ;}  
+    
+    
+    template <class T>
+    bool CBuffer::put_template(const T& data)
+    {
+      return put_template<T>(&data,1);
+    }
+    
+    template <class T>
+    bool CBuffer::put_template(const T* data, size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (count+dataSize<=size)
+      {
+        dataBuff=(char*) data ;
+        for(size_t i=0;i<dataSize;i++) write[i]=dataBuff[i] ;
+        write+=dataSize ;
+        count+=dataSize;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }
+
+    template <class T>
+    bool CBuffer::put_ptr_template(const T*& data, size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (count+dataSize<=size)
+      {
+        data=(T*) write ;
+        write+=dataSize ;
+        count+=dataSize;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }
+
+
+    template <class T>
+    bool CBuffer::get_template(T& data)
+    {
+      return get_template<T>(&data,1) ;
+      
+    }
+        
+    template <class T>
+    bool CBuffer::get_template(T* data, size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (read+dataSize<=buffer+size)
+      {
+        dataBuff=(char*) data ;
+        for(size_t i=0;i<dataSize;i++) dataBuff[i]=read[i] ;
+        read+=dataSize ;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }
+
+    template <class T>
+    bool CBuffer::get_ptr_template(T*& data, size_t n)
+    {
+      bool ret;
+      char* dataBuff ;
+  
+      size_t dataSize=sizeof(T)*n ;
+  
+      if (read+dataSize<=buffer+size)
+      {
+        data=(T*) read ;
+        read+=dataSize ;
+        ret=true ;
+      }
+      else ret=false ;
+  
+      return ret ;
+    }    
+
+  }
+}
+  
+
+#endif
Index: /XMLIO_V2/dev/common/src/calendar.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/calendar.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/calendar.cpp	(revision 300)
@@ -54,6 +54,5 @@
       CDate & CCalendar::update(int step)
       { 
-         std::cout << "step : " << step <<" timestep "<<this->timestep << std::endl;
-//         std::cout << "date before : " << this->getCurrentDate() <<" date after "<<this->getInitDate() + step * this->timestep << std::endl;
+         info(20) << "update step : " << step <<" timestep "<<this->timestep << std::endl;
          return (this->getCurrentDate() = this->getInitDate() + step * this->timestep);
       }
Index: /XMLIO_V2/dev/common/src/circular_buffer.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/circular_buffer.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/circular_buffer.cpp	(revision 300)
@@ -69,5 +69,4 @@
          this->movePRead(currsize);
          this->nbrequest--;
-         //std::cout <<  this->nbrequest << std::endl;
         
          return (CLinearBuffer(SuperClass::getData(startpos), currsize));
Index: /XMLIO_V2/dev/common/src/client_ym.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/client_ym.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/client_ym.cpp	(revision 300)
@@ -0,0 +1,252 @@
+#include "xmlioserver_spl.hpp"
+#include "cxios.hpp"
+#include "client_ym.hpp"
+#include <boost/functional/hash.hpp>
+#include "type.hpp"
+#include "buffer.hpp"
+#include "context.hpp"
+#include "context_client.hpp"
+#include "tree_manager.hpp"
+#include "oasis_cinterface.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{                      
+  namespace ym
+  {
+
+    MPI_Comm CClient::intraComm ;
+    MPI_Comm CClient::interComm ;
+    int CClient::serverLeader ;
+    bool CClient::is_MPI_Initialized ;
+    
+    
+    void CClient::initialize(const string& codeId,MPI_Comm& localComm,MPI_Comm& returnComm)
+    {
+      int initialized ;
+      MPI_Initialized(&initialized) ;
+      if (initialized) is_MPI_Initialized=true ;
+      else is_MPI_Initialized=false ;
+      
+// don't use OASIS
+      if (!CXios::usingOasis)
+      {
+// localComm doesn't given
+        if (localComm == MPI_COMM_NULL)
+        {
+          if (!is_MPI_Initialized) 
+          {
+            int argc=0;
+            char** argv=NULL;
+            MPI_Init(&argc,&argv) ;
+          }
+          boost::hash<string> hashString ;    
+    
+          unsigned long hashClient=hashString(codeId) ;
+          unsigned long hashServer=hashString(CXios::xiosCodeId) ;
+          unsigned long* hashAll ;
+          int rank ;
+          int size ;
+          int myColor ;
+          int i,c ;
+          MPI_Comm newComm ;
+      
+          MPI_Comm_size(CXios::globalComm,&size) ;
+          MPI_Comm_rank(CXios::globalComm,&rank);
+          hashAll=new unsigned long[size] ;
+     
+          MPI_Allgather(&hashClient,1,MPI_LONG,hashAll,1,MPI_LONG,CXios::globalComm) ;
+
+          map<unsigned long, int> colors ;
+          map<unsigned long, int> leaders ;
+      
+          for(i=0,c=0;i<size;i++)
+          {
+            if (colors.find(hashAll[i])==colors.end())
+            {
+              colors[hashAll[i]] =c ;
+              leaders[hashAll[i]]=i ;
+              c++ ;
+            }
+          }
+     
+          myColor=colors[hashClient] ;
+      
+          MPI_Comm_split(CXios::globalComm,myColor,rank,&intraComm) ;
+
+          if (CXios::usingServer)
+          {     
+            int clientLeader=leaders[hashClient] ;
+            serverLeader=leaders[hashServer] ;
+            MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ;
+          }
+          else
+          {
+            MPI_Comm_dup(intraComm,&interComm) ;
+          }
+          delete [] hashAll ;
+        }
+        // localComm argument is given
+        else 
+        {
+          if (CXios::usingServer)
+          {          
+            //ERROR("void CClient::initialize(const string& codeId,MPI_Comm& localComm,MPI_Comm& returnComm)", << " giving a local communictor is not compatible with using server mode") ;
+          }
+          else
+          {
+            MPI_Comm_dup(localComm,&intraComm) ;
+            MPI_Comm_dup(intraComm,&interComm) ;
+          }
+        }
+      }
+      // using OASIS
+      else
+      {
+        // localComm doesn't given
+        if (localComm == MPI_COMM_NULL)
+        {
+          if (!is_MPI_Initialized) oasis_init(codeId) ;
+          oasis_get_localcomm(intraComm) ;
+        }
+        else MPI_Comm_dup(localComm,&intraComm) ;
+  
+        if (CXios::usingServer) 
+        {
+          MPI_Status status ;
+          int rank ;
+          MPI_Comm_rank(intraComm,&rank) ;
+
+          oasis_get_intercomm(interComm,CXios::xiosCodeId) ;
+          if (rank==0) MPI_Recv(&serverLeader,1, MPI_INT, 0, 0, interComm, &status) ;
+          MPI_Bcast(&serverLeader,1,MPI_INT,0,intraComm) ;
+           
+        }
+        else MPI_Comm_dup(intraComm,&interComm) ;
+      }
+          
+      MPI_Comm_dup(intraComm,&returnComm) ;
+    }
+    
+    
+    
+    
+/*    
+    void CClient::initialize(const string& codeId,MPI_Comm& localComm,MPI_Comm& returnComm)
+    {
+      boost::hash<string> hashString ;    
+    
+      unsigned long hashClient=hashString(codeId) ;
+      unsigned long hashServer=hashString(CXios::xiosCodeId) ;
+      unsigned long* hashAll ;
+      int rank ;
+      int size ;
+      int myColor ;
+      int i,c ;
+      MPI_Comm newComm ;
+      
+      MPI_Comm_size(CXios::globalComm,&size) ;
+      MPI_Comm_rank(CXios::globalComm,&rank);
+      hashAll=new unsigned long[size] ;
+     
+      MPI_Allgather(&hashClient,1,MPI_LONG,hashAll,1,MPI_LONG,CXios::globalComm) ;
+
+      map<unsigned long, int> colors ;
+      map<unsigned long, int> leaders ;
+      
+      for(i=0,c=0;i<size;i++)
+      {
+        if (colors.find(hashAll[i])==colors.end())
+        {
+          colors[hashAll[i]] =c ;
+          leaders[hashAll[i]]=i ;
+          c++ ;
+        }
+        
+      }
+     
+      myColor=colors[hashClient] ;
+      
+      MPI_Comm_split(CXios::globalComm,myColor,rank,&intraComm) ;
+
+      if (!CXios::isServer)
+      {     
+        int clientLeader=leaders[hashClient] ;
+        serverLeader=leaders[hashServer] ;
+        MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ;
+      }
+      else
+      {
+        MPI_Comm_dup(intraComm,&interComm) ;
+      }
+
+      delete [] hashAll ;
+    }
+  */
+    
+    void CClient::registerContext(const string& id,MPI_Comm contextComm)
+    {
+      CObjectFactory::SetCurrentContextId(id);
+      shared_ptr<CContext> context=tree::CTreeManager::CreateContext(id) ;
+        
+      if (!CXios::isServer)
+      {
+        int size,rank,globalRank ;
+        size_t message_size ;
+        int leaderRank ;
+        MPI_Comm contextInterComm ;
+      
+        MPI_Comm_size(contextComm,&size) ;
+        MPI_Comm_rank(contextComm,&rank) ;
+        MPI_Comm_rank(CXios::globalComm,&globalRank) ;
+        if (rank!=0) globalRank=0 ;
+      
+    
+        CMessage msg ;
+        msg<<id<<size<<globalRank ;
+
+        int messageSize=msg.size() ;
+        void * buff = new char[messageSize] ;
+        CBufferOut buffer(buff,messageSize) ;
+        buffer<<msg ;
+      
+        MPI_Send(buff,buffer.count(),MPI_CHAR,serverLeader,1,CXios::globalComm) ;
+        delete [] buff ;
+      
+        MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ;
+        info(10)<<"Register new Context : "<<id<<endl ;
+ 
+        MPI_Comm inter ;
+        MPI_Intercomm_merge(contextInterComm,0,&inter) ;
+        MPI_Barrier(inter) ;
+
+        context->initClient(contextComm,contextInterComm) ;
+      }
+      else
+      {
+        MPI_Comm contextInterComm ;
+        MPI_Comm_dup(contextComm,&contextInterComm) ;
+        context->initClient(contextComm,contextInterComm) ;
+        context->initServer(contextComm,contextInterComm) ;
+      }
+    }
+    
+    void CClient::finalize(void)
+    {
+      int rank ;
+      int msg=0 ;
+      MPI_Comm_rank(intraComm,&rank) ;  
+      if (rank==0) 
+      {
+        MPI_Send(&msg,1,MPI_INT,0,0,interComm) ;
+      }
+      
+      if (!is_MPI_Initialized)
+      {
+        if (CXios::usingOasis) oasis_finalize();
+        else MPI_Finalize() ;
+      }
+      info(20) << "Client side context is finalized"<<endl ;
+    }
+  }
+}
Index: /XMLIO_V2/dev/common/src/client_ym.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/client_ym.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/client_ym.hpp	(revision 300)
@@ -0,0 +1,27 @@
+#ifndef __CLIENT_YM__HPP__
+#define __CLIENT_YM__HPP__
+
+#include "xmlioserver_spl.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{                      
+  namespace ym
+  {
+    class CClient
+    {
+       public:
+       
+       static void initialize(const string& codeId,MPI_Comm& localComm,MPI_Comm& returnComm) ;
+       static void finalize(void) ;
+       static void registerContext(const string& id,MPI_Comm contextComm) ;
+
+       static MPI_Comm intraComm ;
+       static MPI_Comm interComm ;
+       static int serverLeader;
+       static bool is_MPI_Initialized ;
+    } ;
+  }
+}
+
+#endif
Index: /XMLIO_V2/dev/common/src/configure.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/configure.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/configure.hpp	(revision 300)
@@ -2,6 +2,4 @@
 #define __XMLIO_Configure__
 
-/// xmlioserver headers ///
-#include "xmlioserver_spl.hpp"
 
 /// /////////// Macros /////////// ///
Index: /XMLIO_V2/dev/common/src/context_client.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/context_client.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/context_client.cpp	(revision 300)
@@ -0,0 +1,198 @@
+#include "xmlioserver_spl.hpp"
+#include "context_client.hpp"
+#include "context_server.hpp"
+#include "event_client.hpp"
+#include "buffer_out.hpp"
+#include "buffer_client.hpp"
+#include "type.hpp"
+#include "message.hpp"
+#include "event_client.hpp"
+#include "transfert_parameters.hpp"
+#include "context.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+
+
+    CContextClient::CContextClient(tree::CContext* parent,MPI_Comm intraComm_, MPI_Comm interComm_)
+    {
+      context=parent ;
+      intraComm=intraComm_ ;
+      interComm=interComm_ ;
+      MPI_Comm_rank(intraComm,&clientRank) ;
+      MPI_Comm_size(intraComm,&clientSize) ;
+      
+      int flag ;
+      MPI_Comm_test_inter(interComm,&flag) ;
+      if (flag) MPI_Comm_remote_size(interComm,&serverSize);
+      else  MPI_Comm_size(interComm,&serverSize) ;
+     
+      timeLine=0 ;
+
+    }
+
+
+    void CContextClient::sendEvent(CEventClient& event)
+    {
+      list<int>::iterator itServer ;
+      list<int> ranks ;
+      list<int> sizes ;  
+      list<int>::iterator itSize ;
+      
+      ranks=event.getRanks() ;
+      if (! event.isEmpty())
+      {
+        sizes=event.getSizes() ;
+        CMessage msg ;
+
+        msg<<*(sizes.begin())<<timeLine ;
+        for(list<int>::iterator it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
+        list<CBufferOut*> buffList=getBuffers(ranks,sizes) ;
+      
+        list<CBufferOut*>::iterator it ;      
+        for(it=buffList.begin(),itSize=sizes.begin();it!=buffList.end();++it,++itSize)
+        {
+          **it<<*itSize<<timeLine ;
+        }
+        event.send(buffList) ;
+        checkBuffers(ranks) ;
+      }
+
+      if (context->hasServer) waitEvent(ranks) ;
+      timeLine++ ;
+    }
+      
+    void CContextClient::waitEvent(list<int>& ranks)
+    {
+      context->server->setPendingEvent() ;
+      while(checkBuffers(ranks) || context->server->hasPendingEvent())
+      {
+        context->server->eventLoop() ;
+      }
+    }
+
+    list<CBufferOut*> CContextClient::getBuffers(list<int>& serverList, list<int>& sizeList)
+    {
+      list<int>::iterator itServer,itSize ;
+      list<CClientBuffer*> bufferList ; 
+      map<int,CClientBuffer*>::iterator it ; 
+      list<CClientBuffer*>::iterator itBuffer ; 
+      list<CBufferOut*>  retBuffer ;
+      bool free ;
+
+      for(itServer=serverList.begin();itServer!=serverList.end();itServer++) 
+      {
+        it=buffers.find(*itServer) ;
+        if (it==buffers.end()) 
+        {
+          newBuffer(*itServer) ;
+          it=buffers.find(*itServer) ;
+        }         
+        bufferList.push_back(it->second) ;
+      }
+      free=false ;
+      while(!free)
+      {
+        free=true ;
+        for(itBuffer=bufferList.begin(),itSize=sizeList.begin(); itBuffer!=bufferList.end();itBuffer++,itSize++)
+        {
+          (*itBuffer)->checkBuffer() ;
+         free&=(*itBuffer)->isBufferFree(*itSize) ;
+        }
+      }
+      for(itBuffer=bufferList.begin(),itSize=sizeList.begin(); itBuffer!=bufferList.end();itBuffer++,itSize++)
+      {
+        retBuffer.push_back((*itBuffer)->getBuffer(*itSize)) ;
+      }
+      return retBuffer ;             
+   
+   }
+     
+   void CContextClient::newBuffer(int rank)
+   {
+      buffers[rank]=new CClientBuffer(interComm,rank) ;
+   } 
+
+   bool CContextClient::checkBuffers(void)
+   {
+      map<int,CClientBuffer*>::iterator itBuff ;
+      bool pending=false ;
+      for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) pending|=itBuff->second->checkBuffer() ;
+      return pending ;
+   } 
+
+   void CContextClient::releaseBuffers(void)
+   {
+      map<int,CClientBuffer*>::iterator itBuff ;
+      for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) delete itBuff->second ;
+   } 
+
+   bool CContextClient::checkBuffers(list<int>& ranks)
+   {
+      list<int>::iterator it ;
+      bool pending=false ;
+      for(it=ranks.begin();it!=ranks.end();it++) pending|=buffers[*it]->checkBuffer() ;
+      return pending ;
+   } 
+
+   int CContextClient::getServerLeader(void)
+   {
+     int clientByServer=clientSize/serverSize ;
+     int remain=clientSize%serverSize ;
+     
+     if (clientRank<(clientByServer+1)*remain)
+     {
+       return clientRank/(clientByServer+1) ;
+     }
+     else
+     {
+       int rank=clientRank-(clientByServer+1)*remain ;
+       int nbServer=serverSize-remain ;
+       return remain+rank/clientByServer ;
+     }
+   }      
+
+   bool CContextClient::isServerLeader(void)
+   {
+     int clientByServer=clientSize/serverSize ;
+     int remain=clientSize%serverSize ;
+     
+     if (clientRank<(clientByServer+1)*remain)
+     {
+       if (clientRank%(clientByServer+1)==0) return true ;
+       else return false ;
+     }
+     else
+     {
+       int rank=clientRank-(clientByServer+1)*remain ;
+       int nbServer=serverSize-remain ;
+       if  (rank%clientByServer==0) return true ;
+       else return false ;
+     } 
+   }
+     
+   void CContextClient::finalize(void)
+   {
+      
+     map<int,CClientBuffer*>::iterator itBuff ;
+     bool stop=true ;
+
+     CEventClient event(CContext::GetType(),CContext::EVENT_ID_CONTEXT_FINALIZE) ;   
+     if (isServerLeader())
+     {
+       CMessage msg ;
+       event.push(getServerLeader(),1,msg) ;
+     }
+     sendEvent(event) ;
+       
+     while(stop)
+     {
+       checkBuffers() ;
+       stop=false ;
+       for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) stop|=itBuff->second->hasPendingRequest() ;
+     }
+         
+     releaseBuffers() ;
+   }
+}      
Index: /XMLIO_V2/dev/common/src/context_client.cpp.old
===================================================================
--- /XMLIO_V2/dev/common/src/context_client.cpp.old	(revision 300)
+++ /XMLIO_V2/dev/common/src/context_client.cpp.old	(revision 300)
@@ -0,0 +1,149 @@
+#include "xmlioserver_spl.hpp"
+#include "context_client.hpp"
+#include "event_client.hpp"
+#include "buffer_out.hpp"
+#include "buffer_client.hpp"
+#include "type.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+
+
+    CContextClient::CContextClient(MPI_Comm intraComm_, MPI_Comm interComm_)
+    {
+      intraComm=intraComm_ ;
+      interComm=interComm_ ;
+      MPI_Comm_rank(intraComm,&clientRank) ;
+      MPI_Comm_size(intraComm,&clientSize) ;
+      MPI_Comm_remote_size(interComm,&serverSize) ;
+      
+      timeLine=0 ;
+      locked=false; 
+    }
+
+
+
+    void CContextClient::registerEvent(CEventClient& event)
+    {
+      list<int>::iterator it;
+      map<int,CClientBuffer*> clientBuffer ;
+      
+      for(it=event.serverList.begin();it!=event.serverList.end();it++)
+      {
+        
+        if (connectedServer.find(*it)==connectedServer.end())
+        {
+          connectedServer.insert(*it) ;
+          buffers[*it]=new CClientBuffer(interComm,*it) ;
+        }
+      }
+    }
+
+
+
+    list<CBufferOut*> CContextClient::newEvent(CEventClient& event,list<int>& sizes)
+    {
+      
+      if (locked==true) ERROR("list<CBufferOut*> CContextClient::newEvent(CEventClient& event,list<int>& sizes)",
+                              "event is locked. Please send last event before requesting a new event") ; 
+      
+      list<CBufferOut*> buffers ; 
+      list<CBufferOut*>::iterator itBuff ; 
+      list<int>::iterator it ;
+      
+//      CType<size_t> ttimeLine(timeLine) ;
+//      int size ;
+//      CType<int> tsize(size) ;
+//      int offset=tsize.size()+ttimeLine.size() ;
+
+      int size ;
+      timeLine++ ;
+      CMessage msg ;
+      msg<<size<<timeLine ;
+            
+      for(it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
+      buffers=getBuffers(event.serverList,sizes) ;
+      
+      it=sizes.begin() ;
+      for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++)
+      {
+        size=*it ;
+        *(*itBuff)<<msg ;
+        it++ ;
+      }      
+    
+      locked=true ;
+      return buffers ;
+    
+    }
+    
+
+
+    void CContextClient::sendEvent(CEventClient& event)
+    {
+      list<int>::iterator itServer ;
+      list<int>::ranks ;
+      list<int>::sizes ;  
+      list<int>::iterator itSize ;
+      
+//      if (locked==false) ERROR("void CContextClient::sendEvent(CEventClient& event)",
+//                              "event is not locked. Please request a new event before sending it") ;
+      ranks=event.getRanks() ;
+      sizes=event.getSizes() ;
+      
+      list<CMessage> msg<<sizes.begin()<<timeLine ;
+      
+      for(list<int>::iterator it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
+      list<CBufferOut*> buffList=getBuffers(ranks,sizes) ;
+      
+      
+      
+      for(list<CBufferOut*>::iterator it=buffList.begin(),itSize=sizes.begin() ;;it!=buffList.end();it++)
+      {
+         **it<<
+        
+      
+      
+                               
+      for(itServer=event.serverList.begin();itServer!=event.serverList.end();itServer++) 
+      {
+        buffers[*itServer]->checkBuffer() ;
+      }
+    }
+    
+
+
+    list<CBufferOut*> CContextClient::getBuffers(list<int>& serverList, list<int>& sizeList)
+    {
+      list<int>::iterator itServer,itSize ;
+      list<CClientBuffer*> bufferList ; 
+      list<CClientBuffer*>::iterator itBuffer ; 
+      list<CBufferOut*>  retBuffer ;
+      bool free ;
+      
+      for(itServer=serverList.begin();itServer!=serverList.end();itServer++) bufferList.push_back(buffers[*itServer]) ;
+
+      free=false ;
+      while(!free)
+      {
+        free=true ;
+        for(itBuffer=bufferList.begin(),itSize=sizeList.begin(); itBuffer!=bufferList.end();itBuffer++,itSize++)
+        {
+          (*itBuffer)->checkBuffer() ;
+          free&=(*itBuffer)->isBufferFree(*itSize) ;
+        }
+      }
+      
+      for(itBuffer=bufferList.begin(),itSize=sizeList.begin(); itBuffer!=bufferList.end();itBuffer++,itSize++)
+      {
+        retBuffer.push_back((*itBuffer)->getBuffer(*itSize)) ;
+      }
+      
+      return retBuffer ;             
+   
+   }
+     
+      
+
+}      
Index: /XMLIO_V2/dev/common/src/context_client.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/context_client.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/context_client.hpp	(revision 300)
@@ -0,0 +1,58 @@
+#ifndef __CONTEXT_CLIENT_HPP__
+#define __CONTEXT_CLIENT_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "buffer_out.hpp"
+#include "buffer_client.hpp"
+#include "event_client.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  namespace tree
+  {
+    class CContext ;
+  }
+  
+  class CContextClient
+  {
+  
+    public:
+    CContextClient(tree::CContext* parent,MPI_Comm intraComm, MPI_Comm interComm) ;
+//    void registerEvent(CEventClient& event) ;
+
+//    list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes) ;  
+    void sendEvent(CEventClient& event) ;
+
+    list<CBufferOut*> getBuffers(list<int>& serverlist, list<int>& sizeList) ;
+    void newBuffer(int rank) ;
+    size_t timeLine ;
+    int clientRank ;
+    int clientSize ;
+    int serverSize ;
+//    set<int> connectedServer ;
+    MPI_Comm interComm ;
+    MPI_Comm intraComm ;
+    map<int,CClientBuffer*> buffers ;
+    bool checkBuffers(list<int>& ranks) ;
+    bool checkBuffers(void);
+    void releaseBuffers(void);
+    void closeContext(void) ;
+    bool isServerLeader(void) ;
+    int getServerLeader(void) ;
+    void finalize(void) ;
+    void waitEvent(list<int>& ranks) ;
+
+    tree::CContext* context ;
+//    bool locked ;
+    
+  } ;
+
+
+
+
+}
+
+
+
+#endif
Index: /XMLIO_V2/dev/common/src/context_server.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/context_server.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/context_server.cpp	(revision 300)
@@ -0,0 +1,194 @@
+#include "context_server.hpp"
+#include "buffer_in.hpp"
+#include "type.hpp"
+#include "transfert_parameters.hpp"
+#include "context.hpp"
+#include "object_template_impl.hpp"
+#include "group_template_impl.hpp"
+#include "tree_manager.hpp"
+#include "domain.hpp"
+
+#include <mpi.h>
+
+
+
+namespace xmlioserver
+{
+
+  CContextServer::CContextServer(tree::CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_)
+  {
+    context=parent ;
+    intraComm=intraComm_ ;
+    MPI_Comm_size(intraComm,&intraCommSize) ;
+    MPI_Comm_rank(intraComm,&intraCommRank) ;
+    interComm=interComm_ ;
+    int flag ;
+    MPI_Comm_test_inter(interComm,&flag) ;
+    if (flag) MPI_Comm_remote_size(interComm,&commSize);
+    else  MPI_Comm_size(interComm,&commSize) ;
+    currentTimeLine=0 ;
+    finished=false ;
+  }
+  void CContextServer::setPendingEvent(void)
+  {
+    pendingEvent=true ;
+  }
+  
+  bool CContextServer::hasPendingEvent(void)
+  {
+    return pendingEvent ;
+  }
+  
+  bool CContextServer::eventLoop(void)
+  {
+    listen() ;
+    checkPendingRequest() ;
+    processEvents() ;
+    return finished ;
+  }
+
+  void CContextServer::listen(void)
+  {
+    int rank;
+    int flag ;
+    int count ;
+    char * addr ;
+    MPI_Status status; 
+    map<int,CServerBuffer*>::iterator it;
+    
+    for(rank=0;rank<commSize;rank++)
+    {
+      if (pendingRequest.find(rank)==pendingRequest.end())
+      {
+        MPI_Iprobe(rank,20,interComm,&flag,&status);     
+        if (flag==true)
+        {
+          it=buffers.find(rank) ;
+          if (it==buffers.end()) 
+            it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer))).first ;
+          MPI_Get_count(&status,MPI_CHAR,&count) ;
+          if (it->second->isBufferFree(count))
+          {
+            addr=(char*)it->second->getBuffer(count) ;
+            MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]) ;
+            bufferRequest[rank]=addr ;
+          }
+        }
+      }
+    }
+  }
+  
+  void CContextServer::checkPendingRequest(void)
+  {
+    map<int,MPI_Request>::iterator it;
+    list<int> recvRequest ;
+    list<int>::iterator itRecv;
+    int rank ;
+    int flag ;
+    int count ;
+    MPI_Status status ;
+    
+    for(it=pendingRequest.begin();it!=pendingRequest.end();it++)
+    {
+      rank=it->first ;
+      MPI_Test(& it->second, &flag, &status) ;
+      if (flag==true)
+      {
+        recvRequest.push_back(rank) ;
+        MPI_Get_count(&status,MPI_CHAR,&count) ;
+        processRequest(rank,bufferRequest[rank],count) ;
+      }
+    }
+    
+    for(itRecv=recvRequest.begin();itRecv!=recvRequest.end();itRecv++) 
+    {
+      pendingRequest.erase(*itRecv) ;
+      bufferRequest.erase(*itRecv) ;
+    }
+  }
+  
+  void CContextServer::processRequest(int rank, char* buff,int count)
+  {
+    
+    CBufferIn buffer(buff,count) ;
+    char* startBuffer,endBuffer ;
+    int size, offset ;
+    size_t timeLine ;
+    map<size_t,CEventServer*>::iterator it ;
+       
+    while(count>0)
+    {
+      char* startBuffer=(char*)buffer.ptr() ;
+      CBufferIn newBuffer(startBuffer,buffer.remain()) ;
+      newBuffer>>size>>timeLine ;
+
+      it=events.find(timeLine) ;
+      if (it==events.end()) it=events.insert(pair<int,CEventServer*>(timeLine,new CEventServer)).first ;
+      it->second->push(rank,buffers[rank],startBuffer,size) ;
+
+      buffer.advance(size) ;
+      count=buffer.remain() ;           
+    } 
+  
+  }
+    
+  void CContextServer::processEvents(void)
+  {
+    map<size_t,CEventServer*>::iterator it ;
+    CEventServer* event ;
+    
+    it=events.find(currentTimeLine) ;
+    if (it!=events.end()) 
+    {
+      event=it->second ;
+      if (event->isFull())
+      {
+         dispatchEvent(*event) ;
+         pendingEvent=false ;
+         delete event ;
+         events.erase(it) ;
+         currentTimeLine++ ;
+       }
+     }
+   }
+       
+  CContextServer::~CContextServer()
+  {
+    map<int,CServerBuffer*>::iterator it ;
+    for(it=buffers.begin();it!=buffers.end();++it) delete it->second ; 
+  } 
+
+
+  void CContextServer::dispatchEvent(CEventServer& event)
+  {
+    string contextName ;
+    string buff ;
+    int MsgSize ;
+    int rank ;
+    list<CEventServer::SSubEvent>::iterator it ;
+    tree::CTreeManager::SetCurrentContextId(context->getId()) ;
+        
+    if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE)
+    {
+      info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl ;
+      context->finalize() ;
+      finished=true ;
+    }
+    else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event) ;
+    else if (event.classId==CContextGroup::GetType()) CContextGroup::dispatchEvent(event) ;
+    else if (event.classId==CDomain::GetType()) CDomain::dispatchEvent(event) ;
+    else if (event.classId==CDomainGroup::GetType()) CDomainGroup::dispatchEvent(event) ;
+    else if (event.classId==CAxis::GetType()) CAxis::dispatchEvent(event) ;
+    else if (event.classId==CAxisGroup::GetType()) CAxisGroup::dispatchEvent(event) ;
+    else if (event.classId==CGrid::GetType()) CGrid::dispatchEvent(event) ;
+    else if (event.classId==CGridGroup::GetType()) CGridGroup::dispatchEvent(event) ;
+    else if (event.classId==CField::GetType()) CField::dispatchEvent(event) ;
+    else if (event.classId==CFieldGroup::GetType()) CFieldGroup::dispatchEvent(event) ;
+    else if (event.classId==CFile::GetType()) CFile::dispatchEvent(event) ;
+    else if (event.classId==CFileGroup::GetType()) CFileGroup::dispatchEvent(event) ;
+    else
+    {
+      ERROR("void CContextServer::dispatchEvent(CEventServer& event)",<<" Bad event class Id"<<endl) ;
+    }
+  }
+}
Index: /XMLIO_V2/dev/common/src/context_server.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/context_server.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/context_server.hpp	(revision 300)
@@ -0,0 +1,51 @@
+#ifndef __CONTEXT_SERVER_HPP__
+#define __CONTEXT_CLIENT_HPP__
+#include "xmlioserver_spl.hpp"
+#include "event_server.hpp"
+#include "buffer_server.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  namespace tree
+  {
+    class CContext ;
+  }
+  
+  class CContextServer
+  {
+    public:
+    
+    CContextServer(tree::CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ;
+    bool eventLoop(void) ;
+    void listen(void) ;
+    void checkPendingRequest(void) ;
+    void processRequest(int rank, char* buff,int count) ;
+    void processEvents(void) ;
+    void dispatchEvent(CEventServer& event) ;
+    void setPendingEvent(void) ;
+    bool hasPendingEvent(void) ;
+    
+    MPI_Comm intraComm ;
+    int intraCommSize ;
+    int intraCommRank ;
+    
+    MPI_Comm interComm ;
+    int commSize ;
+  
+    map<int,CServerBuffer*> buffers ;
+    map<int,MPI_Request> pendingRequest ;
+    map<int,char*> bufferRequest ;
+    
+    map<size_t,CEventServer*> events ;
+    size_t currentTimeLine ;
+    tree::CContext* context ;
+    
+    bool finished ;
+    bool pendingEvent ;
+    ~CContextServer() ;    
+  } ;
+
+}
+
+#endif
Index: /XMLIO_V2/dev/common/src/cxios.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/cxios.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/cxios.cpp	(revision 300)
@@ -0,0 +1,62 @@
+
+#include "xmlioserver_spl.hpp"
+#include "cxios.hpp"
+#include "client_ym.hpp"
+#include "server_ym.hpp"
+#include "tree_manager.hpp"
+#include <boost/functional/hash.hpp>
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  string CXios::rootFile="./iodef.xml" ;
+  string CXios::xiosCodeId="xios.x" ;
+  
+  bool CXios::isClient ;
+  bool CXios::isServer ;
+  MPI_Comm CXios::globalComm ;
+  bool CXios::usingOasis ;
+  bool CXios::usingServer ;   
+  
+  void CXios::initialize()
+  {
+    tree::CTreeManager::ParseFile(rootFile);
+    usingServer=getin<bool>("using_server") ;
+    usingOasis=getin<bool>("using_oasis") ;
+    info.setLevel(getin<int>("info_level")) ;
+    globalComm=MPI_COMM_WORLD ;
+  }
+
+
+  void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm)
+  {
+     
+    initialize() ;
+    
+    isClient=true;
+    if (usingServer) isServer=false;
+    else isServer=true ;
+    
+    ym::CClient::initialize(codeId,localComm,returnComm) ;
+
+  }   
+
+  void CXios::clientFinalize(void)
+  {
+     ym::CClient::finalize() ;    
+  }   
+  
+  
+  void CXios::initServerSide(void)
+  {
+    initialize();
+
+    if (!usingServer) ERROR("void CXios::initServerSide(void)",<<"using_server is set to <false> and server initialization is called") ;
+    isClient=true;
+    isServer=false ;
+
+    ym::CServer::initialize() ;
+  } 
+  
+
+}
Index: /XMLIO_V2/dev/common/src/cxios.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/cxios.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/cxios.hpp	(revision 300)
@@ -0,0 +1,48 @@
+#ifndef __XIOS_HPP__
+#define __XIOS_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  class CXios
+  {
+     public:
+     
+     static string rootFile ;
+     static string xiosCodeId ;
+     
+     static void initialize(void) ;
+      
+   
+     static void initClientSide(const string & codeId, MPI_Comm& localComm, MPI_Comm& returnComm) ;
+     static void initServerSide(void) ;
+     static void clientFinalize(void) ;
+   
+     template <typename T>
+     static T getin(const string& id) ;
+
+
+     static bool isClient ;
+     static bool isServer ;
+
+     static MPI_Comm globalComm ; 
+     
+     static bool usingOasis ;
+     static bool usingServer ;   
+        
+  } ;
+}
+
+#include "cxios_impl.hpp"
+
+
+
+
+
+
+
+
+
+#endif
Index: /XMLIO_V2/dev/common/src/cxios_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/cxios_impl.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/cxios_impl.hpp	(revision 300)
@@ -0,0 +1,18 @@
+#ifndef __XIOS_IMPL_HPP__
+#define __XIOS_IMPL_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "variable.hpp"
+
+namespace xmlioserver
+{
+  template <typename T>
+  T CXios::getin(const string& id)
+  {
+    return CObjectFactory::GetObject<CVariable>("xios",id)->getData<T>() ;
+  }
+
+
+
+}
+#endif
Index: /XMLIO_V2/dev/common/src/data_treatment.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/data_treatment.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/data_treatment.cpp	(revision 300)
@@ -38,5 +38,4 @@
          // Mise Ã  jour cÃŽtÃ© client
          this->currentContext->getCalendar()->update(step);
-//         std::cout <<  "current date : " << this->currentContext->getCalendar()->getCurrentDate() << std::endl;
          if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
          { // Mise Ã  jour cÃŽtÃ© serveur
@@ -118,18 +117,14 @@
          
          // RÃ©solution des hÃ©ritages pour le context actuel.
-         //std::cout << "(Message temporaire) RÃ©solution des hÃ©ritages ..." << std::endl;
          this->solveAllInheritance();
 
          //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers Ã  sortir.
-         //std::cout << "(Message temporaire) Initialisation du vecteur enabledFiles ..." << std::endl;
          this->findEnabledFiles();
 
          //Recherche des champs Ã  sortir (enable Ã  true + niveau de sortie correct)
          // pour chaque fichier prÃ©cÃ©demment listÃ©.
-         //std::cout << "(Message temporaire) Recherche des champs Ã  sortir ..." << std::endl;
          this->findAllEnabledFields();
 
          // RÃ©solution des rÃ©fÃ©rences de grilles pour chacun des champs.
-         //std::cout << "(Message temporaire) RÃ©solution des rÃ©fÃ©rences de grilles ..." << std::endl;
          this->solveAllGridRef();
 
@@ -140,5 +135,4 @@
          CContext::CleanTree();
 
-         //std::cout << "(Message temporaire) fin traitement sorties ..." << std::endl;
       }
 
Index: /XMLIO_V2/dev/common/src/data_treatment.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/data_treatment.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/data_treatment.hpp	(revision 300)
@@ -113,5 +113,5 @@
 
             boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false,comm_server,multifile));
-            file->initializeDataOutput(dout);
+//            file->initializeDataOutput(dout);
          }
       }
@@ -149,11 +149,9 @@
             boost::shared_ptr<CField> field = *it;
             boost::shared_ptr<CFile>  file  = field->getRelFile();
-            if (field->updateData(currDate, timestep, data))
+            if (field->updateData(data))
             {
                if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT)
                { 
                    boost::shared_ptr<comm::CClient> client = comm::CClient::GetClient();
-//                   std::cout<<"--> sendData :: fieldId : "<<fieldId<<", fileId : "<<file->getId()<<std::endl ;
-//                   client->sendData(fieldId, file->getId(), field->getData());
                    client->sendData(field->getId(), file->getId(), field->getData());
                }
Index: /XMLIO_V2/dev/common/src/event_client.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/event_client.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/event_client.cpp	(revision 300)
@@ -0,0 +1,90 @@
+#include "xmlioserver_spl.hpp"
+#include "event_client.hpp"
+#include "buffer_out.hpp"
+#include "message.hpp"
+#include "type.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+   CEventClient::CEventClient(int classId_,int typeId_)
+   {
+     classId=classId_ ;
+     typeId=typeId_ ;
+   }
+   
+   void CEventClient::push(int rank,int nbSender,CMessage & msg)
+   {
+     nbSenders.push_back(nbSender) ;
+     ranks.push_back(rank) ;
+     messages.push_back(&msg) ;
+   }
+
+   bool CEventClient::isEmpty(void)
+   {
+     return ranks.empty() ;
+   }
+
+   list<int> CEventClient::getRanks(void)
+   {
+     return ranks ;
+   }
+   
+   list<int> CEventClient::getSizes(void)
+   {
+     list<CMessage*>::iterator it ;
+     list<int> sizes ;
+     size_t headerSize=sizeof(int)+sizeof(classId)+sizeof(typeId) ;
+     
+     for(it=messages.begin();it!=messages.end();++it) sizes.push_back((*it)->size()+headerSize) ;
+     return sizes ;
+   }
+   
+   void CEventClient::send(list<CBufferOut*>& buffers)
+   {
+     list<CBufferOut*>::iterator itBuff ;
+     list<CMessage*>::iterator itMsg ;
+     list<int>::iterator itSenders ;
+     
+     for(itBuff=buffers.begin(),itMsg=messages.begin(),itSenders=nbSenders.begin();itBuff!=buffers.end();++itBuff,++itMsg,++itSenders)
+     {
+       **itBuff<<*itSenders<<classId<<typeId<<**itMsg ;
+     }
+   }   
+/*
+   CEventClient::CEventClient(CContextClient& client_,int nbSender_,list<int>& serverList_)
+   {
+     client=&client_ ;
+     nbSender=nbSender_ ;
+     serverList=serverList_ ;
+     
+     client->registerEvent(*this) ;
+   }
+
+   list<CBufferOut*> CEventClient::newEvent(int classId, int type, list<int> sizes)
+   {
+     list<int>::iterator it ;
+     list<CBufferOut*>::iterator itBuff;
+     
+     
+     CMessage msg;
+     
+     msg<<nbSender<<classId<<type ;    
+     
+     for(it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
+     list<CBufferOut*> buffers=client->newEvent(*this,sizes) ;
+
+     for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) *(*itBuff)<<msg ;  
+     
+     return buffers ;
+   
+   }
+          
+   void CEventClient::send(void)
+   {
+     client->sendEvent(*this) ;
+   }
+
+*/   
+   
+}
Index: /XMLIO_V2/dev/common/src/event_client.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/event_client.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/event_client.hpp	(revision 300)
@@ -0,0 +1,34 @@
+#ifndef __EVENT_CLIENT_HPP__
+#define __EVENT_CLIENT_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "buffer_out.hpp" ;
+#include "message.hpp" ;
+
+namespace xmlioserver
+{
+ 
+  class CEventClient
+  {
+    public:
+    
+//    CEventClient(CContextClient& client,int nbSender,list<int>& serverList);  
+    CEventClient(int classId, int typeId);
+    void push(int rank,int nbSender, CMessage& msg) ;  
+
+//    list<CBufferOut*> newEvent(int classId, int type, list<int> sizes) ;
+    list<int> getRanks(void) ;
+    list<int> getSizes(void) ;
+    void send(list<CBufferOut*>&) ;   
+    bool isEmpty(void) ;
+    list<int> ranks ;
+    list<int> nbSenders ;
+    list<CMessage*> messages ;
+//    CContextClient* client ;
+    int classId ;
+    int typeId ;
+  } ;
+
+}
+
+#endif
Index: /XMLIO_V2/dev/common/src/event_server.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/event_server.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/event_server.cpp	(revision 300)
@@ -0,0 +1,64 @@
+#include "xmlioserver_spl.hpp"
+#include "buffer_in.hpp"
+#include "type.hpp"
+#include "event_server.hpp"
+#include "buffer_server.hpp"
+
+namespace xmlioserver
+{
+
+  void CEventServer::push(int rank,CServerBuffer* serverBuffer,char* startBuffer,int size)
+  {
+    CBufferIn buffer(startBuffer,size) ;
+    size_t timeLine ;
+    int myClassId ;
+    int myType ;
+    int myNbSender ;
+  
+    buffer>>size>>timeLine>>myNbSender>>myClassId>>myType ;
+  
+    if (subEvents.empty())
+    {  
+      nbSender=myNbSender ;
+      classId=myClassId;
+      type=myType ;
+    }
+    else
+    {
+      if (nbSender!=myNbSender || classId!=myClassId || type!=myType)
+        ERROR("void CEventServer::push(int rank,char* startBuffer,int size)",
+             "Callers of an event are not coherent") ;
+    }
+
+    SSubEvent ev ;
+    ev.rank=rank ;
+    ev.serverBuffer=serverBuffer ;
+    ev.buffer=new CBufferIn(buffer.ptr(),buffer.remain()) ;
+    ev.size=size ;  
+    subEvents.push_back(ev) ;
+  
+    if (subEvents.size()>nbSender)
+    {
+        ERROR("void CEventServer::push(int rank,CServerBuffer* serverBuffer,char* startBuffer,int size)",
+              "Callers of an event are not coherent") ;
+    }
+  
+  }
+
+  bool CEventServer::isFull(void)  
+  {
+    return (nbSender==subEvents.size()) ;
+  }
+
+  CEventServer::~CEventServer()
+  {
+    list<SSubEvent>::iterator it;
+
+    for(it=subEvents.begin();it!=subEvents.end();it++)
+    {
+      it->serverBuffer->freeBuffer(it->size) ;
+      delete it->buffer ;
+    }
+  }
+
+}
Index: /XMLIO_V2/dev/common/src/event_server.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/event_server.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/event_server.hpp	(revision 300)
@@ -0,0 +1,38 @@
+#ifndef __EVENT_SERVER_HPP__
+#define __EVENT_SERVER_HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "buffer_in.hpp"
+#include "buffer_server.hpp"
+
+namespace xmlioserver
+{
+
+  class CEventServer
+  {
+    public:
+    
+    int classId ;
+    int type ;
+    int nbSender ;
+
+
+    void push(int rank,CServerBuffer* serverBuffer ,char* startBuffer,int size) ;
+
+    struct SSubEvent
+    {
+      int rank ;
+      CServerBuffer* serverBuffer ;
+      CBufferIn*  buffer ;
+      int size ;
+    } ;
+    
+    list<SSubEvent> subEvents ;    
+    
+    bool isFull(void) ;
+    ~CEventServer() ; 
+  } ;
+
+}
+
+#endif
Index: /XMLIO_V2/dev/common/src/fortran/file_interface.f90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/file_interface.f90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/file_interface.f90	(revision 300)
@@ -58,4 +58,11 @@
       END SUBROUTINE cxios_file_valid_id
 
+     SUBROUTINE cxios_set_file_type(file_hdl, type, type_size) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: file_hdl
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type
+         INTEGER  (kind = C_INT)     , VALUE        :: type_size
+      END SUBROUTINE cxios_set_file_type
+      
    END INTERFACE
    
Index: /XMLIO_V2/dev/common/src/fortran/filegroup_interface.f90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/filegroup_interface.f90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/filegroup_interface.f90	(revision 300)
@@ -58,4 +58,11 @@
       END SUBROUTINE cxios_filegroup_valid_id
 
+      SUBROUTINE cxios_set_filegroup_type(filegroup_hdl, type ,type_size) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: filegroup_hdl
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type
+         INTEGER  (kind = C_INT)     , VALUE        :: type_size
+      END SUBROUTINE cxios_set_filegroup_type
+      
    END INTERFACE
    
Index: /XMLIO_V2/dev/common/src/fortran/icaxis.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icaxis.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icaxis.cpp	(revision 300)
@@ -31,4 +31,5 @@
 
       axis_hdl->name.setValue(name_str);
+      axis_hdl->sendAttributToServer(axis_hdl->name) ;
    }
 
@@ -39,6 +40,7 @@
       if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return;
 
-      axis_hdl->standard_name.setValue(standard_name_str);
-   }
+      axis_hdl->standard_name.setValue(standard_name_str); 
+      axis_hdl->sendAttributToServer(axis_hdl->standard_name); 
+  }
     
    void cxios_set_axis_long_name 
@@ -49,4 +51,5 @@
 
       axis_hdl->long_name.setValue(long_name_str);
+      axis_hdl->sendAttributToServer(axis_hdl->long_name) ;
    }
 
@@ -58,4 +61,5 @@
 
       axis_hdl->unit.setValue(unit_str);
+      axis_hdl->sendAttributToServer(axis_hdl->unit) ;
    }
     
@@ -63,4 +67,5 @@
    {
       axis_hdl->size.setValue(size);
+      axis_hdl->sendAttributToServer(axis_hdl->size) ;
    }
 
@@ -72,4 +77,5 @@
 
       axis_hdl->zvalue.setValue(zvalue_val);
+      axis_hdl->sendAttributToServer(axis_hdl->zvalue) ;
 
    }
@@ -84,4 +90,5 @@
 
       axisgroup_hdl->name.setValue(name_str);
+      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->name) ;
    }
 
@@ -93,4 +100,5 @@
 
       axisgroup_hdl->standard_name.setValue(standard_name_str);
+      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->standard_name) ;
    }
     
@@ -102,4 +110,5 @@
 
       axisgroup_hdl->long_name.setValue(long_name_str);
+      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->long_name) ;
    }
 
@@ -111,4 +120,5 @@
 
       axisgroup_hdl->unit.setValue(unit_str);
+      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->unit) ;
    }
     
@@ -116,4 +126,5 @@
    {
       axisgroup_hdl->size.setValue(size);
+      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->size) ;
    }
 
@@ -125,4 +136,5 @@
 
       axisgroup_hdl->zvalue.setValue(zvalue_val);
+      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zvalue) ;
    }
    
Index: /XMLIO_V2/dev/common/src/fortran/iccontext.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/iccontext.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/iccontext.cpp	(revision 300)
@@ -33,6 +33,6 @@
       std::string calendar_type_str; 
       if (!cstr2string(calendar_type, calendar_type_size, calendar_type_str)) return;
-
       context_hdl->calendar_type.setValue(calendar_type_str);
+      context_hdl->sendAttributToServer(context_hdl->calendar_type) ;
    }
    
@@ -43,4 +43,5 @@
 
       context_hdl->start_date.setValue(start_date_str);
+      context_hdl->sendAttributToServer(context_hdl->start_date) ; 
    }
    
@@ -51,4 +52,5 @@
 
       context_hdl->output_dir.setValue(output_dir_str);
+      context_hdl->sendAttributToServer(context_hdl->output_dir) ; 
    }
    
Index: /XMLIO_V2/dev/common/src/fortran/icdata.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icdata.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icdata.cpp	(revision 300)
@@ -19,4 +19,7 @@
 #include "mpi_manager.hpp"
 #include "buffer.hpp"
+#include "cxios.hpp"
+#include "client_ym.hpp"
+#include "field.hpp"
 
 extern "C"
@@ -31,4 +34,54 @@
 
    // -------------------- Traitement des donnÃ©es ------------------------------
+   void cxios_init_server(void)
+   {
+     CXios::initServerSide();      
+   }
+
+   void cxios_init_client(const char * client_id , int len_client_id, MPI_Fint* f_local_comm, MPI_Fint* f_return_comm )
+   {
+      std::string str; 
+      MPI_Comm local_comm ;
+      MPI_Comm return_comm ;
+      
+      if (!cstr2string(client_id, len_client_id, str)) return;
+      
+      int initialized ;
+      MPI_Initialized(&initialized) ;
+      if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm) ;
+      else local_comm=MPI_COMM_NULL ;
+      CXios::initClientSide(str,local_comm,return_comm);
+      *f_return_comm=MPI_Comm_c2f(return_comm) ;
+   }
+
+   void cxios_context_initialize(const char * context_id , int len_context_id, MPI_Fint* f_comm)
+   {
+     std::string str; 
+     MPI_Comm comm ;
+     
+     if (!cstr2string(context_id, len_context_id, str)) return;
+     comm=MPI_Comm_f2c(*f_comm) ;
+     ym::CClient::registerContext(context_id,comm) ;
+   }
+ 
+    void cxios_context_close_definition()
+   {
+     boost::shared_ptr<CContext> context =
+            CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+     context->closeDefinition() ;
+   }  
+
+   void cxios_context_finalize()
+   {
+     boost::shared_ptr<CContext> context =
+            CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
+     context->finalize() ;
+   }
+   
+   void cxios_finalize()
+   {
+     CXios::clientFinalize() ;
+   }
+
    
    void cxios_dtreatment_start()
@@ -60,24 +113,5 @@
             MPI_Request request = 0;
             StdOStringStream ostrs;
-/*
-            if (CMPIManager::GetCommRank(comm_client_server) == 1)
-            {
-               CTreeManager::ToBinary(ostrs);
-               CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize());
-               std::cout<<"lbuffer size "<<ostrs.str().size()<<std::endl ;
-               lbuffer.appendString(ostrs.str());
-               CMPIManager::SendLinearBuffer(comm_client_server, 0, lbuffer, request);
-               CMPIManager::Wait(request);  // Pas encore en mode RPC
-            }
-            else
-            {
-               CTreeManager::DomainsToBinary(ostrs);
-               CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize()); 
-               std::cout<<"lbuffer size "<<ostrs.str().size()<<std::endl ;
-               lbuffer.appendString(ostrs.str());
-               CMPIManager::SendLinearBuffer(comm_client_server, 0, lbuffer, request);
-               CMPIManager::Wait(request);  // Pas encore en mode RPC
-            }
-*/
+
             CTreeManager::ToBinary(ostrs);
             CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize());
@@ -172,5 +206,7 @@
       ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize]));
       std::copy(data_k8, &(data_k8[data->num_elements()]), data->data());
-      dtreat->write_data(fieldid_str, data);
+      
+//      dtreat->write_data(fieldid_str, data);
+      CField::get(fieldid)->setData(data) ;
    }
    
@@ -188,5 +224,6 @@
       ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize]));
       std::copy(data_k8, &(data_k8[data->num_elements()]), data->data());
-      dtreat->write_data(fieldid_str, data);
+//      dtreat->write_data(fieldid_str, data);
+      CField::get(fieldid)->setData(data) ;
    }
    
@@ -204,5 +241,7 @@
       ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize]));
       std::copy(data_k8, &(data_k8[data->num_elements()]), data->data());
-      dtreat->write_data(fieldid_str, data);
+//      dtreat->write_data(fieldid_str, data);
+      CField::get(fieldid)->setData(data) ;
+
    }
    
@@ -218,7 +257,11 @@
 //          boost::extents [data_Xsize],
 //          boost::fortran_storage_order());
-      ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize]));
-      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
-      dtreat->write_data(fieldid_str, data);
+//      ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize]));
+//      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
+//      dtreat->write_data(fieldid_str, data);
+      ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize]));
+      double* ptr_data=data->data() ; 
+      for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i];
+      CField::get(fieldid)->setData(data) ;
    }
    
@@ -234,7 +277,11 @@
 //          boost::extents [data_Xsize][data_Ysize],
 //          boost::fortran_storage_order());
-      ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize]));
-      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
-      dtreat->write_data(fieldid_str, data);
+//      ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize]));
+//      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
+//      dtreat->write_data(fieldid_str, data);
+      ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize]));
+      double* ptr_data=data->data() ; 
+      for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i];
+      CField::get(fieldid)->setData(data) ;
    }
    
@@ -250,8 +297,12 @@
 //          boost::extents [data_Xsize][data_Ysize][data_Zsize],
 //          boost::fortran_storage_order());
-      ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize]));
-      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
-      dtreat->write_data(fieldid_str, data);
-   } 
+//      ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize]));
+//      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data());
+//      dtreat->write_data(fieldid_str, data);
+      ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize]));
+      double* ptr_data=data->data() ; 
+      for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i];
+      CField::get(fieldid)->setData(data) ;
+    } 
 
 } // extern "C"
Index: /XMLIO_V2/dev/common/src/fortran/icdate.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icdate.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icdate.cpp	(revision 300)
@@ -29,15 +29,7 @@
          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext>
             (CObjectFactory::GetCurrentContextId());
-         boost::shared_ptr<xmlioserver::data::CDataTreatment> dtreat = context->getDataTreatment();
-         if (dtreat.get() != 0)
-         {
-            dtreat->set_timestep(dur);     
-         }
-         else
-         {
-            context->solveCalendar();
+         
             context->timestep.setValue(dur.toString());
-            context->getCalendar()->setTimeStep(dur);
-         }       
+            context->sendAttributToServer("timestep") ;
       }
       catch (xmlioserver::CException & exc)
@@ -50,17 +42,10 @@
    void cxios_update_calendar(int step)
    {
-      try
-      {
-         boost::shared_ptr<xmlioserver::tree::CContext> context =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext>
+      boost::shared_ptr<xmlioserver::tree::CContext> context =
+            xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext>
             (CObjectFactory::GetCurrentContextId());
-         boost::shared_ptr<xmlioserver::data::CDataTreatment> dtreat = context->getDataTreatment();
-         dtreat->update_calendar(step);
-      }
-      catch (xmlioserver::CException & exc)
-      {
-         std::cerr << exc.getMessage() << std::endl;
-         exit (EXIT_FAILURE);
-      }
+      context->updateCalendar(step) ;
+      context->sendUpdateCalendar(step) ;
+      
    }
 
Index: /XMLIO_V2/dev/common/src/fortran/icdomain.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icdomain.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icdomain.cpp	(revision 300)
@@ -31,4 +31,5 @@
 
       domain_hdl->name.setValue(name_str);
+      domain_hdl->sendAttributToServer(domain_hdl->name) ; 
    }
    
@@ -39,4 +40,5 @@
 
       domain_hdl->standard_name.setValue(standard_name_str);
+      domain_hdl->sendAttributToServer(domain_hdl->standard_name) ; 
    }
    
@@ -47,4 +49,5 @@
 
       domain_hdl->long_name.setValue(long_name_str);
+      domain_hdl->sendAttributToServer(domain_hdl->long_name) ; 
    }
    
@@ -55,4 +58,5 @@
 
       domain_hdl->domain_group_ref.setValue(domain_group_ref_str);
+      domain_hdl->sendAttributToServer(domain_hdl->domain_group_ref) ; 
    }
    
@@ -60,4 +64,5 @@
    {
       domain_hdl->ni_glo.setValue(ni_glo);
+      domain_hdl->sendAttributToServer(domain_hdl->ni_glo) ; 
    }
    
@@ -65,4 +70,5 @@
    {
       domain_hdl->nj_glo.setValue(nj_glo);
+      domain_hdl->sendAttributToServer(domain_hdl->nj_glo) ; 
    }
    
@@ -70,4 +76,5 @@
    {
       domain_hdl->ibegin.setValue(ibegin);
+      domain_hdl->sendAttributToServer(domain_hdl->ibegin) ; 
    }
    
@@ -75,4 +82,5 @@
    {
       domain_hdl->iend.setValue(iend);
+      domain_hdl->sendAttributToServer(domain_hdl->iend) ; 
    }
    
@@ -80,4 +88,5 @@
    {
       domain_hdl->ni.setValue(ni);
+      domain_hdl->sendAttributToServer(domain_hdl->ni) ; 
    }
    
@@ -85,4 +94,5 @@
    {
       domain_hdl->jbegin.setValue(jbegin);
+      domain_hdl->sendAttributToServer(domain_hdl->jbegin) ; 
    }
    
@@ -90,4 +100,5 @@
    {
       domain_hdl->jend.setValue(jend);
+      domain_hdl->sendAttributToServer(domain_hdl->jend) ; 
    }
    
@@ -95,4 +106,5 @@
    {
       domain_hdl->nj.setValue(nj);
+      domain_hdl->sendAttributToServer(domain_hdl->nj) ; 
    }
    
@@ -103,4 +115,5 @@
 
       domain_hdl->mask.setValue(mask_val);
+      domain_hdl->sendAttributToServer(domain_hdl->mask) ; 
    }
    
@@ -108,4 +121,5 @@
    {
       domain_hdl->data_dim.setValue(data_dim);
+      domain_hdl->sendAttributToServer(domain_hdl->data_dim) ; 
    }
    
@@ -113,4 +127,5 @@
    {
       domain_hdl->data_ni.setValue(data_ni);
+      domain_hdl->sendAttributToServer(domain_hdl->data_ni) ; 
    }
    
@@ -118,4 +133,5 @@
    {
       domain_hdl->data_nj.setValue(data_nj);
+      domain_hdl->sendAttributToServer(domain_hdl->data_nj) ; 
    }
    
@@ -123,4 +139,5 @@
    {
       domain_hdl->data_ibegin.setValue(data_ibegin);
+      domain_hdl->sendAttributToServer(domain_hdl->data_ibegin) ; 
    }
    
@@ -128,4 +145,5 @@
    {
       domain_hdl->data_jbegin.setValue(data_jbegin);
+      domain_hdl->sendAttributToServer(domain_hdl->data_jbegin) ; 
    }
    
@@ -133,4 +151,5 @@
    {
       domain_hdl->zoom_ni.setValue(zoom_ni);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_ni) ; 
    }
    
@@ -138,4 +157,5 @@
    {
       domain_hdl->zoom_nj.setValue(zoom_nj);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_nj) ; 
    }
    
@@ -143,4 +163,5 @@
    {
       domain_hdl->zoom_ibegin.setValue(zoom_ibegin);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin) ; 
    }
     
@@ -148,4 +169,5 @@
    {
       domain_hdl->zoom_jbegin.setValue(zoom_jbegin);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin) ; 
    }
    
@@ -153,4 +175,5 @@
    {
       domain_hdl->zoom_ni_loc.setValue(zoom_ni_loc);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_ni_loc) ; 
    }
    
@@ -158,4 +181,5 @@
    {
       domain_hdl->zoom_nj_loc.setValue(zoom_nj_loc);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_nj_loc) ; 
    }
    
@@ -163,4 +187,5 @@
    {
       domain_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin_loc) ; 
    }
    
@@ -168,4 +193,5 @@
    {
       domain_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc);
+      domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin_loc) ; 
    }
    
@@ -173,4 +199,5 @@
    {
       domain_hdl->data_n_index.setValue(data_n_index);
+      domain_hdl->sendAttributToServer(domain_hdl->data_n_index) ; 
    }
    
@@ -181,4 +208,5 @@
 
       domain_hdl->data_i_index.setValue(data_i_index_val);
+      domain_hdl->sendAttributToServer(domain_hdl->data_i_index) ; 
    }
    
@@ -189,4 +217,5 @@
 
       domain_hdl->data_j_index.setValue(data_j_index_val);
+      domain_hdl->sendAttributToServer(domain_hdl->data_j_index) ; 
    }
     
@@ -197,4 +226,5 @@
 
       domain_hdl->lonvalue.setValue(lonvalue_val);
+      domain_hdl->sendAttributToServer(domain_hdl->lonvalue) ; 
    }
    
@@ -205,7 +235,8 @@
 
       domain_hdl->latvalue.setValue(latvalue_val);
+      domain_hdl->sendAttributToServer(domain_hdl->latvalue) ; 
    }   
    
-   // -------------------- Attributs des groupes d'axes ------------------------
+   // -------------------- Attributs des groupes de domaine ------------------------
    
    
@@ -216,4 +247,6 @@
 
       domaingroup_hdl->name.setValue(name_str);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->name) ; 
+      
    }
    
@@ -224,4 +257,5 @@
 
       domaingroup_hdl->standard_name.setValue(standard_name_str);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->standard_name) ;
    }
    
@@ -232,4 +266,5 @@
 
       domaingroup_hdl->long_name.setValue(long_name_str);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->long_name) ;
    }
    
@@ -240,4 +275,5 @@
 
       domaingroup_hdl->domain_group_ref.setValue(domain_group_ref_str);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->domain_group_ref) ;
    }
    
@@ -245,4 +281,5 @@
    {
       domaingroup_hdl->ni_glo.setValue(ni_glo);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni_glo) ;
    }
    
@@ -250,4 +287,5 @@
    {
       domaingroup_hdl->nj_glo.setValue(nj_glo);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj_glo) ;
    }
    
@@ -255,4 +293,5 @@
    {
       domaingroup_hdl->ibegin.setValue(ibegin);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ibegin) ;
    }
    
@@ -260,4 +299,5 @@
    {
       domaingroup_hdl->iend.setValue(iend);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->iend) ;
    }
    
@@ -265,4 +305,5 @@
    {
       domaingroup_hdl->ni.setValue(ni);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni) ;
    }
    
@@ -270,4 +311,5 @@
    {
       domaingroup_hdl->jbegin.setValue(jbegin);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jbegin) ;
    }
    
@@ -275,4 +317,5 @@
    {
       domaingroup_hdl->jend.setValue(jend);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jend) ;
    }
    
@@ -280,4 +323,5 @@
    {
       domaingroup_hdl->nj.setValue(nj);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj) ;
    }
    
@@ -288,4 +332,5 @@
 
       domaingroup_hdl->mask.setValue(mask_val);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->mask) ;
    }
    
@@ -293,4 +338,5 @@
    {
       domaingroup_hdl->data_dim.setValue(data_dim);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_dim) ;
    }
    
@@ -298,4 +344,5 @@
    {
       domaingroup_hdl->data_ni.setValue(data_ni);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ni) ;
    }
    
@@ -303,4 +350,5 @@
    {
       domaingroup_hdl->data_nj.setValue(data_nj);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_nj) ;
    }
    
@@ -308,4 +356,5 @@
    {
       domaingroup_hdl->data_ibegin.setValue(data_ibegin);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ibegin) ;
    }
    
@@ -313,4 +362,5 @@
    {
       domaingroup_hdl->data_jbegin.setValue(data_jbegin);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_jbegin) ;
    }
    
@@ -318,4 +368,5 @@
    {
       domaingroup_hdl->zoom_ni.setValue(zoom_ni);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni) ;
    }
    
@@ -323,4 +374,5 @@
    {
       domaingroup_hdl->zoom_nj.setValue(zoom_nj);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj) ;
    }
    
@@ -328,4 +380,5 @@
    {
       domaingroup_hdl->zoom_ibegin.setValue(zoom_ibegin);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin) ;
    }
     
@@ -333,4 +386,5 @@
    {
       domaingroup_hdl->zoom_jbegin.setValue(zoom_jbegin);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin) ;
    }
    
@@ -338,4 +392,5 @@
    {
       domaingroup_hdl->zoom_ni_loc.setValue(zoom_ni_loc);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni_loc) ;
    }
    
@@ -343,4 +398,5 @@
    {
       domaingroup_hdl->zoom_nj_loc.setValue(zoom_nj_loc);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj_loc) ;
    }
    
@@ -348,4 +404,5 @@
    {
       domaingroup_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin_loc) ;
    }
    
@@ -353,4 +410,5 @@
    {
       domaingroup_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin_loc) ;
    }
    
@@ -358,4 +416,5 @@
    {
       domaingroup_hdl->data_n_index.setValue(data_n_index);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_n_index) ;
    }
    
@@ -366,4 +425,5 @@
 
       domaingroup_hdl->data_i_index.setValue(data_i_index_val);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_i_index) ;
    }
    
@@ -374,4 +434,5 @@
 
       domaingroup_hdl->data_j_index.setValue(data_j_index_val);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_j_index) ;
    }
     
@@ -382,4 +443,5 @@
 
       domaingroup_hdl->lonvalue.setValue(lonvalue_val);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->lonvalue) ;
    }
    
@@ -390,4 +452,5 @@
 
       domaingroup_hdl->latvalue.setValue(latvalue_val);
+      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->latvalue) ;
    }  
    
Index: /XMLIO_V2/dev/common/src/fortran/icfield.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icfield.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icfield.cpp	(revision 300)
@@ -31,4 +31,5 @@
 
       field_hdl->name.setValue(name_str);
+      field_hdl->sendAttributToServer(field_hdl->name) ; 
    }
    
@@ -39,4 +40,5 @@
 
       field_hdl->standard_name.setValue(standard_name_str);
+      field_hdl->sendAttributToServer(field_hdl->standard_name) ; 
    }
    
@@ -47,4 +49,5 @@
 
       field_hdl->long_name.setValue(long_name_str);
+      field_hdl->sendAttributToServer(field_hdl->long_name) ;
    }
    
@@ -55,4 +58,6 @@
 
       field_hdl->unit.setValue(unit_str);
+      field_hdl->sendAttributToServer(field_hdl->unit) ;
+
    }
    
@@ -63,4 +68,5 @@
 
       field_hdl->operation.setValue(operation_str);
+      field_hdl->sendAttributToServer(field_hdl->operation) ;
    }
    
@@ -71,4 +77,5 @@
 
       field_hdl->freq_op.setValue(freq_op_str);
+      field_hdl->sendAttributToServer(field_hdl->freq_op) ;
    }
    
@@ -76,4 +83,5 @@
    {
       field_hdl->level.setValue(level);
+      field_hdl->sendAttributToServer(field_hdl->level) ;
    }
    
@@ -81,4 +89,5 @@
    {
       field_hdl->prec.setValue(prec);
+      field_hdl->sendAttributToServer(field_hdl->prec) ;
    }
    
@@ -86,4 +95,5 @@
    {
       field_hdl->enabled.setValue(enabled);
+      field_hdl->sendAttributToServer(field_hdl->enabled) ;
    }
    
@@ -94,4 +104,5 @@
 
       field_hdl->domain_ref.setValue(domain_ref_str);
+      field_hdl->sendAttributToServer(field_hdl->domain_ref) ;
    }
    
@@ -102,4 +113,5 @@
 
       field_hdl->axis_ref.setValue(axis_ref_str);
+      field_hdl->sendAttributToServer(field_hdl->axis_ref) ;
    }
    
@@ -110,4 +122,5 @@
 
       field_hdl->grid_ref.setValue(grid_ref_str);
+      field_hdl->sendAttributToServer(field_hdl->grid_ref) ;
    }
    
@@ -118,4 +131,5 @@
 
       field_hdl->field_ref.setValue(field_ref_str);
+      field_hdl->sendAttributToServer(field_hdl->field_ref) ;
    }
    
@@ -123,4 +137,5 @@
    {
       field_hdl->default_value.setValue(default_value);
+      field_hdl->sendAttributToServer(field_hdl->default_value) ;
    }  
    
@@ -133,4 +148,5 @@
 
       fieldgroup_hdl->name.setValue(name_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->name);
    }
    
@@ -141,4 +157,5 @@
 
       fieldgroup_hdl->standard_name.setValue(standard_name_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->standard_name);
    }
    
@@ -149,4 +166,5 @@
 
       fieldgroup_hdl->long_name.setValue(long_name_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->long_name);
    }
    
@@ -157,4 +175,5 @@
 
       fieldgroup_hdl->unit.setValue(unit_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->unit);
    }
    
@@ -165,4 +184,5 @@
 
       fieldgroup_hdl->operation.setValue(operation_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->operation);
    }
    
@@ -173,4 +193,5 @@
 
       fieldgroup_hdl->freq_op.setValue(freq_op_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->freq_op);
    }
    
@@ -178,4 +199,5 @@
    {
       fieldgroup_hdl->level.setValue(level);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->level);
    }
    
@@ -183,4 +205,5 @@
    {
       fieldgroup_hdl->prec.setValue(prec);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->prec);
    }
    
@@ -188,4 +211,5 @@
    {
       fieldgroup_hdl->enabled.setValue(enabled);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->enabled);
    }
    
@@ -196,4 +220,5 @@
 
       fieldgroup_hdl->domain_ref.setValue(domain_ref_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->domain_ref);
    }
    
@@ -204,4 +229,5 @@
 
       fieldgroup_hdl->axis_ref.setValue(axis_ref_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->axis_ref);
    }
    
@@ -212,4 +238,5 @@
 
       fieldgroup_hdl->grid_ref.setValue(grid_ref_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->grid_ref);
    }
    
@@ -220,4 +247,5 @@
 
       fieldgroup_hdl->field_ref.setValue(field_ref_str);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->field_ref);
    }
    
@@ -225,4 +253,5 @@
    {
       fieldgroup_hdl->default_value.setValue(default_value);
+      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->default_value);
    }  
    
Index: /XMLIO_V2/dev/common/src/fortran/icfile.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icfile.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icfile.cpp	(revision 300)
@@ -31,4 +31,5 @@
 
       file_hdl->name.setValue(name_str);
+      file_hdl->sendAttributToServer(file_hdl->name) ;
    }
    
@@ -39,4 +40,5 @@
 
       file_hdl->description.setValue(description_str);
+      file_hdl->sendAttributToServer(file_hdl->description) ;
    } 
    
@@ -47,4 +49,5 @@
 
       file_hdl->name_suffix.setValue(name_suffix_str);
+      file_hdl->sendAttributToServer(file_hdl->name_suffix) ;
    } 
    
@@ -55,4 +58,5 @@
 
       file_hdl->output_freq.setValue(output_freq_str);
+      file_hdl->sendAttributToServer(file_hdl->output_freq) ;
    }
    
@@ -60,4 +64,5 @@
    {
       file_hdl->output_level.setValue(output_level);
+      file_hdl->sendAttributToServer(file_hdl->output_level) ;
    }
    
@@ -65,4 +70,14 @@
    {
       file_hdl->enabled.setValue(enabled);
+      file_hdl->sendAttributToServer(file_hdl->enabled) ;
+   }
+   
+   void cxios_set_file_type(XFilePtr file_hdl, const char * type, int type_size)
+   {
+      std::string type_str; 
+      if (!cstr2string(type, type_size, type_str)) return;
+
+      file_hdl->type.setValue(type_str);
+      file_hdl->sendAttributToServer(file_hdl->type) ;
    }
    
@@ -73,7 +88,7 @@
       std::string name_str; 
       if (!cstr2string(name, name_size, name_str)) return;
-      if (!cstr2string(name, name_size, name_str)) return;
 
       filegroup_hdl->name.setValue(name_str);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->name) ;
    }
    
@@ -84,4 +99,5 @@
 
       filegroup_hdl->description.setValue(description_str);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->description) ;
    } 
    
@@ -92,4 +108,5 @@
 
       filegroup_hdl->name_suffix.setValue(name_suffix_str);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->name_suffix) ;
    } 
    
@@ -100,4 +117,5 @@
 
       filegroup_hdl->output_freq.setValue(output_freq_str);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->output_freq) ;
    }
    
@@ -105,4 +123,5 @@
    {
       filegroup_hdl->output_level.setValue(output_level);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->output_level) ;
    }
    
@@ -110,4 +129,14 @@
    {
       filegroup_hdl->enabled.setValue(enabled);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->enabled) ;
+   }
+   
+   void cxios_set_filegroup_type(XFileGroupPtr filegroup_hdl, const char * type, int type_size)
+   {
+      std::string type_str; 
+      if (!cstr2string(type, type_size, type_str)) return;
+
+      filegroup_hdl->type.setValue(type_str);
+      filegroup_hdl->sendAttributToServer(filegroup_hdl->type) ;
    }
    
Index: /XMLIO_V2/dev/common/src/fortran/icgrid.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icgrid.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icgrid.cpp	(revision 300)
@@ -31,4 +31,5 @@
 
       grid_hdl->name.setValue(name_str);
+      grid_hdl->sendAttributToServer(name_str) ;
    }
    
@@ -39,4 +40,5 @@
 
       grid_hdl->description.setValue(description_str);
+      grid_hdl->sendAttributToServer(description_str) ;
    }
    
@@ -47,4 +49,5 @@
 
       grid_hdl->domain_ref.setValue(domain_ref_str);
+      grid_hdl->sendAttributToServer(domain_ref_str) ;
    }
    
@@ -55,4 +58,5 @@
 
      grid_hdl->axis_ref.setValue(axis_ref_str);
+     grid_hdl->sendAttributToServer(axis_ref_str) ;
    }
    
@@ -65,4 +69,5 @@
 
       gridgroup_hdl->name.setValue(name_str);
+      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->name) ;
    }
    
@@ -73,4 +78,5 @@
 
       gridgroup_hdl->description.setValue(description_str);
+      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->description) ;
    }
    
@@ -81,4 +87,5 @@
 
       gridgroup_hdl->domain_ref.setValue(domain_ref_str);
+      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->domain_ref) ;
    }
    
@@ -89,4 +96,5 @@
 
       gridgroup_hdl->axis_ref.setValue(axis_ref_str);
+      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->axis_ref) ;
    }
    
Index: /XMLIO_V2/dev/common/src/fortran/icxml_tree.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/icxml_tree.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/icxml_tree.cpp	(revision 300)
@@ -43,12 +43,16 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CFieldGroup> fieldgroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFieldGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateChild(fieldgroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateChild(fieldgroup).get();
-   }
+
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChild(child_id_str).get() ;
+         parent_->sendCreateChild(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChild().get() ;
+         parent_->sendCreateChild() ;
+      }
+  }
    
    void cxios_xml_tree_add_grid
@@ -56,11 +60,14 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CGridGroup> gridgroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGridGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateChild(gridgroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateChild(gridgroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChild(child_id_str).get() ;
+         parent_->sendCreateChild(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChild().get() ;
+         parent_->sendCreateChild() ;
+      }
    }
    
@@ -69,11 +76,14 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CFileGroup> filegroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateChild(filegroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateChild(filegroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChild(child_id_str).get() ;
+         parent_->sendCreateChild(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChild().get() ;
+         parent_->sendCreateChild() ;
+      }
    }
    
@@ -82,11 +92,14 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CAxisGroup> axisgroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CAxisGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateChild(axisgroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateChild(axisgroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChild(child_id_str).get() ;
+         parent_->sendCreateChild(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChild().get() ;
+         parent_->sendCreateChild() ;
+      }
    }
    
@@ -95,11 +108,14 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CDomainGroup> domaingroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CDomainGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateChild(domaingroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateChild(domaingroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChild(child_id_str).get() ;
+         parent_->sendCreateChild(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChild().get() ;
+         parent_->sendCreateChild() ;
+      }
    }
    
@@ -108,14 +124,15 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CFile> file =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(parent_);
-
-      if (file->getVirtualFieldGroup().get() == 0 )
-          file->setVirtualFieldGroup(file->getId());
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateChild(file->getVirtualFieldGroup(), child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateChild(file->getVirtualFieldGroup()).get();
+ 
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->addField(child_id_str).get();
+         parent_->sendAddField(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->addField().get();
+         parent_->sendAddField() ;
+      }
    }
 
@@ -125,12 +142,16 @@
       (XFieldGroupPtr  parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size)
    {
-      std::string child_id_str;
-      boost::shared_ptr<xmlioserver::tree::CFieldGroup> fieldgroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFieldGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(fieldgroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(fieldgroup).get();
+     std::string child_id_str; 
+
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChildGroup(child_id_str).get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChildGroup().get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
    }
 
@@ -139,11 +160,15 @@
    {
       std::string child_id_str;
-      boost::shared_ptr<xmlioserver::tree::CGridGroup> gridgroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGridGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(gridgroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(gridgroup).get();
+ 
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChildGroup(child_id_str).get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChildGroup().get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
    }
 
@@ -152,11 +177,14 @@
    {
       std::string child_id_str;
-      boost::shared_ptr<xmlioserver::tree::CFileGroup> filegroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(filegroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(filegroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChildGroup(child_id_str).get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChildGroup().get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
    }
 
@@ -165,11 +193,14 @@
    {
       std::string child_id_str;
-      boost::shared_ptr<xmlioserver::tree::CAxisGroup> axisgroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CAxisGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(axisgroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(axisgroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChildGroup(child_id_str).get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChildGroup().get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
    }
 
@@ -178,11 +209,14 @@
    {
       std::string child_id_str;
-      boost::shared_ptr<xmlioserver::tree::CDomainGroup> domaingroup =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CDomainGroup>(parent_);
-
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(domaingroup, child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(domaingroup).get();
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->createChildGroup(child_id_str).get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->createChildGroup().get() ;
+         parent_->sendCreateChildGroup(child_id_str) ;
+      }
    }
 
@@ -191,14 +225,15 @@
    {
       std::string child_id_str; 
-      boost::shared_ptr<xmlioserver::tree::CFile> file =
-         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(parent_);
-
-      if (file->getVirtualFieldGroup().get() == 0 )
-          file->setVirtualFieldGroup(file->getId());
-      
-      if (cstr2string(child_id, child_id_size, child_id_str))
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(file->getVirtualFieldGroup(), child_id_str).get();
-      else
-         *child_ = xmlioserver::CGroupFactory::CreateGroup(file->getVirtualFieldGroup()).get();
+ 
+      if (cstr2string(child_id, child_id_size, child_id_str))
+      {
+         *child_ = parent_->addFieldGroup(child_id_str).get();
+         parent_->sendAddFieldGroup(child_id_str) ;
+      }
+      else
+      {
+         *child_ = parent_->addFieldGroup().get();
+         parent_->sendAddFieldGroup() ;
+      }
    }
    
Index: /XMLIO_V2/dev/common/src/fortran/idata.F90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/idata.F90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/idata.F90	(revision 300)
@@ -7,4 +7,31 @@
    INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
 
+      SUBROUTINE  cxios_init_server() BIND(C)
+      END SUBROUTINE cxios_init_server
+
+     SUBROUTINE cxios_init_client(client_id, len_client_id, f_local_comm, f_return_comm) BIND(C)
+         USE ISO_C_BINDING
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: client_id
+         INTEGER  (kind = C_INT)     , VALUE        :: len_client_id
+         INTEGER  (kind = C_INT)                    :: f_local_comm
+         INTEGER  (kind = C_INT)                    :: f_return_comm
+      END SUBROUTINE cxios_init_client
+      
+      SUBROUTINE  cxios_context_initialize(context_id,len_context_id,f_comm) BIND(C)
+         USE ISO_C_BINDING
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: context_id
+         INTEGER  (kind = C_INT)     , VALUE        :: len_context_id
+         INTEGER  (kind = C_INT)                    :: f_comm
+      END SUBROUTINE cxios_context_initialize
+
+       SUBROUTINE  cxios_context_close_definition() BIND(C)
+         USE ISO_C_BINDING
+      END SUBROUTINE cxios_context_close_definition
+     
+
+       SUBROUTINE  cxios_context_finalize() BIND(C)
+         USE ISO_C_BINDING
+      END SUBROUTINE cxios_context_finalize
+     
       SUBROUTINE  cxios_init_ioserver(comm_client,comm_parent) BIND(C)
          USE ISO_C_BINDING
@@ -15,4 +42,7 @@
       SUBROUTINE  cxios_finalize_ioserver BIND(C)
       END SUBROUTINE cxios_finalize_ioserver
+ 
+      SUBROUTINE  cxios_finalize BIND(C)
+      END SUBROUTINE cxios_finalize
 
       SUBROUTINE cxios_dtreatment_start() BIND(C)
@@ -80,29 +110,45 @@
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
 
-
-   SUBROUTINE  xios(initialize)(local_comm,return_comm )
+   SUBROUTINE  xios(init_server)()
+   IMPLICIT NONE
+     CALL cxios_init_server()
+   END SUBROUTINE xios(init_server)
+   
+   SUBROUTINE  xios(initialize)(client_id, local_comm, return_comm)
    IMPLICIT NONE
    INCLUDE 'mpif.h'
-      INTEGER, INTENT(OUT),OPTIONAL :: return_comm
-      INTEGER, INTENT(IN),OPTIONAL :: local_comm
-
-      INTEGER  :: comm_client
-      INTEGER  :: comm_parent
-      
+   CHARACTER(LEN=*),INTENT(IN) :: client_id
+   INTEGER,INTENT(IN),OPTIONAL         :: local_comm  
+   INTEGER,INTENT(OUT),OPTIONAL        :: return_comm
+   INTEGER :: f_local_comm
+   INTEGER :: f_return_comm
+   
       IF (PRESENT(local_comm)) THEN
-        comm_parent=local_comm
+        f_local_comm=local_comm 
       ELSE
-        comm_parent=MPI_COMM_WORLD
+        f_local_comm = MPI_COMM_NULL 
       ENDIF
       
-      CALL cxios_init_ioserver(comm_client,comm_parent)
-      IF (PRESENT(return_comm)) return_comm=comm_client ;
-
-    END SUBROUTINE  xios(initialize)
-
+      CALL cxios_init_client(client_id,LEN(client_id),f_local_comm,f_return_comm)
+ 
+      IF (PRESENT(return_comm)) return_comm=f_return_comm
+
+   END SUBROUTINE  xios(initialize)
+
+
+   SUBROUTINE  xios(context_initialize)(context_id,comm)
+   IMPLICIT NONE
+   CHARACTER(LEN=*),INTENT(IN)  :: context_id
+   INTEGER, INTENT(IN)          :: comm
+      
+      CALL cxios_context_initialize(context_id,LEN(context_id),comm)
+ 
+    END SUBROUTINE  xios(context_initialize)
+    
+    
    SUBROUTINE  xios(finalize)
    IMPLICIT NONE
 
-      CALL cxios_finalize_ioserver
+      CALL cxios_finalize
 
     END SUBROUTINE  xios(finalize)
@@ -111,5 +157,5 @@
    SUBROUTINE xios(close_context_definition)()
    IMPLICIT NONE
-      CALL cxios_dtreatment_start()
+      CALL cxios_context_close_definition()
    END SUBROUTINE xios(close_context_definition)
 
@@ -117,5 +163,5 @@
    SUBROUTINE xios(context_finalize)()
    IMPLICIT NONE
-      CALL cxios_dtreatment_end()
+      CALL cxios_context_finalize()
    END SUBROUTINE xios(context_finalize)
    
Index: /XMLIO_V2/dev/common/src/fortran/idate.F90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/idate.F90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/idate.F90	(revision 300)
@@ -19,5 +19,5 @@
 
    TYPE txios(time)
-      REAL(kind = 8) :: year, month, day, hour, minute, second
+      REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0
    END TYPE txios(time)   
 
Index: /XMLIO_V2/dev/common/src/fortran/ifile.F90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/ifile.F90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/ifile.F90	(revision 300)
@@ -35,5 +35,5 @@
 
 
-   SUBROUTINE xios(set_file_attr)(file_id, name , description, name_suffix, output_freq, output_level, enabled)
+   SUBROUTINE xios(set_file_attr)(file_id, name , description, name_suffix, output_freq, output_level, enabled, type)
       IMPLICIT NONE
       TYPE(txios(file))                       :: file_hdl
@@ -45,12 +45,13 @@
       INTEGER           , OPTIONAL, INTENT(IN) :: output_level
       LOGICAL           , OPTIONAL, INTENT(IN) :: enabled
-      
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type
+            
       CALL xios(get_file_handle)(file_id,file_hdl)
-      CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled)
+      CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled, type)
       
    END SUBROUTINE xios(set_file_attr)
    
 
-   SUBROUTINE xios(set_file_attr_hdl)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled)
+   SUBROUTINE xios(set_file_attr_hdl)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled,type)
       TYPE(txios(file))          , INTENT(IN) :: file_hdl
       CHARACTER(len = *), OPTIONAL, INTENT(IN) :: name
@@ -60,10 +61,11 @@
       INTEGER           , OPTIONAL, INTENT(IN) :: output_level
       LOGICAL           , OPTIONAL, INTENT(IN) :: enabled
-
-      CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled)
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type
+
+      CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled, type)
       
    END SUBROUTINE xios(set_file_attr_hdl)
 
-   SUBROUTINE xios(set_file_attr_hdl_)(file_hdl, name_ , description_, name_suffix_, output_freq_, output_level_, enabled_)
+   SUBROUTINE xios(set_file_attr_hdl_)(file_hdl, name_ , description_, name_suffix_, output_freq_, output_level_, enabled_, type_)
       TYPE(txios(file))          , INTENT(IN) :: file_hdl
       CHARACTER(len = *), OPTIONAL, INTENT(IN) :: name_
@@ -74,5 +76,6 @@
       LOGICAL(kind = 1)                        :: enabled__
       LOGICAL           , OPTIONAL, INTENT(IN) :: enabled_
-      
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type_
+            
       IF (PRESENT(name_))         THEN
          CALL cxios_set_file_name(file_hdl%daddr, name_, len(name_))
@@ -94,10 +97,14 @@
          CALL cxios_set_file_enabled(file_hdl%daddr, enabled__)
       END IF
-
+      
+      IF (PRESENT(type_))         THEN
+         CALL cxios_set_file_type(file_hdl%daddr, type_, len(type_))
+      END IF
+      
    END SUBROUTINE xios(set_file_attr_hdl_)
 
 
    
-   SUBROUTINE xios(set_filegroup_attr)(filegroup_id, name , description, name_suffix, output_freq, output_level, enabled)
+   SUBROUTINE xios(set_filegroup_attr)(filegroup_id, name , description, name_suffix, output_freq, output_level, enabled, type)
       IMPLICIT NONE
       TYPE(txios(filegroup))                  :: filegroup_hdl
@@ -109,12 +116,13 @@
       INTEGER           , OPTIONAL, INTENT(IN) :: output_level
       LOGICAL           , OPTIONAL, INTENT(IN) :: enabled
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type
       
       CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl)
-      CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled)
+      CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled, type)
       
    END SUBROUTINE xios(set_filegroup_attr)
 
 
-   SUBROUTINE xios(set_filegroup_attr_hdl)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled)
+   SUBROUTINE xios(set_filegroup_attr_hdl)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled, type)
       IMPLICIT NONE
       TYPE(txios(filegroup))     , INTENT(IN) :: filegroup_hdl
@@ -125,11 +133,13 @@
       INTEGER           , OPTIONAL, INTENT(IN) :: output_level
       LOGICAL           , OPTIONAL, INTENT(IN) :: enabled
-      
-     CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled)
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type
+      
+     CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled, type)
 
    END SUBROUTINE xios(set_filegroup_attr_hdl)
       
    
-   SUBROUTINE xios(set_filegroup_attr_hdl_)(filegroup_hdl, name_ , description_, name_suffix_, output_freq_, output_level_, enabled_)
+   SUBROUTINE xios(set_filegroup_attr_hdl_)(filegroup_hdl, name_ , description_, name_suffix_, output_freq_, output_level_,     &
+                   enabled_,type_)
       IMPLICIT NONE
       TYPE(txios(filegroup))     , INTENT(IN) :: filegroup_hdl
@@ -141,4 +151,5 @@
       LOGICAL(kind = 1)                        :: enabled__
       LOGICAL           , OPTIONAL, INTENT(IN) :: enabled_
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type_
       
       IF (PRESENT(name_))         THEN
@@ -160,4 +171,8 @@
         enabled__ = enabled_ 
         CALL cxios_set_filegroup_enabled(filegroup_hdl%daddr, enabled__)
+      END IF
+      
+      IF (PRESENT(type_))         THEN
+         CALL cxios_set_filegroup_type(filegroup_hdl%daddr, type_, len(type_))
       END IF
 
Index: /XMLIO_V2/dev/common/src/fortran/ixios.F90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/ixios.F90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/ixios.F90	(revision 300)
@@ -8,5 +8,6 @@
                      xios(is_valid_context)
 
-USE idata, ONLY : xios(initialize), xios(finalize), xios(close_context_definition),       &
+USE idata, ONLY : xios(initialize),xios(init_server), xios(finalize), xios(context_initialize),  &
+                  xios(close_context_definition),       &
                   xios(context_finalize), xios(send_field_r8_1d), xios(send_field_r8_2d), &
                   xios(send_field_r8_3d), xios(send_field_r4_1d), xios(send_field_r4_2d), &
@@ -40,8 +41,4 @@
                      xios(add_fieldtofile), xios(add_axisgroup), xios(add_filegroup), xios(add_gridgroup), &
                      xios(add_fieldgroup), xios(add_domaingroup), xios(add_fieldgrouptofile)
-
-USE idata, ONLY : xios(initialize), xios(finalize), xios(close_context_definition), xios(context_finalize), &
-                  xios(send_field_r8_1d), xios(send_field_r8_2d), xios(send_field_r8_3d),                   &
-                  xios(send_field_r4_1d), xios(send_field_r4_2d), xios(send_field_r4_3d)
                   
 
@@ -85,4 +82,5 @@
 
  PUBLIC :: xios(get_handle) 
+ PUBLIC :: xios(add_child) 
 
  PUBLIC :: xios(is_valid_context),xios(is_valid_domain), xios(is_valid_domaingroup),xios(is_valid_field),        &
@@ -92,5 +90,6 @@
  PUBLIC :: xios(set_current_context)  
  PUBLIC :: xios(set_timestep),xios(update_calendar)
- PUBLIC :: xios(initialize), xios(finalize), xios(close_context_definition), xios(context_finalize), xios(send_field)
+ PUBLIC :: xios(initialize), xios(init_server), xios(finalize), xios(context_initialize),                       &
+           xios(close_context_definition), xios(context_finalize), xios(send_field)
 
 END MODULE XIOS
Index: /XMLIO_V2/dev/common/src/fortran/oasis_cinterface.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/oasis_cinterface.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/oasis_cinterface.cpp	(revision 300)
@@ -16,5 +16,12 @@
   }
   
-
+  void oasis_get_localcomm(MPI_Comm& comm)
+  {
+    MPI_Fint f_comm ;
+    
+    fxios_oasis_get_localcomm(&f_comm) ;
+    comm=MPI_Comm_f2c(f_comm) ;
+  }
+ 
   void oasis_get_intracomm(MPI_Comm& comm_client_server,const std::string& server_id)
   {
@@ -24,4 +31,11 @@
     comm_client_server=MPI_Comm_f2c(f_comm) ;
   }
-
+ 
+  void oasis_get_intercomm(MPI_Comm& comm_client_server,const std::string& server_id)
+  {
+    MPI_Fint f_comm ;
+    
+    fxios_oasis_get_intercomm(&f_comm,server_id.data(),server_id.size()) ;
+    comm_client_server=MPI_Comm_f2c(f_comm) ;
+  }
 }
Index: /XMLIO_V2/dev/common/src/fortran/oasis_cinterface.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/oasis_cinterface.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/oasis_cinterface.hpp	(revision 300)
@@ -9,5 +9,7 @@
   void fxios_oasis_init(const char* server_id,int str_len) ;
   void fxios_oasis_finalize(void) ;
+  void fxios_oasis_get_localcomm(MPI_Fint* f_comm) ;
   void fxios_oasis_get_intracomm(MPI_Fint* f_comm_client_server,const char* client_id,int str_len) ;
+  void fxios_oasis_get_intercomm(MPI_Fint* f_comm_client_server,const char* client_id,int str_len) ;
 }
  
@@ -16,5 +18,7 @@
   void oasis_init(const std::string& server_id) ;
   void oasis_finalize(void) ;
+  void oasis_get_localcomm(MPI_Comm& comm) ;
   void oasis_get_intracomm(MPI_Comm& comm_client_server,const std::string& server_id) ;
+  void oasis_get_intercomm(MPI_Comm& comm_client_server,const std::string& server_id) ;
 }
 #endif
Index: /XMLIO_V2/dev/common/src/fortran/oasis_interface.F90
===================================================================
--- /XMLIO_V2/dev/common/src/fortran/oasis_interface.F90	(revision 299)
+++ /XMLIO_V2/dev/common/src/fortran/oasis_interface.F90	(revision 300)
@@ -39,4 +39,25 @@
 
 
+SUBROUTINE fxios_oasis_get_localcomm(f_comm) BIND(C,NAME="fxios_oasis_get_localcomm")
+  USE, INTRINSIC :: ISO_C_BINDING
+#ifdef USE_OASIS
+!  USE mod_prism_get_localcomm_proto 
+#endif
+  IMPLICIT NONE
+  INTEGER(kind=C_INT) :: f_comm
+  
+  INTEGER :: comm
+  INTEGER :: ierr
+    
+#ifdef USE_OASIS
+    CALL prism_get_localcomm_proto(comm,ierr)
+#endif
+    f_comm=comm
+
+END SUBROUTINE fxios_oasis_get_localcomm
+
+
+
+
 SUBROUTINE fxios_oasis_get_intracomm(f_comm_client_server,client_id,str_len) BIND(C,NAME="fxios_oasis_get_intracomm")
   USE, INTRINSIC :: ISO_C_BINDING
@@ -61,6 +82,33 @@
     CALL prism_get_intracomm(comm_client_server,oasis_client_id,ierr)
 #endif
-    PRINT *,"---> prism_get_intracomm ",oasis_client_id,comm_client_server,ierr
+
     f_comm_client_server=comm_client_server
 
 END SUBROUTINE fxios_oasis_get_intracomm
+
+SUBROUTINE fxios_oasis_get_intercomm(f_comm_client_server,client_id,str_len) BIND(C,NAME="fxios_oasis_get_intercomm")
+  USE, INTRINSIC :: ISO_C_BINDING
+#ifdef USE_OASIS
+  USE mod_prism_get_comm 
+#endif
+  IMPLICIT NONE
+  INTEGER(kind=C_INT) :: f_comm_client_server
+  CHARACTER,DIMENSION(*) :: client_id
+  INTEGER,VALUE          :: str_len
+  
+  INTEGER :: comm_client_server
+  CHARACTER(len=str_len) :: oasis_client_id
+  INTEGER :: ierr
+  INTEGER :: i
+    
+    DO i=1,str_len
+      oasis_client_id(i:i)=client_id(i)
+    ENDDO
+    
+#ifdef USE_OASIS
+    CALL prism_get_intercomm(comm_client_server,oasis_client_id,ierr)
+#endif
+
+    f_comm_client_server=comm_client_server
+
+END SUBROUTINE fxios_oasis_get_intercomm
Index: /XMLIO_V2/dev/common/src/group_template.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/group_template.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/group_template.hpp	(revision 300)
@@ -2,5 +2,8 @@
 #define __XMLIO_CGroupTemplate__
 
+#include "xmlioserver_spl.hpp"
 #include "declare_attribute.hpp"
+#include "event_server.hpp"
+#include "object_template.hpp"
 
 namespace xmlioserver
@@ -23,4 +26,9 @@
 
       public :
+      
+         enum EEventId
+         {
+           EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP
+         } ;
 
          /// SpÃ©cifique ///
@@ -55,5 +63,17 @@
          virtual void solveDescInheritance(const CAttributeMap * const parent = 0);
          void solveRefInheritance(void);
-
+//         static bool has(const string & id); 
+//         static boost::shared_ptr<V> get(const string& id) ;
+//         static boost::shared_ptr<V> create(const string& id=string("")) ;
+         boost::shared_ptr<U> createChild(const string& id="") ; 
+         boost::shared_ptr<V> createChildGroup(const string& id="") ; 
+         static bool dispatchEvent(CEventServer& event) ;
+         void sendCreateChild(const string& id="") ;
+         void sendCreateChildGroup(const string& id="") ;
+         static void recvCreateChild(CEventServer& event) ;
+         void recvCreateChild(CBufferIn& buffer) ;
+         static void recvCreateChildGroup(CEventServer& event) ;
+         void recvCreateChildGroup(CBufferIn& buffer) ;
+         
          /// Destructeur ///
          virtual ~CGroupTemplate(void);
@@ -82,3 +102,5 @@
 } // namespace xmlioserver
 
+//#include "group_template_impl.hpp"
+
 #endif // __XMLIO_CGroupTemplate__
Index: /XMLIO_V2/dev/common/src/group_template_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/group_template_impl.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/group_template_impl.hpp	(revision 300)
@@ -1,4 +1,13 @@
 #ifndef __XMLIO_CGroupTemplate_impl__
 #define __XMLIO_CGroupTemplate_impl__
+
+#include "xmlioserver_spl.hpp"
+#include "event_server.hpp"
+#include "object_template_impl.hpp"
+#include "group_template.hpp"
+#include "context.hpp"
+#include "event_client.hpp"
+#include "context_client.hpp"
+
 
 namespace xmlioserver
@@ -307,7 +316,151 @@
       void CGroupTemplate<U, V, W>::solveRefInheritance(void)
    { /* Ne rien faire de plus */ }
-
+   
+//   template <class U, class V, class W>
+//   bool CGroupTemplate<U, V, W>::has(const string& id) 
+//   {
+//       return CObjectFactory::HasObject<V>(id) ;
+//   }
+
+//   template <class U, class V, class W>
+//   boost::shared_ptr<V> CGroupTemplate<U, V, W>::get(const string& id) 
+//   {
+//       return CObjectFactory::GetObject<V>(id) ;
+//   }
+
+//   template <class U, class V, class W>
+//   boost::shared_ptr<V> CGroupTemplate<U, V, W>::get() 
+//   {
+//       return CObjectFactory::GetObject<V>(this) ;
+//   }
+   
+//   template <class U, class V, class W>
+//   boost::shared_ptr<V> CGroupTemplate<U, V, W>::create(const string& id) 
+//   {
+//       return CObjectFactory::CreateObject<V>(id) ;
+//   }
    ///--------------------------------------------------------------
 
+   template <class U, class V, class W>
+   boost::shared_ptr<U> CGroupTemplate<U, V, W>::createChild(const string& id) 
+  {
+    return CGroupFactory::CreateChild<V>(this->get(), id) ;
+  }
+  
+   template <class U, class V, class W>
+   boost::shared_ptr<V> CGroupTemplate<U, V, W>::createChildGroup(const string& id) 
+  {
+    return CGroupFactory::CreateGroup<V>(this->get(), id) ;
+  }
+
+
+   template <class U, class V, class W>
+   void CGroupTemplate<U, V, W>::sendCreateChild(const string& id)
+   {
+    shared_ptr<CContext> context=CContext::current() ;
+    
+    if (! context->hasServer )
+    {
+       CContextClient* client=context->client ;
+
+       CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ;   
+       if (client->isServerLeader())
+       {
+         CMessage msg ;
+         msg<<this->getId() ;
+         msg<<id ;
+         event.push(client->getServerLeader(),1,msg) ;
+         client->sendEvent(event) ;
+       }
+       else client->sendEvent(event) ;
+    }
+      
+   }
+   
+   template <class U, class V, class W>
+   void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id)
+   {
+    shared_ptr<CContext> context=CContext::current() ;
+    if (! context->hasServer )
+    {
+       CContextClient* client=context->client ;
+
+       CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ;   
+       if (client->isServerLeader())
+       {
+         CMessage msg ;
+         msg<<this->getId() ;
+         msg<<id ;
+         event.push(client->getServerLeader(),1,msg) ;
+         client->sendEvent(event) ;
+       }
+       else client->sendEvent(event) ;
+    }
+      
+   }
+   
+   template <class U, class V, class W>
+   void CGroupTemplate<U, V, W>::recvCreateChild(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      V::get(id)->recvCreateChild(*buffer) ;
+   }
+   
+   
+   template <class U, class V, class W>
+   void CGroupTemplate<U, V, W>::recvCreateChild(CBufferIn& buffer)
+   {
+      string id ;
+      buffer>>id ;
+      createChild(id) ;
+   }
+
+   template <class U, class V, class W>
+   void CGroupTemplate<U, V, W>::recvCreateChildGroup(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      V::get(id)->recvCreateChildGroup(*buffer) ;
+   }
+   
+   
+   template <class U, class V, class W>
+   void CGroupTemplate<U, V, W>::recvCreateChildGroup(CBufferIn& buffer)
+   {
+      string id ;
+      buffer>>id ;
+      createChildGroup(id) ;
+   }
+   
+
+   template <class U, class V, class W>
+   bool CGroupTemplate<U, V, W>::dispatchEvent(CEventServer& event)
+   {
+      if (CObjectTemplate<V>::dispatchEvent(event)) return true ;
+      else
+      {
+        switch(event.type)
+        {
+           case EVENT_ID_CREATE_CHILD :
+             recvCreateChild(event) ;
+             return true ;
+             break ;
+         
+           case EVENT_ID_CREATE_CHILD_GROUP :
+             recvCreateChildGroup(event) ;
+             return true ;
+             break ;       
+         
+           default :
+           return false ;
+        }
+      }
+   }
+
 } // namespace xmlioserver
 
Index: /XMLIO_V2/dev/common/src/log.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/log.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/log.cpp	(revision 300)
@@ -0,0 +1,6 @@
+#include "log.hpp"
+
+namespace xmlioserver
+{
+  CLog info ;
+}
Index: /XMLIO_V2/dev/common/src/log.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/log.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/log.hpp	(revision 300)
@@ -0,0 +1,34 @@
+#ifndef __XIOS_LOG__
+
+#include <iostream>
+
+namespace xmlioserver
+{
+  using namespace std ;
+
+  class CLog : public ostream
+  {
+    public :
+    CLog(void) : ostream(cout.rdbuf()),level(0) {}
+    CLog& operator()(int l) 
+    {  
+      if (l<=level) 
+      {
+        rdbuf(cout.rdbuf()) ;
+        *this<<"-> info : " ;
+      }
+      else rdbuf(NULL) ;
+      return *this;
+    }
+    void setLevel(int l) {level=l; } 
+    int getLevel() {return level ;}
+    bool isActive(void) { if (rdbuf()==NULL) return true ; else return false ;}
+    bool isActive(int l) {if (l<=level) return true ; else return false ; }
+
+    private :
+    int level ;
+  };
+
+  extern CLog info;
+}
+#endif
Index: /XMLIO_V2/dev/common/src/main_server.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/main_server.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/main_server.cpp	(revision 300)
@@ -14,4 +14,5 @@
 
 
+
 // Point d'entrÃ©e du programme principal
 
@@ -26,16 +27,10 @@
       CTreeManager::SetCurrentContextId(StdString("xios"));
       boost::shared_ptr<CVariable> var = CObjectFactory::GetObject<CVariable>("buffer_client_size"); 
-      std::cout<<CObjectFactory::GetObject<CVariable>("xios","using_oasis")->getData<bool>()<<std::endl;
      
 //      oasis_init(std::string("ionemo")) ;
-//      std::cout<<"Initialisation OASIS Ok"<<std::endl ;
 //      oasis_get_intracomm(comm_parent,std::string("oceanx")) ;
-//      std::cout<<"Appel Oasis intracom Ok"<<std::endl ;
       CXIOSManager::Initialise(CXIOSManager::CLIENT_SERVER, &argc, &argv);
      
-      std::cout<<"Appel Dispatch client ?"<<std::endl ;
-      std::cout<<comm_client<<" "<<comm_client_server<<" "<<comm_server<<"  "<<comm_parent<<std::endl ;
       CMPIManager::DispatchClient(true, comm_client, comm_client_server, comm_server, comm_parent);
-      std::cout<<"Appel Dispatch client Ok"<<std::endl ;
       CXIOSManager::RunServer("Nemo", comm_client_server, comm_server);
       CTreeManager::SetCurrentContextId(StdString("nemo"));
Index: /XMLIO_V2/dev/common/src/manager/xios_manager.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/manager/xios_manager.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/manager/xios_manager.cpp	(revision 300)
@@ -126,15 +126,4 @@
          if (CMPIManager::IsMaster(comm_client_server))
          {
-            std::cout << " *************************************** " << std::endl
-                      << " *     XmlIOServer (Client/Server)     * " << std::endl
-                      << " *************************************** " << std::endl;
-            std::cout << " > Nombre de processus : "
-                      << CMPIManager::GetCommSize(comm_client_server) << std::endl;
-            std::cout << " > Nombre de processus utilisÃ©s : "
-                      << (CXIOSManager::GetNbClient() + CXIOSManager::GetNbServer()) << std::endl;
-            std::cout << " > Nombre de clients : "
-                      << CXIOSManager::GetNbClient() << std::endl;
-            std::cout << " > Nombre de serveurs : "
-                      << CXIOSManager::GetNbServer() << std::endl;
 
             xios_map<StdString, XIOSClient>::iterator
@@ -145,15 +134,6 @@
             {
                const StdPairStrClient & elem = *iit;
-               std::cout << " - " << elem.first
-                         << " > nombre de clients : "             
-                         << elem.second.nbClient
-                         << " , nombre de clients par serveur : " 
-                         << elem.second.nbClientPServer
-                         << " , nombre de serveurs : "            
-                         << elem.second.nbClient/elem.second.nbClientPServer
-                         << std::endl;
-            }
-
-            std::cout << " *************************************** " << std::endl;
+            }
+
          }
 
Index: /XMLIO_V2/dev/common/src/node/axis.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/axis.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/axis.cpp	(revision 300)
@@ -4,4 +4,5 @@
 #include "object_template_impl.hpp"
 #include "group_template_impl.hpp"
+#include "transfert_parameters.hpp"
 
 namespace xmlioserver {
Index: /XMLIO_V2/dev/common/src/node/context.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/context.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/context.cpp	(revision 300)
@@ -1,4 +1,3 @@
 #include "context.hpp"
-
 #include "tree_manager.hpp"
 
@@ -11,4 +10,7 @@
 
 #include "data_treatment.hpp"
+#include "context_client.hpp"
+#include "context_server.hpp"
+#include "nc4_data_output.hpp"
 
 namespace xmlioserver {
@@ -19,14 +21,17 @@
    CContext::CContext(void)
       : CObjectTemplate<CContext>(), CContextAttributes()
-      , calendar()
+      , calendar(),hasClient(false),hasServer(false)
    { /* Ne rien faire de plus */ }
 
    CContext::CContext(const StdString & id)
       : CObjectTemplate<CContext>(id), CContextAttributes()
-      , calendar()
+      , calendar(),hasClient(false),hasServer(false)
    { /* Ne rien faire de plus */ }
 
    CContext::~CContext(void)
-   { /* Ne rien faire de plus */ }
+   { 
+     if (hasClient) delete client ;
+     if (hasServer) delete server ;
+   }
 
    //----------------------------------------------------------------
@@ -299,5 +304,279 @@
    }
    ///---------------------------------------------------------------
-
+   
+   void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm)
+   {
+     hasClient=true ;
+     client = new CContextClient(this,intraComm, interComm) ;
+   } 
+
+   void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm)
+   {
+     hasServer=true ;
+     server = new CContextServer(this,intraComm,interComm) ;
+   } 
+
+   bool CContext::eventLoop(void)
+   {
+     return server->eventLoop() ;
+   } 
+   
+   void CContext::finalize(void)
+   {
+      if (hasClient && !hasServer)
+      {
+         client->finalize() ;
+      }
+      if (hasServer)
+      {
+        closeAllFile() ;
+      }
+   }
+       
+       
+ 
+   
+   void CContext::closeDefinition(void)
+   {
+      if (hasClient && !hasServer) sendCloseDefinition() ;
+      
+      solveCalendar();         
+         
+      // RÃ©solution des hÃ©ritages pour le context actuel.
+      this->solveAllInheritance();
+
+      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers Ã  sortir.
+      this->findEnabledFiles();
+
+      //Recherche des champs Ã  sortir (enable Ã  true + niveau de sortie correct)
+      // pour chaque fichier prÃ©cÃ©demment listÃ©.
+      this->findAllEnabledFields();
+
+      // RÃ©solution des rÃ©fÃ©rences de grilles pour chacun des champs.
+      this->solveAllGridRef();
+
+      // Traitement des opÃ©rations.
+      this->solveAllOperation();
+
+      // Nettoyage de l'arborescence
+      CleanTree();
+      if (hasClient) sendCreateFileHeader() ;
+   }
+   
+   void CContext::findAllEnabledFields(void)
+   {
+     for (unsigned int i = 0; i < this->enabledFiles.size(); i++)
+     (void)this->enabledFiles[i]->getEnabledFields();
+   }
+
+   void CContext::solveAllGridRef(void)
+   {
+     for (unsigned int i = 0; i < this->enabledFiles.size(); i++)
+     this->enabledFiles[i]->solveEFGridRef();
+   }
+
+   void CContext::solveAllOperation(void)
+   {
+      for (unsigned int i = 0; i < this->enabledFiles.size(); i++)
+      this->enabledFiles[i]->solveEFOperation();
+   }
+
+   void CContext::solveAllInheritance(void)
+   {
+     // RÃ©solution des hÃ©ritages descendants (cÃ d des hÃ©ritages de groupes)
+     // pour chacun des contextes.
+      solveDescInheritance();
+
+     // RÃ©solution des hÃ©ritages par rÃ©fÃ©rence au niveau des fichiers.
+      const std::vector<boost::shared_ptr<CFile> > & allFiles
+             = CObjectFactory::GetObjectVector<CFile>();
+
+      for (unsigned int i = 0; i < allFiles.size(); i++)
+         allFiles[i]->solveFieldRefInheritance();
+   }
+
+   void CContext::findEnabledFiles(void)
+   {
+      const std::vector<boost::shared_ptr<CFile> > & allFiles
+          = CObjectFactory::GetObjectVector<CFile>();
+
+      for (unsigned int i = 0; i < allFiles.size(); i++)
+         if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est dÃ©fini.
+            if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fixÃ© Ã  vrai.
+               enabledFiles.push_back(allFiles[i]);
+
+      if (enabledFiles.size() == 0)
+         DEBUG(<<"Aucun fichier ne va Ãªtre sorti dans le contexte nommÃ© \""
+               << getId() << "\" !");
+   }
+
+   void CContext::closeAllFile(void)
+   {
+     std::vector<boost::shared_ptr<CFile> >::const_iterator
+            it = this->enabledFiles.begin(), end = this->enabledFiles.end();
+         
+     for (; it != end; it++)
+     {
+       info(30)<<"Closing File : "<<(*it)->getId()<<endl;
+       (*it)->close();
+     }
+   }
+   
+   bool CContext::dispatchEvent(CEventServer& event)
+   {
+      
+      if (SuperClass::dispatchEvent(event)) return true ;
+      else
+      {
+        switch(event.type)
+        {
+           case EVENT_ID_CLOSE_DEFINITION :
+             recvCloseDefinition(event) ;
+             return true ;
+             break ;
+           case EVENT_ID_UPDATE_CALENDAR :
+             recvUpdateCalendar(event) ;
+             return true ;
+             break ;
+           case EVENT_ID_CREATE_FILE_HEADER :
+             recvCreateFileHeader(event) ;
+             return true ;
+             break ;
+           default :
+             ERROR("bool CContext::dispatchEvent(CEventServer& event)",
+                    <<"Unknown Event") ;
+           return false ;
+         }
+      }
+   }
+   
+   void CContext::sendCloseDefinition(void)
+   {
+
+     CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION) ;   
+     if (client->isServerLeader())
+     {
+       CMessage msg ;
+       msg<<this->getId() ;
+       event.push(client->getServerLeader(),1,msg) ;
+       client->sendEvent(event) ;
+     }
+     else client->sendEvent(event) ;
+   }
+   
+   void CContext::recvCloseDefinition(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      get(id)->closeDefinition() ;
+   }
+   
+   void CContext::sendUpdateCalendar(int step)
+   {
+     if (!hasServer)
+     {
+       CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR) ;   
+       if (client->isServerLeader())
+       {
+         CMessage msg ;
+         msg<<this->getId()<<step ;
+         event.push(client->getServerLeader(),1,msg) ;
+         client->sendEvent(event) ;
+       }
+       else client->sendEvent(event) ;
+     }
+   }
+   
+   void CContext::recvUpdateCalendar(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      get(id)->recvUpdateCalendar(*buffer) ;
+   }
+   
+   void CContext::recvUpdateCalendar(CBufferIn& buffer)
+   {
+      int step ;
+      buffer>>step ;
+      updateCalendar(step) ;
+   }
+   
+   void CContext::sendCreateFileHeader(void)
+   {
+
+     CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER) ;   
+     if (client->isServerLeader())
+     {
+       CMessage msg ;
+       msg<<this->getId() ;
+       event.push(client->getServerLeader(),1,msg) ;
+       client->sendEvent(event) ;
+     }
+     else client->sendEvent(event) ;
+   }
+   
+   void CContext::recvCreateFileHeader(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      get(id)->recvCreateFileHeader(*buffer) ;
+   }
+   
+   void CContext::recvCreateFileHeader(CBufferIn& buffer)
+   {
+      createFileHeader() ;
+   }
+   
+   void CContext::updateCalendar(int step)
+   {
+      calendar->update(step) ;
+   }
+ 
+   void CContext::createFileHeader(void )
+   {
+      vector<shared_ptr<CFile> >::const_iterator it ;
+         
+      for (it=enabledFiles.begin(); it != enabledFiles.end(); it++)
+      {
+/*         shared_ptr<CFile> file = *it;
+         StdString filename = (!file->name.isEmpty()) ?   file->name.getValue() : file->getId();
+         StdOStringStream oss;
+         if (! output_dir.isEmpty()) oss << output_dir.getValue();
+         oss << filename;
+         if (!file->name_suffix.isEmpty()) oss << file->name_suffix.getValue();
+
+         bool multifile=true ;
+         if (!file->type.isEmpty())
+         {
+           StdString str=file->type.getValue() ; 
+           if (str.compare("one_file")==0) multifile=false ;
+           else if (str.compare("multi_file")==0) multifile=true ;
+           else ERROR("void Context::createDataOutput(void)",
+                      "incorrect file <type> attribut : must be <multi_file> or <one_file>, "
+                      <<"having : <"<<str<<">") ;
+         } 
+         if (multifile) 
+         {
+            if (server->intraCommSize > 1) oss << "_" << server->intraCommRank;
+         }
+         oss << ".nc";
+
+         shared_ptr<io::CDataOutput> dout(new T(oss.str(), false,server->intraComm,multifile));
+*/
+         (*it)->createHeader();
+      }
+   } 
+   
+   shared_ptr<CContext> CContext::current(void)
+   {
+     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+   }
+   
 } // namespace tree
 } // namespace xmlioserver
Index: /XMLIO_V2/dev/common/src/node/context.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/context.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/context.hpp	(revision 300)
@@ -8,4 +8,9 @@
 
 #include "declare_group.hpp"
+//#include "context_client.hpp"
+//#include "context_server.hpp"
+#include "data_output.hpp"
+
+#include <mpi.h>
 
 namespace xmlioserver {
@@ -16,4 +21,7 @@
 
 namespace xmlioserver {
+   class CContextClient ;
+   class CContextServer ;
+   
 namespace tree {
    
@@ -22,5 +30,5 @@
    class CContextAttributes;
    class CContext;
-
+  
    ///--------------------------------------------------------------
 
@@ -36,4 +44,11 @@
       , public CContextAttributes
    {
+         public :
+         enum EEventId
+         {
+           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR,
+           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE
+         } ;
+         
          /// typedef ///
          typedef CObjectTemplate<CContext>   SuperClass;
@@ -90,4 +105,35 @@
          /// Test ///
          virtual bool hasChild(void) const;
+
+         bool eventLoop(void) ;
+         bool serverLoop(void) ;
+         void clientLoop(void) ;
+         void initServer(MPI_Comm intraComm, MPI_Comm interComm) ;
+         void initClient(MPI_Comm intraComm, MPI_Comm interComm) ;
+         CContextServer* server ;
+         CContextClient* client ;
+         bool hasClient ;
+         bool hasServer ;
+         void finalize(void) ;
+         void closeDefinition(void) ;
+         void findAllEnabledFields(void);
+         void solveAllGridRef(void);
+         void solveAllOperation(void);
+         void solveAllInheritance(void) ;
+         void findEnabledFiles(void);
+         void closeAllFile(void) ;
+         void updateCalendar(int step) ;
+         void createFileHeader(void ) ;
+      // dispatch event
+         static bool dispatchEvent(CEventServer& event) ;
+         void sendCloseDefinition(void) ;
+         void sendUpdateCalendar(int step) ;
+         void sendCreateFileHeader(void) ;
+         static void recvUpdateCalendar(CEventServer& event) ;
+         void recvUpdateCalendar(CBufferIn& buffer) ;
+         static void recvCloseDefinition(CEventServer& event) ;
+         static void recvCreateFileHeader(CEventServer& event) ;
+         void recvCreateFileHeader(CBufferIn& buffer) ;
+         static shared_ptr<CContext> current(void) ;
          
       public :
@@ -100,8 +146,11 @@
          virtual void fromBinary(StdIStream & is);
          
-      private :
+      public :
       
          boost::shared_ptr<date::CCalendar>      calendar;
          boost::shared_ptr<data::CDataTreatment> datat;
+ 
+         std::vector<boost::shared_ptr<CFile> > enabledFiles;
+
 
    }; // class CContext
Index: /XMLIO_V2/dev/common/src/node/domain.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/domain.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/domain.cpp	(revision 300)
@@ -8,6 +8,8 @@
 
 #include "tree_manager.hpp"
-
-#include <algorithm>
+#include "xmlioserver_spl.hpp"
+#include "event_client.hpp"
+#include "event_server.hpp"
+#include "buffer_in.hpp"
 
 namespace xmlioserver {
@@ -21,5 +23,6 @@
       , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()
       , ibegin_zoom_sub(), jbegin_zoom_sub(), ni_zoom_sub(), nj_zoom_sub()
-      , lonvalue_sub(), latvalue_sub()
+      , lonvalue_sub(), latvalue_sub(),lonvalue_srv(new CArray<double,1>())
+      , latvalue_srv(new CArray<double,1>())
    { /* Ne rien faire de plus */ }
 
@@ -29,5 +32,6 @@
       , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()
       , ibegin_zoom_sub(), jbegin_zoom_sub(),ni_zoom_sub(), nj_zoom_sub()
-      , lonvalue_sub(), latvalue_sub()
+      , lonvalue_sub(), latvalue_sub(),lonvalue_srv(new CArray<double,1>())
+      , latvalue_srv(new CArray<double,1>())
    { /* Ne rien faire de plus */ }
 
@@ -61,6 +65,6 @@
    bool CDomain::isEmpty(void) const
    {
-      return ((this->zoom_ni_loc.getValue() == 0) || 
-              (this->zoom_nj_loc.getValue() == 0));
+      return ((this->zoom_ni_srv == 0) || 
+              (this->zoom_nj_srv == 0));
    }
 
@@ -258,12 +262,4 @@
       }
       
-      //~ std::cout << "-------------------" << std::endl
-                //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl
-                //~ << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl
-                //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl
-                //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl
-                //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl
-                //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl
-                //~ << "-------------------" << std::endl;
 
       if (!mask.isEmpty())
@@ -498,9 +494,4 @@
                 jbegin_zoom_srv = zoom_jbegin_loc.getValue();
                       
-      /*std::cout << "Rang du serveur :" << comm::CMPIManager::GetCommRank()   << std::endl
-                << "Begin serv : "     << ibegin_serv << ", " << jbegin_serv <<  std::endl
-                << "End serv : "       << iend_serv   << ", " << jend_serv   <<  std::endl
-                << "Zoom_loc begin : " << zoom_ibegin_loc << ", " << zoom_jbegin_loc <<  std::endl
-                << "Zoom_loc size : "  << zoom_ni_loc << ", " << zoom_nj_loc <<  std::endl;*/
                        
       if (this->data_dim.getValue() == 2)
@@ -647,4 +638,5 @@
    {
       if (this->isChecked) return;
+      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
 
       this->checkGlobalDomain();
@@ -653,6 +645,6 @@
       
       this->checkZoom();
-
-      if (this->latvalue_sub.size() == 0)
+      
+      if (context->hasClient)
       { // CÃŽtÃ© client uniquement
          this->checkMask();
@@ -678,15 +670,321 @@
             this->completeLonLatClient();
 //         }
+         this->completeMask();
+
       }
       else
       { // CÃŽtÃ© serveur uniquement
 //         if (!this->isEmpty())
-            this->completeLonLatServer();
-      }
-      this->completeMask();
-
+// ne sert plus //   this->completeLonLatServer();
+      }
+    
+      if (context->hasClient)
+      {
+        computeConnectedServer() ;
+        sendServerAttribut() ;
+        sendLonLat() ;
+      }
+      
       this->isChecked = true;
    }
    
+  void CDomain::sendServerAttribut(void)
+  {
+    int ni_srv=ni_glo.getValue() ;
+    int ibegin_srv=1 ;
+    int iend_srv=ni_glo.getValue() ;
+     
+    int nj_srv ;
+    int jbegin_srv ;
+    int jend_srv ;
+    
+    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+    CContextClient* client=context->client ;
+    int nbServer=client->serverSize ;
+    int serverRank=client->getServerLeader() ;
+    
+    jend_srv=0 ;
+    for(int i=0;i<=serverRank;i++)
+    {
+      jbegin_srv=jend_srv+1 ;
+      nj_srv=nj_glo.getValue()/nbServer ;
+      if (i<nj_glo.getValue()%nbServer) nj_srv++ ;
+      jend_srv=jbegin_srv+nj_srv-1 ;
+    }
+    
+     CEventClient event(getType(),EVENT_ID_SERVER_ATTRIBUT) ;   
+     if (client->isServerLeader())
+     {
+       CMessage msg ;
+       msg<<this->getId() ;
+       msg<<ni_srv<<ibegin_srv<<iend_srv<<nj_srv<<jbegin_srv<<jend_srv;
+       event.push(client->getServerLeader(),1,msg) ;
+       client->sendEvent(event) ;
+     }
+     else client->sendEvent(event) ;
+  }
+  
+  void CDomain::computeConnectedServer(void)
+  {
+    int ib,ie,in;
+    int jb,je,jn ;
+    
+    int ni_srv=ni_glo.getValue() ;
+    int ibegin_srv=1 ;
+    int iend_srv=ni_glo.getValue() ;
+     
+    int nj_serv,jbegin_srv, jend_srv ;
+    int zoom_ibegin_srv,zoom_iend_srv,zoom_ni_srv ;
+    int zoom_jbegin_srv,zoom_jend_srv,zoom_nj_srv ;
+    
+    ibegin_client=ibegin.getValue() ; iend_client=iend.getValue() ; ni_client=ni.getValue() ;
+    jbegin_client=jbegin.getValue() ; jend_client=jend.getValue() ; nj_client=nj.getValue() ;
+     
+    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+    CContextClient* client=context->client ;
+    int nbServer=client->serverSize ;
+    
+    // compute client zoom indices
+    int zoom_iend=zoom_ibegin.getValue()+zoom_ni.getValue()-1 ;
+    zoom_ibegin_client = ibegin_client > zoom_ibegin.getValue() ? ibegin_client : zoom_ibegin.getValue() ;
+    zoom_iend_client = iend_client < zoom_iend ? iend_client : zoom_iend ;
+    zoom_ni_client=zoom_iend_client-zoom_ibegin_client+1 ;
+    if (zoom_ni_client<0) zoom_ni_client=0 ;
+
+    int zoom_jend=zoom_jbegin.getValue()+zoom_nj.getValue()-1 ;
+    zoom_jbegin_client = jbegin_client > zoom_jbegin.getValue() ? jbegin_client : zoom_jbegin.getValue() ;
+    zoom_jend_client = jend_client < zoom_jend ? jend_client : zoom_jend ;
+    zoom_nj_client=zoom_jend_client-zoom_jbegin_client+1 ;
+    if (zoom_nj_client<0) zoom_nj_client=0 ;
+ 
+    // find how much client are connected to a server
+    jend_srv=0 ;
+    for(int ns=0;ns<nbServer;ns++)
+    {
+      jbegin_srv=jend_srv+1 ;
+      nj_srv=nj_glo.getValue()/nbServer ;
+      if (ns<nj_glo.getValue()%nbServer) nj_srv++ ;
+      jend_srv=jbegin_srv+nj_srv-1 ;
+      
+      ib = ibegin_client>ibegin_srv ? ibegin_client : ibegin_srv ;
+      ie=  iend_client< iend_srv? iend_client : iend_srv ;
+      in=ie-ib+1 ;
+      if (in<0) in=0 ;
+      
+      jb= jbegin_client>jbegin_srv ? jbegin_client : jbegin_srv ;
+      je= jend_client<jend_srv ? jend_client : jend_srv ;
+      jn=je-jb+1 ;
+      if (jn<0) jn=0 ;
+        
+      if (in>0 && jn>0)
+      {
+        zoom_ibegin_srv = zoom_ibegin.getValue() > ibegin_srv ? zoom_ibegin.getValue() : ibegin_srv ;
+        zoom_iend_srv = zoom_iend < iend_srv ? zoom_iend : iend_srv ;
+        zoom_ni_srv=zoom_iend_srv-zoom_ibegin_srv+1 ;
+        if (zoom_ni_srv<0) zoom_ni_srv=0 ;
+      
+        zoom_jbegin_srv = zoom_jbegin.getValue() > jbegin_srv ? zoom_jbegin.getValue() : jbegin_srv ;
+        zoom_jend_srv = zoom_jend < jend_srv ? zoom_jend : jend_srv ;
+        zoom_nj_srv=zoom_jend_srv-zoom_jbegin_srv+1 ;
+        if (zoom_nj_srv<0) zoom_nj_srv=0 ;
+ 
+        if (zoom_ni_srv>0 && zoom_nj_srv>0 && zoom_ni_client>0 && zoom_nj_client>0)
+        {
+          ib = zoom_ibegin_client>zoom_ibegin_srv ? zoom_ibegin_client : zoom_ibegin_srv ;
+          ie=zoom_iend_client<zoom_iend_srv?zoom_iend_client:zoom_iend_srv ;
+          in=ie-ib+1 ;
+          if (in<0) in=0 ;
+        
+          jb=zoom_jbegin_client>zoom_jbegin_srv?zoom_jbegin_client:zoom_jbegin_srv ;
+          je=zoom_jend_client<zoom_jend_srv?zoom_jend_client:zoom_jend_srv ;
+          jn=je-jb+1 ;
+          if (jn<0) jn=0 ;
+        }
+        else
+        {
+          ib=1 ; ie=0 ; in=0 ;
+          jb=1 ; je=0 ; jn=0 ;
+        }
+        
+//          if (in>0 && jn>0) 
+//          { 
+            connectedServer.push_back(ns) ;
+            ib_srv.push_back(ib) ;
+            ie_srv.push_back(ie) ;
+            in_srv.push_back(in) ;
+            jb_srv.push_back(jb) ;
+            je_srv.push_back(je) ;
+            jn_srv.push_back(jn) ;
+//           }
+        
+      }
+    }
+    int nbConnectedServer=connectedServer.size() ;
+    int* recvCount=new int[client->clientSize] ;
+    int* displ=new int[client->clientSize] ;
+    int* sendBuff=new int[nbConnectedServer] ;
+    valarray<int> nbClient(0,client->serverSize) ;
+    
+    for(int n=0;n<nbConnectedServer;n++) sendBuff[n]=connectedServer[n] ;
+    
+    // get connected server for everybody
+    MPI_Allgather(&nbConnectedServer,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm) ;
+    
+    displ[0]=0 ;
+    for(int n=1;n<client->clientSize;n++) displ[n]=displ[n-1]+recvCount[n-1] ;
+    int recvSize=displ[client->clientSize-1]+recvCount[client->clientSize-1] ;
+    int* recvBuff=new int[recvSize] ;
+ 
+    
+    MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,client->intraComm) ;
+    for(int n=0;n<recvSize;n++) nbClient[recvBuff[n]]++ ;
+    
+    for(int n=0;n<nbConnectedServer;n++) nbSenders.push_back(nbClient[connectedServer[n]]) ;
+   
+    delete [] recvCount ;
+    delete [] displ ;
+    delete [] sendBuff ;
+    delete [] recvBuff ;
+  }
+  
+  void CDomain::sendLonLat(void)
+  {
+    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+    CContextClient* client=context->client ;
+    // send lon lat for each connected server
+    CEventClient event(getType(),EVENT_ID_LON_LAT) ;
+    
+    ARRAY(double, 1) lonvalue_client = lonvalue.getValue(),
+                     latvalue_client = latvalue.getValue();
+    
+    int ib,ie,in ;
+    int jb,je,jn ;
+  
+    list<shared_ptr<CMessage> > list_msg ;    
+    list<ARRAY(double,1)> list_indi,list_indj,list_lon,list_lat ;
+
+    for(int ns=0;ns<connectedServer.size();ns++)
+    {
+      ib=ib_srv[ns] ; ie=ie_srv[ns] ; in=in_srv[ns] ;
+      jb=jb_srv[ns] ; je=je_srv[ns] ; jn=jn_srv[ns] ;
+      
+      ARRAY_CREATE(indi,double,1,[in*jn]) ;
+      ARRAY_CREATE(indj,double,1,[in*jn]) ;
+      ARRAY_CREATE(lon,double,1,[in*jn]) ;
+      ARRAY_CREATE(lat,double,1,[in*jn]) ;
+
+          
+      int ind_client,ind_loc ;
+      
+      for(int j=jb;j<=je;j++)
+        for(int i=ib;i<=ie;i++)
+        {
+          ind_client=(i-zoom_ibegin_client)+(j-zoom_jbegin_client)*zoom_ni_client ;
+          ind_loc=(i-ib)+(j-jb)*in ;
+          (*lon)[ind_loc]=(*lonvalue_client)[ind_client] ;
+          (*lat)[ind_loc]=(*latvalue_client)[ind_client] ;
+          (*indi)[ind_loc]=i ;
+          (*indj)[ind_loc]=j ;
+        }
+      
+      list_indi.push_back(indi) ; list_indj.push_back(indj) ;
+      list_lon.push_back(lon) ; list_lat.push_back(lat) ;
+      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ;
+
+      *list_msg.back()<<this->getId() ;
+      *list_msg.back()<<list_indi.back()<<list_indj.back()<<list_lon.back()<<list_lat.back() ;
+      event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ;
+    }
+
+    client->sendEvent(event) ;
+  }
+  
+  bool CDomain::dispatchEvent(CEventServer& event)
+   {
+      
+      if (SuperClass::dispatchEvent(event)) return true ;
+      else
+      {
+        switch(event.type)
+        {
+           case EVENT_ID_SERVER_ATTRIBUT :
+             recvServerAttribut(event) ;
+             return true ;
+             break ;
+           case EVENT_ID_LON_LAT :
+             recvLonLat(event) ;
+             return true ;
+             break ;
+           default :
+             ERROR("bool CContext::dispatchEvent(CEventServer& event)",
+                    <<"Unknown Event") ;
+           return false ;
+         }
+      }
+   }
+   
+  void CDomain::recvServerAttribut(CEventServer& event)
+  {
+    CBufferIn* buffer=event.subEvents.begin()->buffer;
+    string domainId ;
+    *buffer>>domainId ;
+    get(domainId)->recvServerAttribut(*buffer) ;
+  }
+  
+  void CDomain::recvServerAttribut(CBufferIn& buffer)
+  {
+    int zoom_iend=zoom_ibegin.getValue()+zoom_ni.getValue()-1 ;
+    int zoom_jend=zoom_jbegin.getValue()+zoom_nj.getValue()-1 ;
+
+     buffer>>ni_srv>>ibegin_srv>>iend_srv>>nj_srv>>jbegin_srv>>jend_srv;
+    
+    zoom_ibegin_srv = zoom_ibegin.getValue() > ibegin_srv ? zoom_ibegin.getValue() : ibegin_srv ;
+    zoom_iend_srv = zoom_iend < iend_srv ? zoom_iend : iend_srv ;
+    zoom_ni_srv=zoom_iend_srv-zoom_ibegin_srv+1 ;
+      
+    zoom_jbegin_srv = zoom_jbegin.getValue() > jbegin_srv ? zoom_jbegin.getValue() : jbegin_srv ;
+    zoom_jend_srv = zoom_jend < jend_srv ? zoom_jend : jend_srv ;
+    zoom_nj_srv=zoom_jend_srv-zoom_jbegin_srv+1 ;
+
+    if (zoom_ni_srv<=0 || zoom_nj_srv<=0) 
+    {
+      zoom_ibegin_srv=1 ; zoom_iend_srv=0 ; zoom_ni_srv=0 ;
+      zoom_jbegin_srv=1 ; zoom_jend_srv=0 ; zoom_nj_srv=0 ;
+    }
+    
+    lonvalue_srv->resize(extents[zoom_ni_srv*zoom_nj_srv]) ;
+    latvalue_srv->resize(extents[zoom_ni_srv*zoom_nj_srv]) ;
+  }
+    
+  void CDomain::recvLonLat(CEventServer& event)
+  {
+    list<CEventServer::SSubEvent>::iterator it ;
+    for (it=event.subEvents.begin();it!=event.subEvents.end();++it)
+    {
+      CBufferIn* buffer=it->buffer;
+      string domainId ;
+      *buffer>>domainId ;
+      get(domainId)->recvLonLat(*buffer) ;
+    }
+  }
+  
+  void CDomain::recvLonLat(CBufferIn& buffer)
+  {
+    ARRAY_CREATE(indi,double,1,[0]) ;
+    ARRAY_CREATE(indj,double,1,[0]) ;
+    ARRAY_CREATE(lon,double,1,[0]) ;
+    ARRAY_CREATE(lat,double,1,[0]) ;
+    
+    buffer>>indi>>indj>>lon>>lat ;
+    int i,j,ind_srv ;
+
+    for(int ind=0;ind<indi->num_elements();ind++)
+    {
+      i=(*indi)[ind] ; j=(*indj)[ind] ;
+      ind_srv=(i-zoom_ibegin_srv)+(j-zoom_jbegin_srv)*zoom_ni_srv ;
+      (*lonvalue_srv)[ind_srv]=(*lon)[ind] ;
+      (*latvalue_srv)[ind_srv]=(*lat)[ind] ;
+    }
+  }
    //----------------------------------------------------------------
    
Index: /XMLIO_V2/dev/common/src/node/domain.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/domain.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/domain.hpp	(revision 300)
@@ -7,4 +7,7 @@
 
 #include "declare_group.hpp"
+#include "event_client.hpp"
+#include "event_server.hpp"
+#include "buffer_in.hpp"
 
 namespace xmlioserver {
@@ -30,4 +33,9 @@
       , public CDomainAttributes
    {
+         enum EEventId
+         {
+           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LON_LAT
+         } ;
+         
          /// typedef ///
          typedef CObjectTemplate<CDomain>   SuperClass;
@@ -91,4 +99,24 @@
          bool isEmpty(void) const;
          
+         
+         int ni_client,ibegin_client,iend_client ;
+         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ;
+
+         int nj_client,jbegin_client,jend_client ;
+         int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ;
+
+         int ni_srv,ibegin_srv,iend_srv ;
+         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ;
+
+         int nj_srv,jbegin_srv,jend_srv ;
+         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ;
+
+         ARRAY(double, 1) lonvalue_srv, latvalue_srv ;
+         
+         
+        vector<int> connectedServer,nbSenders ;
+        vector<int> ib_srv, ie_srv, in_srv ;
+        vector<int> jb_srv, je_srv, jn_srv ;
+         
       public :
       
@@ -97,4 +125,12 @@
          void completeLonLatServer(void);
          void completeLonLatClient(void);
+         void sendServerAttribut(void) ;
+         void sendLonLat(void) ;
+         void computeConnectedServer(void) ;
+         static bool dispatchEvent(CEventServer& event) ;
+         static void recvLonLat(CEventServer& event) ;
+         static void recvServerAttribut(CEventServer& event) ;
+         void recvLonLat(CBufferIn& buffer) ;
+         void recvServerAttribut(CBufferIn& buffer) ;
          
          /// Destructeur ///
@@ -117,4 +153,5 @@
          std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub, ni_zoom_sub, nj_zoom_sub;
          std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub;
+         
 
    }; // class CDomain
Index: /XMLIO_V2/dev/common/src/node/field.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/field.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/field.cpp	(revision 300)
@@ -73,5 +73,119 @@
       return (false);
    }
-
+   
+   bool CField::dispatchEvent(CEventServer& event)
+  {
+     
+    if (SuperClass::dispatchEvent(event)) return true ;
+    else
+    {
+      switch(event.type)
+      {
+        case EVENT_ID_UPDATE_DATA :
+          recvUpdateData(event) ;
+          return true ;
+          break ;
+ 
+        default :
+          ERROR("bool CField::dispatchEvent(CEventServer& event)",<<"Unknown Event") ;
+          return false ;
+      }
+    }
+  }
+  
+  void CField::sendUpdateData(void)
+  {
+    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+    CContextClient* client=context->client ;
+    
+    CEventClient event(getType(),EVENT_ID_UPDATE_DATA) ;
+    
+    map<int,ARRAY(int, 1)>::iterator it ;
+    list<shared_ptr<CMessage> > list_msg ;
+    list<ARRAY(double,1) > list_data ;
+    
+    for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++)
+    {
+      int rank=(*it).first ;
+      ARRAY(int,1) index=(*it).second ;
+      ARRAY_CREATE(data_tmp,double,1,[index->num_elements()]) ;
+      for(int n=0;n<data_tmp->num_elements();n++) (*data_tmp)[n]=(*data)[(*index)[n]] ;
+      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ;
+      list_data.push_back(data_tmp) ;
+      *list_msg.back()<<getId()<<list_data.back() ;
+      event.push(rank,grid->nbSenders[rank],*list_msg.back()) ;
+    }
+    client->sendEvent(event) ;
+  }
+  
+  void CField::recvUpdateData(CEventServer& event)
+  {
+    vector<int> ranks ;
+    vector<CBufferIn*> buffers ;
+      
+    list<CEventServer::SSubEvent>::iterator it ;
+    string fieldId ;
+
+    for (it=event.subEvents.begin();it!=event.subEvents.end();++it)
+    {
+      int rank=it->rank;
+      CBufferIn* buffer=it->buffer;
+      *buffer>>fieldId ;
+      ranks.push_back(rank) ;
+      buffers.push_back(buffer) ;
+    }
+    get(fieldId)->recvUpdateData(ranks,buffers) ;   
+  }
+  
+  void  CField::recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers)
+  {
+    
+    if (data_srv.empty())
+    {
+      for(map<int,ARRAY(int, 1)>::iterator it=grid->out_i_fromClient.begin();it!=grid->out_i_fromClient.end();it++)
+      {
+        int rank=it->first ;
+        ARRAY_CREATE(data_tmp,double,1,[it->second->num_elements()]) ;
+        data_srv.insert(pair<int, ARRAY(double,1)>(rank,data_tmp)) ;
+        foperation_srv.insert(pair<int,boost::shared_ptr<func::CFunctor> >(rank,boost::shared_ptr<func::CFunctor>(new func::CInstant(data_srv[rank])))) ;
+      }
+    }
+
+    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+    const date::CDate & currDate = context->getCalendar()->getCurrentDate();
+    const date::CDate opeDate      = *last_operation_srv + freq_operation_srv;
+    const date::CDate writeDate    = *last_Write_srv     + freq_write_srv; 
+    
+
+    
+    if (opeDate <= currDate)
+    {
+      for(int n=0;n<ranks.size();n++)
+      {
+        ARRAY_CREATE(data_tmp,double,1,[0]) ;
+        *buffers[n]>>data_tmp ;
+        (*foperation_srv[ranks[n]])(data_tmp) ;
+      }
+      *last_operation_srv = currDate;
+    }
+     
+    if (writeDate < (currDate + freq_operation_srv))
+    {
+      for(int n=0;n<ranks.size();n++)
+      {
+        this->foperation_srv[ranks[n]]->final();
+      }
+      
+      this->incrementNStep();
+      *last_Write_srv = writeDate;
+      writeField() ;
+    }
+  }
+  
+  void CField::writeField(void)
+  {
+    if (! grid->domain->isEmpty() || getRelFile()->type.getValue()=="one_file") 
+      getRelFile()->getDataOutput()->writeFieldData(CObjectFactory::GetObject<CField>(this));
+  }
    //----------------------------------------------------------------
 
@@ -232,5 +346,5 @@
        
       StdString id = this->getBaseFieldReference()->getId();
-      boost::shared_ptr<CContext> _context =
+      boost::shared_ptr<CContext> context =
          CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
 
@@ -252,30 +366,32 @@
       }  
 
-      if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER)
-      {
-         this->freq_operation =
+//      if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER)
+      if (context->hasServer)
+      {
+         this->freq_operation_srv =
              CDuration::FromString(this->file->output_freq.getValue());
-         this->freq_write     =
+         this->freq_write_srv     =
              CDuration::FromString(this->file->output_freq.getValue());
-         this->last_Write     = boost::shared_ptr<xmlioserver::date::CDate>
-                        (new date::CDate(_context->getCalendar()->getInitDate()));
-         this->last_operation = boost::shared_ptr<xmlioserver::date::CDate>
-                        (new date::CDate(_context->getCalendar()->getInitDate()));
-         this->foperation     =
-             boost::shared_ptr<func::CFunctor>(new CInstant(this->data));
+         this->last_Write_srv     = boost::shared_ptr<xmlioserver::date::CDate>
+                        (new date::CDate(context->getCalendar()->getInitDate()));
+         this->last_operation_srv = boost::shared_ptr<xmlioserver::date::CDate>
+                        (new date::CDate(context->getCalendar()->getInitDate()));
+//         this->foperation_srv     =
+//             boost::shared_ptr<func::CFunctor>(new CInstant(this->data_srv));
              
-         const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep(); 
-         *this->last_operation   = *this->last_operation - toffset; 
-      }
-      else
+         const CDuration toffset = this->freq_operation_srv - freq_offset_ - context->getCalendar()->getTimeStep(); 
+         *this->last_operation_srv   = *this->last_operation_srv - toffset; 
+      }
+      
+      if (context->hasClient)
       {                  
          this->freq_operation = CDuration::FromString(freq_op.getValue());
          this->freq_write     = CDuration::FromString(this->file->output_freq.getValue());
          this->last_Write     = boost::shared_ptr<xmlioserver::date::CDate>
-                        (new date::CDate(_context->getCalendar()->getInitDate()));
+                        (new date::CDate(context->getCalendar()->getInitDate()));
          this->last_operation = boost::shared_ptr<xmlioserver::date::CDate>
-                        (new date::CDate(_context->getCalendar()->getInitDate()));
+                        (new date::CDate(context->getCalendar()->getInitDate()));
                         
-         const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep(); 
+         const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep(); 
          *this->last_operation   = *this->last_operation - toffset;  
          
@@ -409,5 +525,22 @@
       }
    }
-
+   
+   void CField::outputField(ARRAY(double,3) fieldOut)
+   {
+      map<int,ARRAY(double,1)>::iterator it;
+      for(it=data_srv.begin();it!=data_srv.end();it++)
+         grid->outputField(it->first,it->second, fieldOut) ;
+      
+   }
+   
+   void CField::outputField(ARRAY(double,2) fieldOut)
+   {
+      map<int,ARRAY(double,1)>::iterator it;
+
+      for(it=data_srv.begin();it!=data_srv.end();it++)
+      {
+         grid->outputField(it->first,it->second, fieldOut) ;
+      }
+   }
    ///-------------------------------------------------------------------
 
Index: /XMLIO_V2/dev/common/src/node/field.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/field.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/field.hpp	(revision 300)
@@ -11,4 +11,6 @@
 #include "declare_group.hpp"
 #include "calendar_util.hpp"
+//#include "context.hpp"
+
 
 namespace xmlioserver {
@@ -23,5 +25,5 @@
    class CFile;
    class CGrid;
-
+   class CContext ;
    ///--------------------------------------------------------------
 
@@ -48,4 +50,9 @@
          typedef CFieldGroup      RelGroup;
 
+         enum EEventId
+         {
+           EVENT_ID_UPDATE_DATA
+         } ;
+         
          /// Constructeurs ///
          CField(void);
@@ -82,15 +89,11 @@
          void incrementNStep(void);
 
-         template <StdSize N>
-            inline bool updateData
-               (const date::CDate      & currDate,
-                const date::CDuration  & timestep,
-                const ARRAY(double, N)   data);
-
+         template <StdSize N> bool updateData(const ARRAY(double, N)   data);
+         
          bool updateDataServer
                (const date::CDate & currDate,
                 const std::deque<ARRAY(double, 1)> storedClient);
-
-      public :
+ 
+       public :
 
          /// Test ///
@@ -112,6 +115,15 @@
          
          static ENodeType GetType(void);
-
-      private :
+         
+        template <StdSize N> void setData(const ARRAY(double, N) _data) ;
+        static bool dispatchEvent(CEventServer& event) ;
+        void sendUpdateData(void) ;
+        static void recvUpdateData(CEventServer& event) ;
+        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ;
+        void writeField(void) ;
+        void outputField(ARRAY(double,3) fieldOut) ;
+        void outputField(ARRAY(double,2) fieldOut) ;
+        
+      public :
 
          /// PropriÃ©tÃ©s privÃ©es ///
@@ -123,10 +135,15 @@
 
          date::CDuration freq_operation, freq_write;
+         date::CDuration freq_operation_srv, freq_write_srv;
 
          StdSize nstep;
          boost::shared_ptr<date::CDate>    last_Write, last_operation;
+         boost::shared_ptr<date::CDate>    last_Write_srv, last_operation_srv;
+         
          boost::shared_ptr<func::CFunctor> foperation;
+         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv;
          
          ARRAY(double, 1) data;
+         map<int,ARRAY(double,1)> data_srv ;
 
    }; // class CField
@@ -153,25 +170,29 @@
 
    template <StdSize N>
-      bool CField::updateData(const date::CDate & currDate, const date::CDuration & timestep, const ARRAY(double, N) _data)
+   void CField::setData(const ARRAY(double, N) _data)
+   {
+     const std::vector<boost::shared_ptr<CField> > & refField=getAllReference();
+     std::vector<boost::shared_ptr<CField> >::const_iterator  it = refField.begin(), end = refField.end();
+     
+     for (; it != end; it++) (*it)->updateData(_data) ;
+    }
+    
+   template <StdSize N>
+      bool CField::updateData(const ARRAY(double, N) _data)
    {        
+      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+      const date::CDate & currDate = context->getCalendar()->getCurrentDate();
       const date::CDate opeDate      = *last_operation + freq_operation;
       const date::CDate writeDate    = *last_Write     + freq_write;       
 
-//      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
-//      std::cout << "Champ : "     << this->getBaseFieldId() << std::endl;
-//      std::cout << "CurrDate : "  << currDate  << std::endl;
-//      std::cout << "opeDate : "   << opeDate   << " = " << *last_operation << " + " << freq_operation << std::endl;
-//      std::cout	<< "writeDate : " << writeDate << " = " << *last_Write     << " + " << freq_write     << std::endl;
-//      std::cout << "(opeDate <= currDate)   = " << std::boolalpha << (opeDate <= currDate)   << std::endl;
-//      std::cout	<< "(writeDate <= currDate) = " << std::boolalpha << (writeDate <= currDate) << std::endl;   
    
-      std::cout << ">> " << currDate <<  " : Envoi de donnÃ©es " << this->getBaseFieldId() << std::endl;
-      std::cout << ">> next operation "  << opeDate<<std::endl;
+      info(50) << "CField::updateData " << currDate <<  " : send data to " << this->getBaseFieldId() << std::endl;
+      info(50) << "Next operation "  << opeDate<<std::endl;
+
       if (opeDate <= currDate)
       {
-         //std::cout << "> " << currDate << ": Operation du champs" << this->getBaseFieldId() << std::endl;
-         if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements())
+         if (this->data->num_elements() != this->grid->storeIndex_client->num_elements())
          {
-            this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]);
+            this->data->resize(boost::extents[this->grid->storeIndex_client ->num_elements()]);
          }
             
@@ -181,5 +202,5 @@
          
          *last_operation = currDate;
-         std::cout << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 
+         info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 
       }
       
@@ -187,12 +208,12 @@
       {
          this->foperation->final();
-         this->incrementNStep();
          *last_Write = writeDate;
-         std::cout << "(*last_Write = currDate) : " << *last_Write << " = " << currDate	<< std::endl;
+         info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate	<< std::endl;
+         sendUpdateData() ;
          return (true);        
       }
-//      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
+
       return (false);
-   };
+   }
 
 } // namespace tree
Index: /XMLIO_V2/dev/common/src/node/file.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/file.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/file.cpp	(revision 300)
@@ -7,4 +7,9 @@
 #include "object_factory.hpp"
 #include "object_factory_impl.hpp"
+#include "data_output.hpp"
+#include "context.hpp"
+#include "context_server.hpp"
+#include "nc4_data_output.hpp"
+
 
 namespace xmlioserver {
@@ -16,10 +21,10 @@
       : CObjectTemplate<CFile>(), CFileAttributes()
       , vFieldGroup(), data_out(), enabledFields()
-   { /* Ne rien faire de plus */ }
+   { setVirtualFieldGroup() ;}
 
    CFile::CFile(const StdString & id)
       : CObjectTemplate<CFile>(id), CFileAttributes()
       , vFieldGroup(), data_out(), enabledFields()
-   { /* Ne rien faire de plus */ }
+   { setVirtualFieldGroup() ;}
 
    CFile::~CFile(void)
@@ -62,37 +67,42 @@
       this->enabledFields = this->getAllFields();
 
-      std::cout<<"---> File :"<<this->name.getValue()<<std::endl ;
+      std::vector<boost::shared_ptr<CField> > newEnabledFields;
+      
       for ( it = this->enabledFields.begin() ; it != this->enabledFields.end(); it++ )
       {
          if (!(*it)->enabled.isEmpty()) // Si l'attribut 'enabled' est dÃ©fini ...
          {
-            if (! (*it)->enabled.getValue())
-            { it--; this->enabledFields.erase(it+1); continue; }
+            if (! (*it)->enabled.getValue()) continue;
+//            { it--; this->enabledFields.erase(it+1); continue; }
          }
          else // Si l'attribut 'enabled' n'est pas dÃ©fini ...
          {
-            if (!default_enabled)
-            { it--; this->enabledFields.erase(it+1); continue; }
+            if (!default_enabled) continue ;
+//            { it--; this->enabledFields.erase(it+1); continue; }
          }
 
          if (!(*it)->level.isEmpty()) // Si l'attribut 'level' est dÃ©fini ...
          {
-            if ((*it)->level.getValue() > _outputlevel)
-            { it--; this->enabledFields.erase(it+1); continue; }
+            if ((*it)->level.getValue() > _outputlevel) continue ;
+//            { it--; this->enabledFields.erase(it+1); continue; }
          }
          else // Si l'attribut 'level' n'est pas dÃ©fini ...
          {
-            if (default_level > _outputlevel)
-            { it--; this->enabledFields.erase(it+1); continue; }
-         }
-
+            if (default_level > _outputlevel) continue ;
+//            { it--; this->enabledFields.erase(it+1); continue; }
+         }
+ 
+//         CField* field_tmp=(*it).get() ;
+//         shared_ptr<CField> sptfield=*it ;
+//         field_tmp->refObject.push_back(sptfield) ;
+         newEnabledFields.push_back(*it) ;
          // Le champ est finalement actif, on y ajoute sa propre reference.
          (*it)->refObject.push_back(*it);
          // Le champ est finalement actif, on y ajoute la rÃ©fÃ©rence au champ de base.
-         std::cout<<"    Field Enabled : "<<(*it)->getId()<<std::endl ;
          (*it)->setRelFile(CObjectFactory::GetObject(this));
          (*it)->baseRefObject->refObject.push_back(*it);
          // A faire, ajouter les references intermediaires...
       }
+      enabledFields=newEnabledFields ;
 
       return (this->enabledFields);
@@ -108,37 +118,74 @@
    //----------------------------------------------------------------
 
-   void CFile::setVirtualFieldGroup(const StdString & newVFieldGroupId)
+   void CFile::setVirtualFieldGroup(void)
    {
       this->setVirtualFieldGroup
-         (CObjectFactory::CreateObject<CFieldGroup>(/*newVFieldGroupId*/));
-   }
-
-   //----------------------------------------------------------------
-
-   void CFile::initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout)
-   {
-      this->data_out = dout;
-      this->data_out->writeFile(CObjectFactory::GetObject<CFile>(this));
-      
+         (CObjectFactory::CreateObject<CFieldGroup>());
+   }
+
+   //----------------------------------------------------------------
+
+   void CFile::createHeader(void)
+   {
+    
       std::vector<boost::shared_ptr<CField> >::iterator it, end = this->enabledFields.end();
 
+      AllDomainEmpty=true ;
       for (it = this->enabledFields.begin() ;it != end; it++)
       {
          boost::shared_ptr<CField> field = *it;
-         this->data_out->writeFieldGrid(field);
+         AllDomainEmpty&=field->grid->domain->isEmpty() ;
       }
-         
-      for (it = this->enabledFields.begin() ;it != end; it++)
+      
+      if (!AllDomainEmpty ||  type.getValue()=="one_file")
       {
-         boost::shared_ptr<CField> field = *it;
-         this->data_out->writeField(field);
+         StdString filename = (!name.isEmpty()) ?   name.getValue() : getId();
+         StdOStringStream oss;
+//         if (! output_dir.isEmpty()) oss << output_dir.getValue();
+         oss << filename;
+         if (!name_suffix.isEmpty()) oss << name_suffix.getValue();
+
+         bool multifile=true ;
+         if (!type.isEmpty())
+         {
+           if (type.getValue()=="one_file") multifile=false ;
+           else if (type.getValue()=="multi_file") multifile=true ;
+           else ERROR("void Context::createDataOutput(void)",
+                      "incorrect file <type> attribut : must be <multi_file> or <one_file>, "
+                      <<"having : <"<<type.getValue()<<">") ;
+         } 
+         
+         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+         CContextServer* server=context->server ;
+
+         if (multifile) 
+         {
+            if (server->intraCommSize > 1) oss << "_" << server->intraCommRank;
+         }
+         oss << ".nc";
+
+         data_out=shared_ptr<io::CDataOutput>(new io::CNc4DataOutput(oss.str(), false,server->intraComm,multifile));
+
+         data_out->writeFile(CObjectFactory::GetObject<CFile>(this));
+         for (it = this->enabledFields.begin() ;it != end; it++)
+         {
+            boost::shared_ptr<CField> field = *it;
+            this->data_out->writeFieldGrid(field);
+         }
+         
+         for (it = this->enabledFields.begin() ;it != end; it++)
+         {
+            boost::shared_ptr<CField> field = *it;
+            this->data_out->writeField(field);
+         }
+         
+         this->data_out->definition_end();
       }
-         
-      this->data_out->definition_end();
    }
 
    void CFile::close(void)
    {
-     this->data_out->closeFile();
+     if (!AllDomainEmpty ||  type.getValue()=="one_file")
+       this->data_out->closeFile();
    }
    //----------------------------------------------------------------
@@ -150,5 +197,5 @@
       { // Si la dÃ©finition du fichier intÃ©gre des champs et si le fichier est identifiÃ©.
          node.goToParentElement();
-         this->setVirtualFieldGroup(this->getId());
+//         this->setVirtualFieldGroup(this->getId());
          this->getVirtualFieldGroup()->parse(node, false);
       }
@@ -234,9 +281,125 @@
                << "[ renum = " << renum << "] Bad type !");
       
-      this->setVirtualFieldGroup(this->getId());
+//      this->setVirtualFieldGroup(this->getId());
       if (hasVFG)this->getVirtualFieldGroup()->fromBinary(is);
       
    }
-
+   
+   shared_ptr<CField> CFile::addField(const string& id)
+   {
+     return vFieldGroup->createChild(id) ;
+   }
+
+   shared_ptr<CFieldGroup> CFile::addFieldGroup(const string& id)
+   {
+     return vFieldGroup->createChildGroup(id) ;
+   }
+   
+  
+   void CFile::sendAddField(const string& id)
+   {
+    shared_ptr<CContext> context=CContext::current() ;
+    
+    if (! context->hasServer )
+    {
+       CContextClient* client=context->client ;
+
+       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD) ;   
+       if (client->isServerLeader())
+       {
+         CMessage msg ;
+         msg<<this->getId() ;
+         msg<<id ;
+         event.push(client->getServerLeader(),1,msg) ;
+         client->sendEvent(event) ;
+       }
+       else client->sendEvent(event) ;
+    }
+      
+   }
+   
+   void CFile::sendAddFieldGroup(const string& id)
+   {
+    shared_ptr<CContext> context=CContext::current() ;
+    if (! context->hasServer )
+    {
+       CContextClient* client=context->client ;
+
+       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD_GROUP) ;   
+       if (client->isServerLeader())
+       {
+         CMessage msg ;
+         msg<<this->getId() ;
+         msg<<id ;
+         event.push(client->getServerLeader(),1,msg) ;
+         client->sendEvent(event) ;
+       }
+       else client->sendEvent(event) ;
+    }
+      
+   }
+   
+   void CFile::recvAddField(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      get(id)->recvAddField(*buffer) ;
+   }
+   
+   
+   void CFile::recvAddField(CBufferIn& buffer)
+   {
+      string id ;
+      buffer>>id ;
+      addField(id) ;
+   }
+
+   void CFile::recvAddFieldGroup(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id;
+      *buffer>>id ;
+      get(id)->recvAddFieldGroup(*buffer) ;
+   }
+   
+   
+   void CFile::recvAddFieldGroup(CBufferIn& buffer)
+   {
+      string id ;
+      buffer>>id ;
+      addFieldGroup(id) ;
+   }
+   
+
+   bool CFile::dispatchEvent(CEventServer& event)
+   {
+      if (SuperClass::dispatchEvent(event)) return true ;
+      else
+      {
+        switch(event.type)
+        {
+           case EVENT_ID_ADD_FIELD :
+             recvAddField(event) ;
+             return true ;
+             break ;
+         
+           case EVENT_ID_ADD_FIELD_GROUP :
+             recvAddFieldGroup(event) ;
+             return true ;
+             break ;       
+         
+           default :
+              ERROR("bool CFile::dispatchEvent(CEventServer& event)", <<"Unknown Event") ;
+           return false ;
+        }
+      }
+   }
+   
+   
+   
+   
    ///---------------------------------------------------------------
 
Index: /XMLIO_V2/dev/common/src/node/file.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/file.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/file.hpp	(revision 300)
@@ -5,7 +5,8 @@
 #include "xmlioserver_spl.hpp"
 #include "field.hpp"
+#include "data_output.hpp"
 #include "declare_group.hpp"
 
-#include "data_output.hpp"
+
 
 namespace xmlioserver {
@@ -34,7 +35,11 @@
          typedef CObjectTemplate<CFile>   SuperClass;
          typedef CFileAttributes SuperClassAttribute;
-
+      
       public :
-
+         enum EEventId
+         {
+           EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP
+         } ;
+         
          typedef CFileAttributes RelAttributes;
          typedef CFileGroup      RelGroup;
@@ -60,7 +65,7 @@
          /// Mutateurs ///
          void setVirtualFieldGroup(boost::shared_ptr<CFieldGroup> newVFieldGroup);
-         void setVirtualFieldGroup(const StdString & newVFieldGroupId);
+         void setVirtualFieldGroup(void);
 
-         void initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout);
+         void createHeader(void);
          void close(void) ;
          
@@ -86,4 +91,15 @@
          
          static ENodeType GetType(void);
+         
+         bool AllDomainEmpty ;
+         shared_ptr<CField> addField(const string& id="") ;
+         shared_ptr<CFieldGroup> addFieldGroup(const string& id="") ;
+         void sendAddField(const string& id="") ;
+         void sendAddFieldGroup(const string& id="") ;
+         static void recvAddField(CEventServer& event) ;
+         void recvAddField(CBufferIn& buffer) ;
+         static void recvAddFieldGroup(CEventServer& event) ;
+         void recvAddFieldGroup(CBufferIn& buffer) ;
+         static bool dispatchEvent(CEventServer& event) ;
 
       private :
Index: /XMLIO_V2/dev/common/src/node/grid.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/grid.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/grid.cpp	(revision 300)
@@ -160,7 +160,10 @@
    {
       if (this->isChecked) return;
+      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+      CContextClient* client=context->client ;
+      
       this->solveDomainRef() ;
       this->solveAxisRef() ;
-      if (this->storeIndex.size() == 1)
+      if (context->hasClient)
       {
          
@@ -176,5 +179,5 @@
          this->out_l_index.push_front(out_l_index_);
       }
-      this->computeIndexServer();
+//      this->computeIndexServer();
       this->isChecked = true;
    }
@@ -225,7 +228,4 @@
                 size = (this->hasAxis()) ? axis->size.getValue() : 1 ;
 
-      /*std::cout << ni   << " : "
-                  << nj   << " : "
-                  << size << std::endl;*/
 
       const int data_dim     = domain->data_dim.getValue() ,
@@ -238,7 +238,4 @@
                     data_j_index = domain->data_j_index.getValue() ;
 
-      /*std::cout << data_n_index  << " : "
-                  << data_i_index  << " : "
-                  << data_j_index  << std::endl; */
 
       ARRAY(bool, 2) mask = domain->mask.getValue() ;
@@ -265,5 +262,4 @@
       }
       
-      //std::cout << indexCount  << std::endl;
       ARRAY_ASSIGN(this->storeIndex[0] , int, 1, [indexCount]);
       ARRAY_ASSIGN(this->out_l_index[0], int, 1, [indexCount]);
@@ -271,9 +267,9 @@
       ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]);
       
-      // for(int count = 0, indexCount = 0,  l = 0; l < size; l++)
-      // for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++)
-
-      //for(int n = 0, i = 0, j = 0, count = 0, indexCount = 0; n < data_n_index;  n++)
-      //for(int l = 0; l < size; l++, count++)
+      ARRAY_ASSIGN(storeIndex_client,int,1,[indexCount]);
+      ARRAY_ASSIGN(out_i_client,int,1,[indexCount]);
+      ARRAY_ASSIGN(out_j_client,int,1,[indexCount]);
+      ARRAY_ASSIGN(out_l_client,int,1,[indexCount]);
+      
       
       for(int count = 0, indexCount = 0,  l = 0; l < size; l++)
@@ -296,25 +292,16 @@
                (*this->out_i_index[0])[indexCount] = i ;
                (*this->out_j_index[0])[indexCount] = j ;
+               
+               (*storeIndex_client)[indexCount] = count ;
+               (*out_i_client)[indexCount]=i+domain->ibegin_client-1 ;
+               (*out_j_client)[indexCount]=j+domain->jbegin_client-1 ;
+               (*out_l_client)[indexCount]=l ;
                indexCount++ ;
             }
          }
       }
-
-
-//      if (this->storeIndex[0]->size() != 0)
-//         for (StdSize u = 0; u < this->storeIndex[0]->size(); u++)
-//            (*local_mask)[(*out_i_index[0])[u]][(*out_j_index[0])[u]] = 1;
-                                 
-//      std::cout << "indexCount" << indexCount << std::endl; 
-//      std::cout << this->getId() << " : "  << (*this->storeIndex[0]).num_elements() << std::endl;
-//      StdOFStream ofs2(("log_client_"+this->getId()).c_str());
-//      for (StdSize h = 0; h < storeIndex[0]->size(); h++)
-//      {
-//        ofs2 << "(" << (*storeIndex[0])[h]  << ";"
-//             << (*out_i_index[0])[h] << ","
-//             << (*out_j_index[0])[h] << ","
-//             << (*out_l_index[0])[h] << ")" << std::endl;
-//      }
-//      ofs2.close();   
+      sendIndex() ;
+
+
    }
 
@@ -345,54 +332,43 @@
    //----------------------------------------------------------------
 
-   template <>
-      void CGrid::outputField
-         (const ARRAY(double, 1) stored,  ARRAY(double, 3) field) const
-   {
-      //std::cout <<"champ : " ;
-      for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++)
-      {
-         (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ;
-         /*if (storeIndex[0]->num_elements() == 31)
-         {
-            std::cout << "( " << (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] << ", "
-                      << (*out_i_index[0])[n] << ", "
-                      << (*out_j_index[0])[n] << ", "
-                      << (*out_l_index[0])[n] << ")";
-         }*/
-      }
-      //std::cout << std::endl;
-
-   }
-
-   //---------------------------------------------------------------
-
-   template <>
-      void CGrid::outputField
-         (const ARRAY(double, 1) stored,  ARRAY(double, 2) field) const
-   {
-      for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++)
-         (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]] = (*stored)[n] ;
-   }
-
-   //---------------------------------------------------------------
-
-   template <>
-      void CGrid::outputField
-         (const ARRAY(double, 1) stored,  ARRAY(double, 1) field) const
-   {
-      for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++)
-         (*field)[(*out_i_index[0])[n]] = (*stored)[n] ;
+   void CGrid::outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 3) field) 
+   {
+      ARRAY(int,1) out_i=out_i_fromClient[rank] ;
+      ARRAY(int,1) out_j=out_j_fromClient[rank] ;
+      ARRAY(int,1) out_l=out_l_fromClient[rank] ;
+      
+      for(StdSize n = 0; n < stored->num_elements(); n++)
+         (*field)[(*out_i)[n]][(*out_j)[n]][(*out_l)[n]] = (*stored)[n] ;
+   }
+
+   void CGrid::outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 2) field) 
+   {
+      ARRAY(int,1) out_i=out_i_fromClient[rank] ;
+      ARRAY(int,1) out_j=out_j_fromClient[rank] ;
+
+       for(StdSize n = 0; n < stored->num_elements(); n++)
+         (*field)[(*out_i)[n]][(*out_j)[n]] = (*stored)[n] ;
+   }
+
+   //---------------------------------------------------------------
+
+   void CGrid::outputField(int rank,const ARRAY(double, 1) stored,  ARRAY(double, 1) field)
+   {
+      ARRAY(int,1) out_i = out_i_fromClient[rank] ;
+      for(StdSize n = 0; n < stored->num_elements(); n++)
+         (*field)[(*out_i)[n]] = (*stored)[n] ;
    }
 
    //----------------------------------------------------------------
+  
 
    void CGrid::storeField_arr
       (const double * const data, ARRAY(double, 1) stored) const
    {
-      const StdSize size = (this->storeIndex[0])->num_elements() ;
-//    std::cout << this->getId() << "> size : " << size << std::endl;
+      const StdSize size = (this->storeIndex_client)->num_elements() ;
+
       stored->resize(boost::extents[size]) ;
       for(StdSize i = 0; i < size; i++)
-         (*stored)[i] = data[(*storeIndex[0])[i]] ;
+         (*stored)[i] = data[(*storeIndex_client)[i]] ;
    }
    
@@ -442,5 +418,120 @@
    
    //---------------------------------------------------------------
-   
+  void CGrid::sendIndex(void)
+  {
+    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+    CContextClient* client=context->client ;
+    
+    CEventClient event(getType(),EVENT_ID_INDEX) ;
+    int rank ;
+    list<shared_ptr<CMessage> > list_msg ;
+    list<ARRAY(int,1) > list_out_i,list_out_j,list_out_l ;
+     
+    for(int ns=0;ns<domain->connectedServer.size();ns++)
+    {
+       rank=domain->connectedServer[ns] ;
+       int ib=domain->ib_srv[ns] ;
+       int ie=domain->ie_srv[ns] ;
+       int jb=domain->jb_srv[ns] ;
+       int je=domain->je_srv[ns] ;
+       
+       int i,j ;
+       int nb=0 ;
+       for(int k=0;k<storeIndex_client->num_elements();k++)
+       {
+         i=(*out_i_client)[k] ;
+         j=(*out_j_client)[k] ;
+         if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1) nb++ ; 
+       }
+       
+       ARRAY_CREATE(storeIndex,int,1,[nb]) ;
+       ARRAY_CREATE(out_i,int,1,[nb]) ;
+       ARRAY_CREATE(out_j,int,1,[nb]) ;
+       ARRAY_CREATE(out_l,int,1,[nb]) ;
+       
+       nb=0 ;
+       for(int k=0;k<storeIndex_client->num_elements();k++)
+       {
+         i=(*out_i_client)[k] ;
+         j=(*out_j_client)[k] ;
+         if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1) 
+         {
+            (*storeIndex)[nb]=k ;
+            (*out_i)[nb]=(*out_i_client)[k] ;
+            (*out_j)[nb]=(*out_j_client)[k] ;
+            (*out_l)[nb]=(*out_l_client)[k] ;
+            nb++ ;
+         }
+       }
+       
+       storeIndex_toSrv.insert(pair<int,ARRAY(int,1) >(rank,storeIndex)) ;
+       nbSenders.insert(pair<int,int>(rank,domain->nbSenders[ns])) ;
+       list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ;
+       list_out_i.push_back(out_i) ;
+       list_out_j.push_back(out_j) ;
+       list_out_l.push_back(out_l) ;
+
+       *list_msg.back()<<getId()<<list_out_i.back()<<list_out_j.back()<<list_out_l.back() ;
+       event.push(rank,domain->nbSenders[ns],*list_msg.back()) ;
+    }
+    client->sendEvent(event) ;
+  }
+  
+  void CGrid::recvIndex(CEventServer& event)
+  {
+    list<CEventServer::SSubEvent>::iterator it ;
+    for (it=event.subEvents.begin();it!=event.subEvents.end();++it)
+    {
+      int rank=it->rank;
+      CBufferIn* buffer=it->buffer;
+      string domainId ;
+      *buffer>>domainId ;
+      get(domainId)->recvIndex(rank,*buffer) ;
+    }
+  }
+  
+  void CGrid::recvIndex(int rank, CBufferIn& buffer)
+  {
+    ARRAY_CREATE(out_i,int,1,[0]) ;
+    ARRAY_CREATE(out_j,int,1,[0]) ;
+    ARRAY_CREATE(out_l,int,1,[0]) ;
+    
+    buffer>>out_i>>out_j>>out_l ;
+    int offset ;
+    
+    offset=domain->zoom_ibegin_srv-1 ;
+    for(int k=0;k<out_i->num_elements();k++) (*out_i)[k]=(*out_i)[k]-offset ;
+    
+    offset=domain->zoom_jbegin_srv-1 ;
+    for(int k=0;k<out_i->num_elements();k++) (*out_j)[k]=(*out_j)[k]-offset ;
+    
+    out_i_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_i)) ;
+    out_j_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_j)) ;
+    out_l_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_l)) ;
+  }
+
+  bool CGrid::dispatchEvent(CEventServer& event)
+  {
+     
+    if (SuperClass::dispatchEvent(event)) return true ;
+    else
+    {
+      switch(event.type)
+      {
+        case EVENT_ID_INDEX :
+          recvIndex(event) ;
+          return true ;
+          break ;
+ 
+        default :
+          ERROR("bool CDomain::dispatchEvent(CEventServer& event)",
+                <<"Unknown Event") ;
+          return false ;
+      }
+    }
+  }
+
+
+
    void CGrid::computeIndexServer(void)
    {
@@ -468,5 +559,4 @@
       const int  jend_zoom_srv = jbegin_zoom_srv + zoom_nj_srv-1 ;
         
-//      std::cout<<"----> computeIndexServer !!"<<std::endl ;
       StdSize dn = 0;      
       for (StdSize j = 1; j < this->out_i_index.size(); j++)
@@ -503,11 +593,4 @@
          }
          
-//         std::cout<<"--> client No "<<i<<std::endl ;
-//         std::cout<<" ibegin "<<ibegin[i]<<" iend "<<iend[i]<<" jbegin "<<jbegin[i]<<" jend "<<jend[i]<<std::endl ;
-//         std::cout<<"zoom cl : ibegin "<<ibegin_zoom_cl<<" iend "<<iend_zoom_cl<<" jbegin "<<jbegin_zoom_cl<<" jend "<<jend_zoom_cl<<std::endl ;
-//         std::cout<<"--> server "<<std::endl ;
-//         std::cout<<" ibegin "<<ibegin_srv<<" iend "<<iend_srv<<" jbegin "<<jbegin_srv<<" jend "<<jend_srv<<std::endl ;
-//        std::cout<<"zoom : ibegin "<<ibegin_zoom_srv<<" iend "<<iend_zoom_srv<< " ni "<<zoom_ni_srv<<" jbegin "<<jbegin_zoom_srv<<" jend "<<jend_zoom_srv<<" nj "<<zoom_nj_srv<<std::endl ;
-//         std::cout<<"zoom_size "<<ibegin_zoom.size()<<std::endl ;
 
          if (comm::CMPIManager::IsClient())
@@ -517,9 +600,4 @@
               (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur.
 
-//            (*out_i_index_srv)[n] = (*out_i_index_cl)[m] 
-//                                  /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1);
-//            (*out_j_index_srv)[n] = (*out_j_index_cl)[m]
-//                                  /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1);
-//            (*out_l_index_srv)[n] = (*out_l_index_cl)[m];
               (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1 - (ibegin_srv + ibegin_zoom_srv - 1) + 1 ;
               (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1 - (jbegin_srv + jbegin_zoom_srv - 1) + 1 ;
@@ -542,7 +620,4 @@
                   
          dn += storeIndex_cl->size(); 
-//         std::cout<<"storeIndex_cl->size() "<<storeIndex_cl->size()<<std::endl;               
-      
-//         std::cout<<"storeIndex_srv->size() "<<storeIndex_srv->size()<<std::endl;               
       }
       
@@ -558,12 +633,4 @@
             *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end());
                
-//                std::cout<< "[ grille = "      << this->getId()
-//                         << ", ibegin_t = "    << ibegin_t
-//                         << ", jbegin_t = "    << jbegin_t
-//                         << ", iend_t = "      << iend_t
-//                         << ", jend_t = "      << jend_t
-//                         << ", zoom_ni_srv = " << zoom_ni_srv
-//                         << ", zoom_nj_srv = " << zoom_nj_srv
-//                         << ", nb subdomain = "   << out_i_index.size()-1<<std::endl   ;  
                                  
          if ((ibegin_t < 0) || (jbegin_t < 0) ||
@@ -623,4 +690,12 @@
    }
 
+   void CGrid::outputFieldToServer(ARRAY(double, 1) fieldIn, int rank, ARRAY(double, 1) fieldOut)
+   {
+     ARRAY(int,1) index=storeIndex_toSrv[rank] ;
+     int nb=index->num_elements() ;
+     fieldOut->resize(extents[nb]) ;
+     
+     for(int k=0;k<nb;k++) (*fieldOut)[k]=(*fieldIn)[(*index)[k]] ;
+    }
    ///---------------------------------------------------------------
 
Index: /XMLIO_V2/dev/common/src/node/grid.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/grid.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/grid.hpp	(revision 300)
@@ -41,4 +41,9 @@
          typedef CGridGroup      RelGroup;
 
+         enum EEventId
+         {
+           EVENT_ID_INDEX
+         } ;
+         
          /// Constructeurs ///
          CGrid(void);
@@ -81,8 +86,12 @@
          void inputFieldServer(const std::deque<ARRAY(double, 1)> storedClient,
                                                 ARRAY(double, 1)  storedServer) const;
-
+/*
          template <StdSize n>
             void outputField(const ARRAY(double, 1) stored,  ARRAY(double, n) field) const;
-
+*/
+         void outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 3) field)  ;
+         void outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 2) field)  ;
+         void outputField(int rank,const ARRAY(double, 1) stored,  ARRAY(double, 1) field)  ; 
+   
          /// Destructeur ///
          virtual ~CGrid(void);
@@ -102,5 +111,5 @@
             CreateGrid(boost::shared_ptr<CDomain> domain, boost::shared_ptr<CAxis> axis);
 
-      protected :
+      public :
 
          /// EntrÃ©es-sorties de champs (interne) ///
@@ -113,4 +122,10 @@
          void solveAxisRef(void);
 
+         static bool dispatchEvent(CEventServer& event) ;
+         void outputFieldToServer(ARRAY(double, 1) fieldIn, int rank, ARRAY(double, 1) fieldOut) ;
+         static void recvIndex(CEventServer& event) ;
+         void recvIndex(int rank, CBufferIn& buffer) ;
+         void sendIndex(void) ;
+         
       public:
 
@@ -126,5 +141,19 @@
          std::deque<ARRAY(int, 1)> out_j_index ;
          std::deque<ARRAY(int, 1)> out_l_index ;
-
+         ARRAY(int, 1) storeIndex_client ;
+         ARRAY(int, 1) out_i_client ;
+         ARRAY(int, 1) out_j_client ;
+         ARRAY(int, 1) out_l_client ;
+         
+         map<int,ARRAY(int, 1)>  storeIndex_toSrv ;
+         map<int,int> nbSenders ;
+//         std::deque<ARRAY(int, 1)> out_i_toSrv ;
+//         std::deque<ARRAY(int, 1)> out_j_toSrv ;
+//         std::deque<ARRAY(int, 1)> out_l_toSrv ;
+         
+         map<int,ARRAY(int, 1)> out_i_fromClient ;
+         map<int,ARRAY(int, 1)> out_j_fromClient ;
+         map<int,ARRAY(int, 1)> out_l_fromClient ;
+         
    }; // class CGrid
 
Index: /XMLIO_V2/dev/common/src/node/node_enum.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/node_enum.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/node_enum.hpp	(revision 300)
@@ -2,6 +2,6 @@
 #define __XMLIO_NODE_ENUM__
 
-#define DECLARE_NODE(Name_, name_)     ,e##Name_, g##Name_
-#define DECLARE_NODE_PAR(Name_, name_) ,e##Name_, g##Name_
+//#define DECLARE_NODE(Name_, name_)     ,e##Name_, g##Name_
+//#define DECLARE_NODE_PAR(Name_, name_) ,e##Name_, g##Name_
 
 namespace xmlioserver
@@ -12,7 +12,14 @@
       typedef enum _node_type
       {
-         Unknown = 0
+         Unknown = 0,
+         eAxis,gAxis,
+         eDomain,gDomain,
+         eField,gField,
+         eFile,gFile,
+         eGrid,gGrid,
+         eVariable,gVariable,
+         eContext,gContext
 
-#include "node_type.conf"
+//#include "node_type.conf"
 
       } ENodeType;
Index: /XMLIO_V2/dev/common/src/node/variable.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/node/variable.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/node/variable.cpp	(revision 300)
@@ -102,5 +102,4 @@
            subdata   = content.substr ( begindata, enddata-begindata);
 
-           //std::cout << "\"" << subid << "\":\"" << subdata << "\"" << std::endl;
            CGroupFactory::CreateChild(group_ptr, subid)->content = subdata;
         }
Index: /XMLIO_V2/dev/common/src/object_factory_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/object_factory_impl.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/object_factory_impl.hpp	(revision 300)
@@ -86,5 +86,5 @@
                << "[ id = " << id << ", U = " << U::GetName() <<", context = "<<context<< " ] "
                << " object is not referenced !");
-      return (U::AllMapObj[CObjectFactory::CurrContext][id]);
+      return (U::AllMapObj[context][id]);
    }
 
Index: /XMLIO_V2/dev/common/src/object_template.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/object_template.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/object_template.hpp	(revision 300)
@@ -6,4 +6,7 @@
 #include "attribute_map.hpp"
 #include "node_enum.hpp"
+#include "buffer_in.hpp"
+#include "event_server.hpp"
+#include "attribute.hpp"
 
 namespace xmlioserver
@@ -23,4 +26,9 @@
          typedef CObject SuperClass;
          typedef T DerivedType;
+         
+         enum EEventId
+         {
+           EVENT_ID_SEND_ATTRIBUTE=100
+         } ;
 
       public :
@@ -46,4 +54,8 @@
          /// Traitement statique ///
          static void ClearAllAttributes(void);
+         void sendAttributToServer(const string& id);
+         void sendAttributToServer(tree::CAttribute& attr) ;
+         static void recvAttributFromClient(CEventServer& event) ;
+         static bool dispatchEvent(CEventServer& event) ;
 
          /// Accesseur statique ///
@@ -53,5 +65,10 @@
          /// Destructeur ///
          virtual ~CObjectTemplate(void);
-
+         
+         static bool has(const string& id) ;
+         static boost::shared_ptr<T> get(const string& id) ;
+         boost::shared_ptr<T> get(void) ;
+         static boost::shared_ptr<T> create(const string& id=string("")) ;
+         
       protected :
 
@@ -77,3 +94,5 @@
 } // namespace xmlioserver
 
+//#include "object_template_impl.hpp"
+
 #endif // __XMLIO_CObjectTemplate__
Index: /XMLIO_V2/dev/common/src/object_template_impl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/object_template_impl.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/object_template_impl.hpp	(revision 300)
@@ -1,4 +1,13 @@
 #ifndef __XMLIO_CObjectTemplate_impl__
 #define __XMLIO_CObjectTemplate_impl__
+
+#include "object_factory.hpp"
+#include "context.hpp"
+#include "transfert_parameters.hpp"
+#include "buffer_in.hpp"
+#include "attribute.hpp"
+#include "event_client.hpp"
+#include "context_client.hpp"
+#include "object_template.hpp"
 
 namespace xmlioserver
@@ -137,6 +146,98 @@
    }
 
-   ///--------------------------------------------------------------
-
+   template <class T>
+   void CObjectTemplate<T>::sendAttributToServer(const string& id)
+   {
+      CAttributeMap & attrMap = *this;
+      CAttribute* attr=attrMap[id] ;
+      sendAttributToServer(*attr) ;
+   }
+
+   template <class T>
+   void CObjectTemplate<T>::sendAttributToServer(tree::CAttribute& attr)
+   {
+     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+     
+    if (!context->hasServer)
+    {
+       CContextClient* client=context->client ;
+
+       CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ;   
+       if (client->isServerLeader())
+       {
+         CMessage msg ;
+         msg<<this->getId() ;
+         msg<<attr.getName() ;
+         msg<<attr ;
+         event.push(client->getServerLeader(),1,msg) ;
+         client->sendEvent(event) ;
+       }
+       else client->sendEvent(event) ;
+    }
+      
+   }
+   
+   template <class T>
+   void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event)
+   {
+      
+      CBufferIn* buffer=event.subEvents.begin()->buffer;
+      string id,attrId;
+      *buffer>>id ;
+      CAttributeMap & attrMap = *get(id);
+      *buffer>>attrId ;
+      CAttribute* attr=attrMap[attrId] ;
+      info(50)<<"attribut recu "<<attrId<<"  " ;
+      if (attr->isEmpty()) info(50)<<"--> empty"<<endl ;
+      else info(50) /*<attr->getValue()*/<<endl ;
+      *buffer>>*attr ;
+       info(50)<<"attribut recu "<<attrId<<"  " ;
+      if (attr->isEmpty()) info(50)<<"--> empty"<<endl ;
+      else info(50) /*attr->getValue()*/<<endl ;
+  }
+
+   template <class T>
+   bool CObjectTemplate<T>::dispatchEvent(CEventServer& event)
+   {
+      switch(event.type)
+      {
+         case EVENT_ID_SEND_ATTRIBUTE :
+           recvAttributFromClient(event) ;
+           return true ;
+           break ;
+       
+         default :
+         return false ;
+//           ERROR("void CObjectTemplate<T>::recvEvent(CEventServer& event)",
+//                 <<"Unknown Event") ;
+      }
+   }
+   
+   template <typename T>
+   bool CObjectTemplate<T>::has(const string & id)
+   {
+     return CObjectFactory::HasObject<T>(id) ;
+   }
+
+   template <typename T>
+   boost::shared_ptr<T> CObjectTemplate<T>::get(const string & id)
+   {
+     return CObjectFactory::GetObject<T>(id) ;
+   }
+
+   template <typename T>
+   boost::shared_ptr<T> CObjectTemplate<T>::create(const string & id)
+   {
+     return CObjectFactory::CreateObject<T>(id) ;
+   }   ///--------------------------------------------------------------
+
+  template <typename T>
+  boost::shared_ptr<T> CObjectTemplate<T>::get(void)
+  {
+    return CObjectFactory::GetObject<T>((T*)this) ;
+  }
+  
+
+  
 } // namespace xmlioserver
 
Index: /XMLIO_V2/dev/common/src/output/nc4_data_output.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/output/nc4_data_output.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/output/nc4_data_output.cpp	(revision 300)
@@ -10,4 +10,5 @@
 #include "xios_manager.hpp"
 #include "context.hpp"
+#include "context_server.hpp"
 
 namespace xmlioserver
@@ -58,8 +59,12 @@
       void CNc4DataOutput::writeDomain_(const boost::shared_ptr<tree::CDomain> domain)
       {
+         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+         CContextServer* server=context->server ;
+         
          if (domain->IsWritten(this->filename)) return;
          domain->checkAttributes();
          
-//         if (domain->isEmpty()) return;
+         if (domain->isEmpty()) 
+           if (SuperClass::type==MULTI_FILE) return ;
 
          std::vector<StdString> dim0, dim1;
@@ -68,16 +73,17 @@
          StdString lonid     = StdString("lon_").append(domid);
          StdString latid     = StdString("lat_").append(domid);
-         StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
+         StdString lonid_loc = (server->intraCommSize > 1)
                              ? StdString("lon_").append(domid).append("_local")
                              : lonid;
-         StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
+         StdString latid_loc = (server->intraCommSize > 1)
                              ? StdString("lat_").append(domid).append("_local")
                              : latid;
-         StdString maskid    = StdString("mask_").append(domid).append("_local");
-
-         ARRAY(int, 2) mask = domain->getLocalMask();
-
-         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();
-         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);
+// supress mask         StdString maskid    = StdString("mask_").append(domid).append("_local");
+
+// supress mask         ARRAY(int, 2) mask = domain->getLocalMask();
+
+//         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();
+//         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);
+         bool isCurvilinear = true ; //for moment
 
          switch (SuperClass::type)
@@ -85,7 +91,7 @@
             case (MULTI_FILE) :
             {
-               if (domain->isEmpty()) return;
+//               if (domain->isEmpty()) return;
                
-               if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
+               if (server->intraCommSize > 1)
                {
                  SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue());
@@ -105,12 +111,12 @@
                }
 
-               SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_loc.getValue());
-               SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_loc.getValue());
-               if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
-               {
-                  this->writeLocalAttributes(domain->zoom_ibegin_loc.getValue(),
-                                             domain->zoom_ni_loc.getValue(),
-                                             domain->zoom_jbegin_loc.getValue(),
-                                             domain->zoom_nj_loc.getValue(),
+               SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_srv);
+               SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_srv);
+               if (server->intraCommSize > 1)
+               {
+                  this->writeLocalAttributes(domain->zoom_ibegin_srv,
+                                             domain->zoom_ni_srv,
+                                             domain->zoom_jbegin_srv,
+                                             domain->zoom_nj_srv,
                                              domid);
                }
@@ -135,23 +141,23 @@
                dim0.push_back(lonid_loc);
 
-               if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
-               {
-                  SuperClassWriter::addVariable(maskid, NC_INT, dim0);
-
-                  this->writeMaskAttributes(maskid,
-                     domain->data_dim.getValue()/*,
-                     domain->data_ni.getValue(),
-                     domain->data_nj.getValue(),
-                     domain->data_ibegin.getValue(),
-                     domain->data_jbegin.getValue()*/);
-               }
+
+// supress mask               if (server->intraCommSize > 1)
+// supress mask               {
+// supress mask                  SuperClassWriter::addVariable(maskid, NC_INT, dim0);
+// supress mask
+// supress mask                  this->writeMaskAttributes(maskid,
+// supress mask                     domain->data_dim.getValue()/*,
+// supress mask                     domain->data_ni.getValue(),
+// supress mask                     domain->data_nj.getValue(),
+// supress mask                     domain->data_ibegin.getValue(),
+// supress mask                     domain->data_jbegin.getValue()*/);
+// supress mask               }
                   
                //SuperClassWriter::setDefaultValue(maskid, &dvm);
 
                SuperClassWriter::definition_end();
-               SuperClassWriter::writeData(domain->latvalue.getValue(), latid, true, 0);
-               SuperClassWriter::writeData(domain->lonvalue.getValue(), lonid, true, 0);
-               if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
-                  SuperClassWriter::writeData(mask, maskid);
+               SuperClassWriter::writeData(domain->latvalue_srv, latid, true, 0);
+               SuperClassWriter::writeData(domain->lonvalue_srv, lonid, true, 0);
+// supress mask               if (server->intraCommSize > 1) SuperClassWriter::writeData(mask, maskid);
                SuperClassWriter::definition_start();
 
@@ -195,10 +201,10 @@
                else
                {
-                 start[1]=domain->zoom_ibegin_loc.getValue()+domain->ibegin.getValue()-1-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_loc.getValue()+domain->jbegin.getValue()-1-domain->zoom_jbegin.getValue() ; 
-                 count[1]=domain->zoom_ni_loc.getValue() ; count[0]=domain->zoom_nj_loc.getValue() ; 
+                 start[1]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; 
+                 count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ; 
                }
                
-               SuperClassWriter::writeData(domain->latvalue.getValue(), latid, true, 0,&start,&count);
-               SuperClassWriter::writeData(domain->lonvalue.getValue(), lonid, true, 0,&start,&count);
+               SuperClassWriter::writeData(domain->latvalue_srv, latid, true, 0,&start,&count);
+               SuperClassWriter::writeData(domain->lonvalue_srv, lonid, true, 0,&start,&count);
                SuperClassWriter::definition_start();
 
@@ -265,9 +271,10 @@
       void CNc4DataOutput::writeField_(const boost::shared_ptr<tree::CField> field)
       {
+         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+         CContextServer* server=context->server ;
+
          std::vector<StdString> dims, coodinates;
-         boost::shared_ptr<CGrid> grid =
-            CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue());
-         boost::shared_ptr<CDomain> domain =
-            CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue());
+         boost::shared_ptr<CGrid> grid = field->grid;
+         boost::shared_ptr<CDomain> domain = grid->domain;
            
          if (domain->isEmpty()) 
@@ -279,8 +286,8 @@
          StdString lonid     = StdString("lon_").append(domid);
          StdString latid     = StdString("lat_").append(domid);
-         StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
+         StdString lonid_loc = (server->intraCommSize > 1)
                              ? StdString("lon_").append(domid).append("_local")
                              : lonid;
-         StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1)
+         StdString latid_loc = (server->intraCommSize > 1)
                              ? StdString("lat_").append(domid).append("_local")
                              : latid;
@@ -288,7 +295,8 @@
                              ? field->name.getValue() : field->getBaseFieldReference()->getId();
 
-         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();
-         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);
-
+//         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();
+//         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);
+          bool isCurvilinear = true ; // for moment 
+          
          nc_type type = (!field->prec.isEmpty() &&
                         ( field->prec.getValue() == 4))
@@ -309,8 +317,6 @@
          if (!grid->axis_ref.isEmpty())
          {
-            boost::shared_ptr<CAxis> axis =
-               CObjectFactory::GetObject<CAxis>(grid->axis_ref.getValue());
-            StdString axisid = (!axis->name.isEmpty())
-                             ? axis->name.getValue() : axis->getId();
+            boost::shared_ptr<CAxis> axis = grid->axis ;
+            StdString axisid = (!axis->name.isEmpty()) ? axis->name.getValue() : axis->getId();
             dims.push_back(axisid);
             coodinates.push_back(axisid);
@@ -425,5 +431,4 @@
       void CNc4DataOutput::closeFile_ (void)
       {
-         std::cout<<"--> Close file "<<filename<<std::endl ;
          SuperClassWriter::close() ;
       }
@@ -449,18 +454,15 @@
       void CNc4DataOutput::writeFieldData_ (const boost::shared_ptr<tree::CField>  field)
       {
-         boost::shared_ptr<CGrid> grid =
-            CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue());
-         boost::shared_ptr<CDomain> domain =
-            CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue());
+         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;
+
+         boost::shared_ptr<CGrid> grid = field->grid ;
+         boost::shared_ptr<CDomain> domain = grid->domain ;
          
          if(SuperClass::type==MULTI_FILE) if (domain->isEmpty()) return;
 
 
-         StdString fieldid   = (!field->name.isEmpty())
+         StdString fieldid   = (!field->name.isEmpty()) 
                              ? field->name.getValue() 
                              : field->getBaseFieldReference()->getId();
-         boost::shared_ptr<xmlioserver::tree::CContext> context =
-            CObjectFactory::GetObject<xmlioserver::tree::CContext>
-               (CObjectFactory::GetCurrentContextId());
                              
          StdOStringStream oss;
@@ -468,13 +470,13 @@
              << "_" << field->getRelFile()->output_freq.getValue();
              
-         ARRAY(double, 1) field_data = field->getData();
+ //        ARRAY(double, 1) field_data = field->data_srv;
          ARRAY_CREATE(time_data, double, 1, [1]);
-         (*time_data)[0] = date::Time(*field->getLastWriteDate());
+         (*time_data)[0] = date::Time(*field->last_Write_srv);
          
          if (grid->hasAxis()) // 3D
          {
-            boost::shared_ptr<CAxis> axis = CObjectFactory::GetObject<CAxis>(grid->axis_ref.getValue());
-            ARRAY(double, 3) field_data3D (new CArray<double,3>(grid->getLocalShape()/*, boost::c_storage_order()*/));            
-            grid->outputField(field_data, field_data3D);
+            boost::shared_ptr<CAxis> axis = grid->axis ;
+            ARRAY_CREATE(field_data3D,double,3,[domain->zoom_ni_srv][domain->zoom_nj_srv][axis->size.getValue()]) ;
+            field->outputField(field_data3D);
             switch (SuperClass::type)
            {
@@ -497,6 +499,6 @@
                  {
 //                 start[2]=domain->zoom_ibegin_loc.getValue()-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_loc.getValue()-domain->zoom_jbegin.getValue() ; start[0]=0 ;
-                   start[2]=domain->zoom_ibegin_loc.getValue()+domain->ibegin.getValue()-1-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_loc.getValue()+domain->jbegin.getValue()-1-domain->zoom_jbegin.getValue() ; start[0]=0 ; 
-                   count[2]=domain->zoom_ni_loc.getValue() ; count[1]=domain->zoom_nj_loc.getValue() ; count[0] = axis->size.getValue();
+                   start[2]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; start[0]=0 ;
+                   count[2]=domain->zoom_ni_srv ; count[1]=domain->zoom_nj_srv ; count[0] = axis->size.getValue();
                  }
                  SuperClassWriter::writeData(field_data3D, fieldid, true, field->getNStep()-1,&start,&count );
@@ -509,6 +511,6 @@
          else // 2D
          {
-            ARRAY(double, 2) field_data2D (new CArray<double, 2>(grid->getLocalShape()/*, boost::c_storage_order()*/));
-            grid->outputField(field_data,  field_data2D);
+            ARRAY_CREATE(field_data2D,double,2,[domain->zoom_ni_srv][domain->zoom_nj_srv]) ;
+            field->outputField(field_data2D);
             switch (SuperClass::type)
             {
@@ -530,7 +532,8 @@
                  else
                  {
-                   start[1]=domain->zoom_ibegin_loc.getValue()+domain->ibegin.getValue()-1-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_loc.getValue()+domain->jbegin.getValue()-1-domain->zoom_jbegin.getValue() ; 
-                   count[1]=domain->zoom_ni_loc.getValue() ; count[0]=domain->zoom_nj_loc.getValue() ; 
+                   start[1]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start[0]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; 
+                   count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ;
                  }
+
                  SuperClassWriter::writeData(field_data2D, fieldid, true, field->getNStep()-1,&start,&count);
                  SuperClassWriter::writeData(time_data, oss.str(), true, field->getNStep()-1);
Index: /XMLIO_V2/dev/common/src/output/onetcdf4.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/output/onetcdf4.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/output/onetcdf4.cpp	(revision 300)
@@ -255,5 +255,4 @@
             dimids.push_back(this->getDimension(dimid));
          }
-         std::cout<<"--> Var "<<name.c_str()<<std::endl ;
          CheckError(nc_def_var (grpid, name.c_str(), type, dimids.size(), &(dimids[0]), &retvalue));
          return (retvalue);
@@ -346,11 +345,4 @@
          }
          
-//         if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0)
-//         {
-//            if (array_size==0) scount[0]=0 ;
-//         }         
-//         for (StdSize u = 0; u < sstart.size(); u++)
-//            std::cout << "(" << sstart[u] << "," << scount[u]  << ")" ;
-//         std::cout << std::endl;
       }
 
Index: /XMLIO_V2/dev/common/src/server.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/server.cpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/server.cpp	(revision 300)
@@ -5,4 +5,5 @@
 #include "duration.hpp"
 #include "data_treatment.hpp"
+#include "group_template.hpp"
 #include "group_template_impl.hpp"
 
@@ -62,7 +63,4 @@
             if (((managerId_ != managerId) || (methodId_ != methodId) || (nbargs_ != nbargs)) && (i != 0 ))
             {
-               //std::cout << managerId_ << "<->" << managerId << std::endl
-               //          << methodId_  << "<->" << methodId  << std::endl
-               //          << nbargs_    << "<->" << nbargs    << std::endl;
                ERROR("CServer::run(void)", << "[" << i << "] Les requÃªtes ne sont pas synchronisÃ©es !");
             }
@@ -77,9 +75,7 @@
             {
                case (0) :
-//                  std::cout<<"--> Request initialize()"<<std::endl ;
                   this->initialize();
                   continue;
                case (1) :
-//                  std::cout<<"--> Request finalize()"<<std::endl ;
                   this->finalize();
                   return;
@@ -97,13 +93,10 @@
             {
                case (0) :
-//                  std::cout<<"--> Request setContext()"<<std::endl ;
                   this->setContext(lbuffer);
                   continue;
                case (1) :
-//                  std::cout<<"--> Request updateCalendar()"<<std::endl ;
                   this->updateCalendar(lbuffer);
                   continue;
                case (2) :
-//                  std::cout<<"--> Request setTimestep()"<<std::endl ;
                   this->setTimestep(lbuffer);
                   continue;
@@ -121,9 +114,7 @@
             {
                case (0) :
-//                  std::cout<<"--> Request writeData()"<<std::endl ;
                   this->writeData(lbuffer, 4);
                   continue;
                case (1) :
-//                  std::cout<<"--> Request writeData()"<<std::endl ;
                   this->writeData(lbuffer, 8);
                   continue;
@@ -270,5 +261,4 @@
          for (StdSize i = 0; i < buffer.size(); i++)
             dataArray[i] = buffer[i].getFloatArray(5);
-         std::cout << "writeData called (float) " << fieldId << ", " << dataArray[0] << std::endl;
          // Jamais atteint car les donnÃ©es sont transfÃ©rÃ©es en tant que double
          return;
@@ -279,5 +269,4 @@
          for (StdSize i = 0; i < buffer.size(); i++)
             dataArray[i] = buffer[i].getDoubleArray(5);
-         std::cout << "writeData called (double) " << fieldId << ", " << dataArray[0]  << std::endl;
          dtreat->write_data(fieldId, fileId, dataArray);
          return;
Index: /XMLIO_V2/dev/common/src/server_main.f90
===================================================================
--- /XMLIO_V2/dev/common/src/server_main.f90	(revision 300)
+++ /XMLIO_V2/dev/common/src/server_main.f90	(revision 300)
@@ -0,0 +1,10 @@
+PROGRAM server_main
+  USE xios
+  IMPLICIT NONE
+  INCLUDE "mpif.h"
+  INTEGER :: ierr
+  
+!    CALL MPI_INIT(ierr)  
+    CALL xios_init_server
+!    CALL MPI_FINALIZE(ierr)  
+  END PROGRAM server_main
Index: /XMLIO_V2/dev/common/src/server_ym.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/server_ym.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/server_ym.cpp	(revision 300)
@@ -0,0 +1,381 @@
+#include "xmlioserver_spl.hpp"
+#include "cxios.hpp"
+#include "server_ym.hpp"
+#include "type.hpp"
+#include "buffer.hpp"
+#include "context.hpp"
+#include "object_template_impl.hpp"
+#include "tree_manager.hpp"
+#include "oasis_cinterface.hpp"
+#include <boost/functional/hash.hpp>
+#include <boost/algorithm/string.hpp>
+#include <mpi.h>
+
+namespace xmlioserver
+{                      
+  namespace ym
+  {
+
+    MPI_Comm CServer::intraComm ;
+    list<MPI_Comm> CServer::interComm ;
+    bool CServer::isRoot ;
+    int CServer::rank ;
+    map<string,CContext*> CServer::contextList ;    
+    bool CServer::finished=false ;
+    bool CServer::is_MPI_Initialized ;
+    
+    void CServer::initialize(void)
+    {
+      int initialized ;
+      MPI_Initialized(&initialized) ;
+      if (initialized) is_MPI_Initialized=true ;
+      else is_MPI_Initialized=false ;
+            
+      // Not using OASIS
+      if (!CXios::usingOasis)
+      {
+        
+        if (!is_MPI_Initialized) 
+        {
+          int argc=0;
+          char** argv=NULL;
+          MPI_Init(&argc,&argv) ;
+        }
+         
+        boost::hash<string> hashString ;    
+      
+        unsigned long hashServer=hashString(CXios::xiosCodeId) ;
+        unsigned long* hashAll ;
+      
+        int rank ;
+        int size ;
+        int myColor ;
+        int i,c ;
+        MPI_Comm newComm ;
+      
+        MPI_Comm_size(CXios::globalComm,&size) ;
+        MPI_Comm_rank(CXios::globalComm,&rank);
+        hashAll=new unsigned long[size] ;
+     
+        MPI_Allgather(&hashServer,1,MPI_LONG,hashAll,1,MPI_LONG,CXios::globalComm) ;
+
+        map<unsigned long, int> colors ;
+        map<unsigned long, int> leaders ;
+        map<unsigned long, int>::iterator it ;
+      
+        for(i=0,c=0;i<size;i++)
+        {
+          if (colors.find(hashAll[i])==colors.end())
+          {
+            colors[hashAll[i]]=c ;
+            leaders[hashAll[i]]=i ;
+            c++ ;
+          }
+        }
+     
+        myColor=colors[hashServer] ;
+        MPI_Comm_split(MPI_COMM_WORLD,myColor,rank,&intraComm) ;
+
+        int serverLeader=leaders[hashServer] ;
+        int clientLeader;
+     
+         serverLeader=leaders[hashServer] ;
+         for(it=leaders.begin();it!=leaders.end();it++)
+         {
+           if (it->first!=hashServer)
+           {
+             clientLeader=it->second ;
+           
+             MPI_Intercomm_create(intraComm,0,CXios::globalComm,clientLeader,0,&newComm) ;
+             interComm.push_back(newComm) ;
+           }
+         }
+
+         delete [] hashAll ;
+      }
+      // using OASIS
+      else
+      {
+        int rank ,size;
+        if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId) ;
+        oasis_get_localcomm(intraComm) ;
+        MPI_Comm_rank(intraComm,&rank) ;
+        MPI_Comm_size(intraComm,&size) ;
+        string codesId=CXios::getin<string>("oasis_codes_id") ;
+         
+        vector<string> splitted ;
+        boost::split( splitted, codesId, boost::is_space(), boost::token_compress_on ) ;
+        vector<string>::iterator it ;
+
+        MPI_Comm newComm ;
+        int globalRank ;
+        MPI_Comm_rank(CXios::globalComm,&globalRank);
+        
+        for(it=splitted.begin();it!=splitted.end();it++)
+        {
+          oasis_get_intercomm(newComm,*it) ;
+          if (rank==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ;
+          MPI_Comm_remote_size(newComm,&size);
+          interComm.push_back(newComm) ;
+        }
+      }
+      
+      int rank ;
+      MPI_Comm_rank(intraComm,&rank) ;
+      if (rank==0) isRoot=true;
+      else isRoot=false; 
+      eventLoop() ;
+      finalize() ;
+    }
+    
+    void CServer::finalize(void)
+    {
+      if (!is_MPI_Initialized)
+      { 
+        if (CXios::usingOasis) oasis_finalize();
+        else MPI_Finalize() ;
+      }
+    }
+    
+     void CServer::eventLoop(void)
+     {
+       bool stop=false ;
+       
+       while(!stop)
+       {
+         if (isRoot)
+         {
+           listenContext();
+           if (!finished) listenFinalize() ;
+         }
+         else
+         {
+           listenRootContext();
+           if (!finished) listenRootFinalize() ;
+         }
+       
+         contextEventLoop() ;
+         if (finished && contextList.empty()) stop=true ;
+       }
+     
+     }
+     
+     void CServer::listenFinalize(void)
+     {
+        list<MPI_Comm>::iterator it;
+        int msg ;
+        int flag ;
+        
+        for(it=interComm.begin();it!=interComm.end();it++)
+        {
+           MPI_Status status ;
+           MPI_Iprobe(0,0,*it,&flag,&status) ;
+           if (flag==true)
+           {
+              MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ;
+              info(20)<<" CServer : Receive client finalize"<<endl ;
+              interComm.erase(it) ;
+              break ;
+            }
+         }
+         
+         if (interComm.empty())
+         {
+           int i,size ;
+           MPI_Comm_size(intraComm,&size) ;
+           MPI_Request* requests= new MPI_Request[size-1] ;
+           MPI_Status* status= new MPI_Status[size-1] ;
+          
+           for(int i=1;i<size;i++) MPI_Isend(&msg,1,MPI_INT,i,4,intraComm,&requests[i-1]) ;
+           MPI_Waitall(size-1,requests,status) ;
+
+           finished=true ;
+           delete [] requests ;
+           delete [] status ;
+         }
+     }
+      
+     
+     void CServer::listenRootFinalize()
+     {
+        int flag ;
+        MPI_Status status ;
+        int msg ;
+        
+        MPI_Iprobe(0,4,intraComm, &flag, &status) ;
+        if (flag==true)
+        {
+           MPI_Recv(&msg,1,MPI_INT,0,4,intraComm,&status) ;
+           finished=true ;
+        }
+      }
+      
+     void CServer::listenContext(void)
+     {
+       
+       MPI_Status status ;
+       int flag ;
+       static void* buffer ;
+       static MPI_Request request ;
+       static bool recept=false ;
+       int rank ;
+       int count ;
+       
+       if (recept==false)
+       {
+         MPI_Iprobe(MPI_ANY_SOURCE,1,CXios::globalComm, &flag, &status) ;
+         if (flag==true) 
+         {
+           rank=status.MPI_SOURCE ;
+           MPI_Get_count(&status,MPI_CHAR,&count) ;
+           buffer=new char[count] ;
+           MPI_Irecv(buffer,count,MPI_CHAR,rank,1,CXios::globalComm,&request) ;
+           recept=true ;   
+         }
+       }
+       else
+       {
+         MPI_Test(&request,&flag,&status) ;
+         if (flag==true)
+         {
+           rank=status.MPI_SOURCE ;
+           MPI_Get_count(&status,MPI_CHAR,&count) ;
+           recvContextMessage(buffer,count) ;
+           delete [] buffer ;
+           recept=false ;         
+         }
+       }
+     }
+     
+     void CServer::recvContextMessage(void* buff,int count)
+     {
+ 
+       
+       static map<string,contextMessage> recvContextId ;
+       map<string,contextMessage>::iterator it ;
+       
+       CBufferIn buffer(buff,count) ;
+       string id ;
+       int clientLeader ;
+       int nbMessage ;
+
+       buffer>>id>>nbMessage>>clientLeader ;
+                       
+       it=recvContextId.find(id) ;
+       if (it==recvContextId.end())
+       {         
+         contextMessage msg={0,0} ;
+         pair<map<string,contextMessage>::iterator,bool> ret ;
+         ret=recvContextId.insert(pair<string,contextMessage>(id,msg)) ;
+         it=ret.first ;
+       }  
+       it->second.nbRecv+=1 ;
+       it->second.leaderRank+=clientLeader ;
+         
+       if (it->second.nbRecv==nbMessage)
+       { 
+         int size ;
+         MPI_Comm_size(intraComm,&size) ;
+         MPI_Request* requests= new MPI_Request[size-1] ;
+         MPI_Status* status= new MPI_Status[size-1] ;
+         
+         for(int i=1;i<size;i++)
+         {
+            MPI_Isend(buff,count,MPI_CHAR,i,2,intraComm,&requests[i-1]) ;
+         }
+         MPI_Waitall(size-1,requests,status) ;
+         registerContext(buff,count,it->second.leaderRank) ;
+
+         recvContextId.erase(it) ;
+         delete [] requests ;
+         delete [] status ;
+
+       }
+     }     
+     
+     void CServer::listenRootContext(void)
+     {
+       
+       MPI_Status status ;
+       int flag ;
+       static void* buffer ;
+       static MPI_Request request ;
+       static bool recept=false ;
+       int rank ;
+       int count ;
+       const int root=0 ;
+       
+       if (recept==false)
+       {
+         MPI_Iprobe(root,2,intraComm, &flag, &status) ;
+         if (flag==true) 
+         {
+           MPI_Get_count(&status,MPI_CHAR,&count) ;
+           buffer=new char[count] ;
+           MPI_Irecv(buffer,count,MPI_CHAR,root,2,intraComm,&request) ;
+           recept=true ;   
+         }
+       }
+       else
+       {
+         MPI_Test(&request,&flag,&status) ;
+         if (flag==true)
+         {
+           MPI_Get_count(&status,MPI_CHAR,&count) ;
+           registerContext(buffer,count) ;
+           delete [] buffer ;
+           recept=false ;         
+         }
+       }
+     } 
+     
+     
+     
+     void CServer::registerContext(void* buff,int count, int leaderRank)
+     {
+     
+       string contextId;
+       CBufferIn buffer(buff,count) ;
+
+       buffer>>contextId ;
+       MPI_Comm contextIntercomm ;
+       MPI_Intercomm_create(intraComm,0,CXios::globalComm,leaderRank,10+leaderRank,&contextIntercomm) ;
+       
+       info(20)<<"CServer : Register new Context : "<<contextId<<endl  ;
+       MPI_Comm inter ;
+       MPI_Intercomm_merge(contextIntercomm,1,&inter) ;
+       MPI_Barrier(inter) ;
+       if (contextList.find(contextId)!=contextList.end()) 
+        ERROR("void CServer::registerContext(void* buff,int count, int leaderRank)",
+              <<"Context has already been registred") ;
+      
+//      tree::CContext* ptr ;
+//      if (tree::CContext::has(contextId)) ptr=tree::CContext::get(contextId).get() ;
+//      else ptr=tree::CContext::create(contextId).get() ;
+      shared_ptr<CContext> context=tree::CTreeManager::CreateContext(contextId) ;
+      contextList[contextId]=context.get() ;
+      context->initServer(intraComm,contextIntercomm) ;
+             
+     }    
+     
+     
+     void CServer::contextEventLoop(void)
+     {
+       bool finished ;
+       map<string,CContext*>::iterator it ;
+       for(it=contextList.begin();it!=contextList.end();it++) 
+       {
+         finished=it->second->eventLoop() ;
+         if (finished)
+         {
+           contextList.erase(it) ;
+           break ;
+         }
+       }
+         
+     }
+     
+
+
+  }
+}
Index: /XMLIO_V2/dev/common/src/server_ym.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/server_ym.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/server_ym.hpp	(revision 300)
@@ -0,0 +1,45 @@
+#ifndef __SERVER_YM__HPP__
+#define __SERVER_YM__HPP__
+
+#include "xmlioserver_spl.hpp"
+#include "context.hpp"
+#include <mpi.h>
+
+namespace xmlioserver
+{
+  namespace ym
+  {
+    class CServer
+    {
+       public:
+       
+       static void initialize(void) ;
+       static void finalize(void) ;
+       static void eventLoop(void) ;
+       static void contextEventLoop(void) ;
+       static void listenContext(void) ;
+       static void listenFinalize(void) ;
+       static void recvContextMessage(void* buff,int count) ;
+       static void listenRootContext(void) ;
+       static void listenRootFinalize(void) ;
+       static void registerContext(void* buff,int count, int leaderRank=0) ;
+       
+       static MPI_Comm intraComm ;
+       static list<MPI_Comm> interComm ;
+
+       struct contextMessage
+       {
+         int nbRecv ;
+         int leaderRank ;
+       } ;
+       
+      static bool isRoot ;
+      static int rank ;
+      static map<string,CContext*> contextList ;
+      static bool finished ;
+      static bool is_MPI_Initialized ;
+    } ;
+  }
+}
+
+#endif
Index: /XMLIO_V2/dev/common/src/test/test.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/test/test.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/test/test.cpp	(revision 300)
@@ -0,0 +1,29 @@
+#include <iostream>
+#include <sstream>
+#include <string>
+
+using namespace std ;
+
+
+class CLog : public ostream
+{
+   public :
+   CLog() : ostream(NULL),level(0) {}
+   CLog& operator()(int l) {if (l<=level) rdbuf(cout.rdbuf()) ; else rdbuf(NULL) ; return *this;}
+   void setLevel(int l) {level=l; } 
+   int level ;
+//   ostringstream& getStream() { return *(ostringstream*)(this) ; }
+//   ~CLog(void) { cout<<"info message "<< this->str();}
+};
+
+
+int main(void)
+{
+  CLog out ;
+  cout<<string("toto")<<endl ;
+  out<<"123"<<endl ;
+  out.setLevel(5) ;
+  out(7)<<"coucou 1"<<endl ;
+  out(3)<<"coucou 2"<<endl<<"i23"<<endl ;
+  
+}
Index: /XMLIO_V2/dev/common/src/test/test_cs.f90
===================================================================
--- /XMLIO_V2/dev/common/src/test/test_cs.f90	(revision 300)
+++ /XMLIO_V2/dev/common/src/test/test_cs.f90	(revision 300)
@@ -0,0 +1,121 @@
+PROGRAM test_cs
+IMPLICIT NONE
+  INCLUDE "mpif.h"
+  INTEGER :: rank
+  INTEGER :: size
+  INTEGER :: ierr
+  
+  CALL MPI_INIT(ierr)
+  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
+  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr)
+  
+  IF (rank<3) THEN
+   CALL client("client",rank,3)
+  ELSE 
+    CALL server
+  ENDIF
+  
+  
+  CALL MPI_FINALIZE(ierr)
+  
+END PROGRAM test_cs
+
+  SUBROUTINE client(id,rank,size)
+  USE xios
+  IMPLICIT NONE
+  INCLUDE 'mpif.h'
+  CHARACTER(len=*) :: id
+  INTEGER :: rank
+  INTEGER :: size
+  INTEGER :: comm
+  TYPE(xios_time)      :: dtime
+  TYPE(xios_context) :: ctx_hdl
+  INTEGER,PARAMETER :: ni_glo=10 
+  INTEGER,PARAMETER :: nj_glo=10 
+  TYPE(xios_field) :: field_hdl
+  TYPE(xios_fieldgroup) :: fieldgroup_hdl
+  TYPE(xios_file) :: file_hdl
+  
+  
+  DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo,field_A_glo
+  DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:)
+  INTEGER :: ni,ibegin,iend,nj,jbegin,jend
+  INTEGER :: i,j,ts,n
+  
+  DO j=1,nj_glo
+    DO i=1,ni_glo
+      lon_glo(i,j)=(i-1)+(j-1)*ni_glo
+      lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo
+      field_A_glo(i,j)=(i-1)+(j-1)*ni_glo
+    ENDDO
+  ENDDO
+  ni=ni_glo ; ibegin=1
+
+  jbegin=1
+  DO n=0,size-1
+    nj=nj_glo/size
+    IF (n<MOD(nj_glo,size)) nj=nj+1
+    IF (n==rank) exit 
+    jbegin=jbegin+nj
+  ENDDO
+  
+  iend=ibegin+ni-1 ; jend=jbegin+nj-1
+
+  ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2))
+  lon(:,:)=lon_glo(ibegin:iend,jbegin:jend)
+  lat(:,:)=lat_glo(ibegin:iend,jbegin:jend)
+  field_A(1:ni,1:nj)=field_A_glo(ibegin:iend,jbegin:jend)
+  
+
+  CALL xios_initialize(id,local_comm=MPI_COMM_WORLD,return_comm=comm)
+
+  CALL xios_context_initialize("test",comm)
+  CALL xios_get_handle("test",ctx_hdl)
+  CALL xios_set_current_context(ctx_hdl)
+  
+  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
+  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
+  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
+  CALL xios_set_context_attr("test",start_date="01/01/2000 - 00:00:00")
+  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
+  CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj)
+  CALL xios_set_domain_attr("domain_A",zoom_ni=3,zoom_ibegin=3,zoom_nj=3,zoom_jbegin=6)
+  CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
+  CALL xios_set_domain_attr("domain_A",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/)))
+  CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
+  
+  CALL xios_get_handle("field_definition",fieldgroup_hdl)
+  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")
+  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")
+  
+  CALL xios_get_handle("output",file_hdl)
+  CALL xios_add_child(file_hdl,field_hdl)
+  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C")
+    
+ 
+    dtime%second=3600
+    CALL xios_set_timestep(dtime) 
+
+    CALL xios_close_context_definition()
+    DO ts=1,96
+      CALL xios_update_calendar(ts)
+      CALL xios_send_field("field_A",field_A)
+    ENDDO
+  
+    CALL xios_context_finalize()
+    CALL xios_finalize()
+     
+  END SUBROUTINE client
+  
+
+  
+  SUBROUTINE server
+  USE xios
+  IMPLICIT NONE
+  
+    CALL xios_init_server
+ 
+  END SUBROUTINE server
+  
+
+  
Index: /XMLIO_V2/dev/common/src/test/test_xios.cpp
===================================================================
--- /XMLIO_V2/dev/common/src/test/test_xios.cpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/test/test_xios.cpp	(revision 300)
@@ -0,0 +1,136 @@
+#include "xmlioserver.hpp"
+#include "attribute_template_impl.hpp"
+/*
+#include "group_template_impl.hpp"
+#include "file.hpp"
+*/
+#include "buffer_out.hpp"
+#include "buffer_in.hpp"
+#include "type.hpp"
+#include "cxios.hpp"
+#include "client_ym.hpp"
+#include "event_client.hpp"
+#include "context.hpp"
+#include "context_client.hpp"
+#include "context_server.hpp"
+#include "object_template_impl.hpp"
+#include <mpi.h>
+
+
+using namespace std ;
+using namespace ym ;
+
+int main (int argc, char ** argv, char ** UNUSED (env))
+{
+  
+  int a=3 ;
+  int b=2 ;
+  int c=1 ;
+  int buff[100] ;
+  string str("titi") ;
+   CBufferOut bufferOut(&buff,sizeof(buff)) ;
+   CBufferIn  bufferIn(&buff,sizeof(buff)) ;
+   CMessage msg ;
+/*
+   msg<<(int)3<<(int)2<<(int)1<<str ;
+//   msg<<a<<b<<c ;
+   std::cout<<"message size : "<<msg.size()<<std::endl ;
+   str="turlututu" ;
+   bufferOut<<msg ;
+   msg.clear() ;
+   msg<<a<<b<<c<<str ;
+//   bufferIn>>c>>b>>a>>str ;
+   bufferIn>>msg ;
+   std::cout<<a<<"  "<<b<<"  "<<c<<"  "<<str<<endl ;
+*/
+//   CAttributeTemplate<ARRAY(double,1)> tabIn ;
+ //  CAttributeTemplate<ARRAY(double,1)> tabOut ;
+   CAttributeTemplate<ARRAY(double,1)> tabIn("in") ;
+   CAttributeTemplate<ARRAY(double,1)> tabOut("out") ;
+
+   ARRAY_CREATE(tab,double,1,[5]) ; 
+ //   tab->resize(extents[5]) ;
+    (*tab)[0]=0 ; (*tab)[1]=1 ;(*tab)[2]=2 ; (*tab)[3]=3 ;(*tab)[4]=4 ;
+    tabIn=tab ;
+    (*tab)[0]=4 ; (*tab)[1]=3 ;(*tab)[2]=2 ; (*tab)[3]=1 ;(*tab)[4]=0 ;
+    tabOut=tab ;
+//   tabOut=1 ;
+   tabIn.toBuffer(bufferOut) ;
+   tabOut.fromBuffer(bufferIn) ;
+   
+   cout<<"attribut<Arraydouble,5>>="<<tabOut.toString()<<endl ;
+   
+   MPI_Init(&argc,&argv) ;
+   int rank ;
+   int size ;
+   char buffer[128] ;
+   
+   MPI_Comm_rank(MPI_COMM_WORLD,&rank) ;
+   if (rank>=0 && rank<=1) 
+   {
+     CXios::initClientSide("test1") ;
+     ym::CClient::registerContext("toto",ym::CClient::intraComm) ;
+//     ym::CClient::registerContext("tata",ym::CClient::intraComm) ;
+     ym::CClient::registerContext("tutu",ym::CClient::intraComm) ;
+     CObjectFactory::SetCurrentContextId("tutu") ;
+     CContext*  tutu=(CObjectFactory::GetObject<CContext>("tutu")).get(); 
+     
+     
+     CObjectFactory::SetCurrentContextId("toto") ;
+     CContext*  toto=(CObjectFactory::GetObject<CContext>("toto")).get(); 
+     toto->calendar_type.setValue("NoLeap") ;
+     toto->sendAttributToServer("calendar_type" );
+
+
+       for(int i=0;i<0;i++)
+       {
+         CMessage msg ;
+         int count ;
+         int msgSize; 
+         CEventClient event(1,1) ;
+         count=rand()%32 ;
+         msg<<string("toto")<<string(buffer,count)<<rank<<msgSize;
+         msgSize=msg.size() ;
+         event.push(0,2,msg) ;
+         event.push(1,2,msg) ;
+         toto->client->sendEvent(event) ;
+         cout<<"Send Event from toto : size "<<msgSize<<endl ;
+       }
+     toto->client->finalize() ;
+     tutu->client->finalize() ;
+     CXios::clientFinalize() ;
+   }
+   else if (rank>=2 && rank<=3) CXios::initServerSide();
+   else if (rank>=4 && rank<=6) 
+   {
+     CXios::initClientSide("test2") ;
+     ym::CClient::registerContext("tito",ym::CClient::intraComm) ;
+     CObjectFactory::SetCurrentContextId("tito") ;
+     CContext*  tito=(CObjectFactory::GetObject<CContext>("tito")).get();
+      
+     ym::CClient::registerContext("tete",ym::CClient::intraComm) ;
+     CObjectFactory::SetCurrentContextId("tete") ;
+     CContext*  tete=(CObjectFactory::GetObject<CContext>("tete")).get(); 
+
+     tito->client->finalize() ;
+     tete->client->finalize() ;
+     CXios::clientFinalize() ;
+   } 
+   else if (rank>=7 && rank<=7) 
+   {
+     CXios::initClientSide("test3") ;
+     ym::CClient::registerContext("turlututu",ym::CClient::intraComm) ;
+     CObjectFactory::SetCurrentContextId("turlututu") ;
+     CContext*  turlututu=(CObjectFactory::GetObject<CContext>("turlututu")).get(); 
+     turlututu->client->finalize() ;
+     CXios::clientFinalize() ;
+   }
+   
+   
+  
+   MPI_Barrier(MPI_COMM_WORLD); 
+   MPI_Finalize() ;
+
+  return EXIT_SUCCESS ;
+ 
+}
Index: /XMLIO_V2/dev/common/src/transfert_parameters.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/transfert_parameters.hpp	(revision 300)
+++ /XMLIO_V2/dev/common/src/transfert_parameters.hpp	(revision 300)
@@ -0,0 +1,18 @@
+#ifndef __TRANSFERT_PARAMETERS_HPP__
+#define __TRANSFERT_PARAMETERS_HPP__
+
+
+
+#define CLASS_ID_CONTEXT 1
+#define CLASS_ID_FIELD 2
+#define CLASS_ID_FILE 3
+#define CLASS_ID_AXIS 3
+#define CLASS_ID_DOMAIN 4
+#define CLASS_ID_GRID 5
+
+#define TYPE_ID_FINALIZE 2
+#define TYPE_ID_SEND_ATTR 3
+
+
+
+#endif
Index: /XMLIO_V2/dev/common/src/xmlioserver_spl.hpp
===================================================================
--- /XMLIO_V2/dev/common/src/xmlioserver_spl.hpp	(revision 299)
+++ /XMLIO_V2/dev/common/src/xmlioserver_spl.hpp	(revision 300)
@@ -20,5 +20,5 @@
 #include <map>
 #include <deque>
-
+#include <valarray>
 // Flux.
 #include <iostream>
@@ -28,5 +28,6 @@
 /// boost headers ///
 //#include <boost/unordered_map.hpp>
-
+#include <boost/shared_ptr.hpp>
+#include <boost/cast.hpp>
 /// Map ///
 #define xios_map std::map
@@ -45,6 +46,14 @@
 typedef std::size_t        StdSize;
 
+typedef  unsigned short int   ushort;
+typedef  unsigned int         uint;
+typedef  unsigned long int    ulong;
+
 /// xmlioserver headers ///
 #include "configure.hpp"
+#include "log.hpp"
+using namespace std;
+using namespace boost ;
+
 
 #endif //__XMLIO_SPL__
