Index: XIOS/trunk/src/node/file.cpp
===================================================================
--- XIOS/trunk/src/node/file.cpp	(revision 1542)
+++ XIOS/trunk/src/node/file.cpp	(revision 1622)
@@ -53,7 +53,9 @@
 
    const StdString CFile::getFileOutputName(void) const
+   TRY
    {
      return (name.isEmpty() ? getId() : name) + (name_suffix.isEmpty() ? StdString("") :  name_suffix.getValue());
    }
+   CATCH
 
    //----------------------------------------------------------------
@@ -65,7 +67,9 @@
    */
    std::shared_ptr<CDataOutput> CFile::getDataOutput(void) const
+   TRY
    {
       return data_out;
    }
+   CATCH
 
    /*!
@@ -76,7 +80,9 @@
    */
    std::shared_ptr<CDataInput> CFile::getDataInput(void) const
+   TRY
    {
       return data_in;
    }
+   CATCH
 
    /*!
@@ -88,7 +94,9 @@
    */
    CFieldGroup* CFile::getVirtualFieldGroup(void) const
+   TRY
    {
       return (this->vFieldGroup);
    }
+   CATCH
 
    /*!
@@ -100,19 +108,25 @@
    */
    CVariableGroup* CFile::getVirtualVariableGroup(void) const
+   TRY
    {
       return (this->vVariableGroup);
    }
+   CATCH
 
    //! Get all fields of a file
    std::vector<CField*> CFile::getAllFields(void) const
+   TRY
    {
       return (this->vFieldGroup->getAllChildren());
    }
+   CATCH
 
    //! Get all variables of a file
    std::vector<CVariable*> CFile::getAllVariables(void) const
+   TRY
    {
       return (this->vVariableGroup->getAllChildren());
    }
+   CATCH
 
    //----------------------------------------------------------------
@@ -129,4 +143,5 @@
                                                 int default_level,
                                                 bool default_enabled)
+   TRY
    {
       if (!this->enabledFields.empty())
@@ -145,10 +160,8 @@
          {
             if (! (*it)->enabled.getValue()) continue;
-//            { it--; this->enabledFields.erase(it+1); continue; }
          }
          else // Si l'attribut 'enabled' n'est pas dfini ...
          {
             if (!default_enabled) continue;
-//            { it--; this->enabledFields.erase(it+1); continue; }
          }
 
@@ -156,18 +169,11 @@
          {
             if ((*it)->level.getValue() > _outputlevel) continue;
-//            { it--; this->enabledFields.erase(it+1); continue; }
          }
          else // Si l'attribut 'level' n'est pas dfini ...
          {
             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 rfrence au champ de base.
          (*it)->setRelFile(CFile::get(this));
@@ -177,20 +183,26 @@
       return (this->enabledFields);
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
    //! Change virtual field group to a new one
    void CFile::setVirtualFieldGroup(CFieldGroup* newVFieldGroup)
+   TRY
    {
       this->vFieldGroup = newVFieldGroup;
    }
+   CATCH_DUMP_ATTR
 
    //! Change virtual variable group to new one
    void CFile::setVirtualVariableGroup(CVariableGroup* newVVariableGroup)
+   TRY
    {
       this->vVariableGroup = newVVariableGroup;
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
    bool CFile::isSyncTime(void)
+   TRY
    {
      CContext* context = CContext::getCurrent();
@@ -206,7 +218,9 @@
       return false;
     }
+    CATCH_DUMP_ATTR
 
    //! Initialize a file in order to write into it
    void CFile::initWrite(void)
+   TRY
    {
       CContext* context = CContext::getCurrent();
@@ -261,7 +275,9 @@
       if (time_counter_name.isEmpty()) time_counter_name = "time_counter";
     }
+    CATCH_DUMP_ATTR
 
     //! Initialize a file in order to write into it
     void CFile::initRead(void)
+    TRY
     {
       if (checkRead) return;
@@ -269,4 +285,5 @@
       checkRead = true;
     }
+    CATCH_DUMP_ATTR
 
     /*!
@@ -274,4 +291,5 @@
     */
     void CFile::createSubComFile()
+    TRY
     {
       CContext* context = CContext::getCurrent();
@@ -292,4 +310,5 @@
       if (allZoneEmpty) MPI_Comm_free(&fileComm);
     }
+    CATCH_DUMP_ATTR
 
     /*
@@ -299,4 +318,5 @@
     */
     void CFile::checkWriteFile(void)
+    TRY
     {
       CContext* context = CContext::getCurrent();
@@ -315,4 +335,5 @@
       }
     }
+    CATCH_DUMP_ATTR
 
     /*
@@ -323,4 +344,5 @@
     */
     void CFile::checkReadFile(void)
+    TRY
     {
       CContext* context = CContext::getCurrent();
@@ -340,4 +362,5 @@
       }
     }
+    CATCH_DUMP_ATTR
 
     /*!
@@ -346,7 +369,9 @@
     */
     bool CFile::isEmptyZone()
+    TRY
     {
       return allZoneEmpty;
     }
+    CATCH_DUMP_ATTR
 
     /*!
@@ -357,4 +382,5 @@
     */
    bool CFile::checkSync(void)
+   TRY
    {
      CContext* context = CContext::getCurrent();
@@ -371,4 +397,5 @@
       return false;
     }
+   CATCH_DUMP_ATTR
 
     /*!
@@ -379,4 +406,5 @@
     */
     bool CFile::checkSplit(void)
+    TRY
     {
       CContext* context = CContext::getCurrent();
@@ -402,4 +430,5 @@
       return false;
     }
+    CATCH_DUMP_ATTR
 
    /*!
@@ -408,4 +437,5 @@
    */
    void CFile::createHeader(void)
+   TRY
    {
       CContext* context = CContext::getCurrent();
@@ -594,4 +624,5 @@
       }
    }
+   CATCH_DUMP_ATTR
 
   /*!
@@ -599,4 +630,5 @@
   */
   void CFile::openInReadMode()
+  TRY
   {
     CContext* context = CContext::getCurrent();
@@ -675,7 +707,9 @@
     }
   }
+  CATCH_DUMP_ATTR
 
    //! Close file
    void CFile::close(void)
+   TRY
    {
      if (!allZoneEmpty)
@@ -690,7 +724,10 @@
       if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm);
    }
+   CATCH_DUMP_ATTR
+
    //----------------------------------------------------------------
 
    void CFile::readAttributesOfEnabledFieldsInReadMode()
+   TRY
    {
      if (enabledFields.empty()) return;
@@ -722,5 +759,5 @@
      close();
    }
-
+   CATCH_DUMP_ATTR
 
    /*!
@@ -729,4 +766,5 @@
    */
    void CFile::parse(xml::CXMLNode & node)
+   TRY
    {
       SuperClass::parse(node);
@@ -741,6 +779,7 @@
         node.goToParentElement();
       }
-
-   }
+   }
+   CATCH_DUMP_ATTR
+
    //----------------------------------------------------------------
 
@@ -750,4 +789,5 @@
    */
    StdString CFile::toString(void) const
+   TRY
    {
       StdOStringStream oss;
@@ -762,4 +802,5 @@
       return (oss.str());
    }
+   CATCH
 
    //----------------------------------------------------------------
@@ -772,4 +813,5 @@
    */
    void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent)
+   TRY
    {
       SuperClassAttribute::setAttributes(parent,apply);
@@ -777,4 +819,5 @@
       this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL);
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
@@ -789,4 +832,5 @@
    */
    void CFile::solveOnlyRefOfEnabledFields(bool sendToServer)
+   TRY
    {
      int size = this->enabledFields.size();
@@ -796,6 +840,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CFile::checkGridOfEnabledFields()
+   TRY
    { 
      int size = this->enabledFields.size();
@@ -805,6 +851,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CFile::sendGridComponentOfEnabledFields()
+   TRY
    { 
      int size = this->enabledFields.size();
@@ -814,4 +862,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -820,4 +869,5 @@
    */
    void CFile::sortEnabledFieldsForUgrid()
+   TRY
    {
      int size = this->enabledFields.size();
@@ -868,6 +918,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CFile::sendGridOfEnabledFields()
+   TRY
    { 
      int size = this->enabledFields.size();
@@ -877,6 +929,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CFile::generateNewTransformationGridDest()
+   TRY
    {
      int size = this->enabledFields.size();
@@ -886,4 +940,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -896,4 +951,5 @@
    */
    void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer)
+   TRY
    {
      int size = this->enabledFields.size();
@@ -903,4 +959,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -910,4 +967,5 @@
     */
    void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc)
+   TRY
    {
      int size = this->enabledFields.size();
@@ -917,4 +975,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -922,4 +981,5 @@
     */
    void CFile::postProcessFilterGraph()
+   TRY
    {
      int size = this->enabledFields.size();
@@ -929,4 +989,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -934,4 +995,5 @@
    */
    void CFile::prefetchEnabledReadModeFields(void)
+   TRY
    {
      if (mode.isEmpty() || mode.getValue() != mode_attr::read)
@@ -942,4 +1004,5 @@
        this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate());
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -949,4 +1012,5 @@
    */
    void CFile::doPreTimestepOperationsForEnabledReadModeFields(void)
+   TRY
    {
      if (mode.isEmpty() || mode.getValue() != mode_attr::read)
@@ -960,4 +1024,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -966,4 +1031,5 @@
    */
    void CFile::doPostTimestepOperationsForEnabledReadModeFields(void)
+   TRY
    {
      if (mode.isEmpty() || mode.getValue() != mode_attr::read)
@@ -976,6 +1042,8 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    void CFile::solveFieldRefInheritance(bool apply)
+   TRY
    {
       // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier.
@@ -984,4 +1052,5 @@
          allF[i]->solveRefInheritance(apply);
    }
+   CATCH_DUMP_ATTR
 
    //----------------------------------------------------------------
@@ -996,7 +1065,9 @@
    */
    CField* CFile::addField(const string& id)
+   TRY
    {
      return vFieldGroup->createChild(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1008,7 +1079,9 @@
    */
    CFieldGroup* CFile::addFieldGroup(const string& id)
+   TRY
    {
      return vFieldGroup->createChildGroup(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1023,7 +1096,9 @@
    */
    CVariable* CFile::addVariable(const string& id)
+   TRY
    {
      return vVariableGroup->createChild(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1035,9 +1110,12 @@
    */
    CVariableGroup* CFile::addVariableGroup(const string& id)
+   TRY
    {
      return vVariableGroup->createChildGroup(id);
    }
+   CATCH_DUMP_ATTR
 
    void CFile::setContextClient(CContextClient* newContextClient)
+   TRY
    {
      client = newContextClient;
@@ -1048,19 +1126,26 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    CContextClient* CFile::getContextClient()
+   TRY
    {
      return client;
    }
+   CATCH_DUMP_ATTR
 
    void CFile::setReadContextClient(CContextClient* readContextclient)
+   TRY
    {
      read_client = readContextclient;
    }
+   CATCH_DUMP_ATTR
 
    CContextClient* CFile::getReadContextClient()
+   TRY
    {
      return read_client;
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1069,7 +1154,9 @@
    */
    void CFile::sendAddField(const string& id, CContextClient* client)
+   TRY
    {
       sendAddItem(id, EVENT_ID_ADD_FIELD, client);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1078,7 +1165,9 @@
    */
    void CFile::sendAddFieldGroup(const string& id, CContextClient* client)
+   TRY
    {
       sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP, client);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1087,4 +1176,5 @@
    */
    void CFile::recvAddField(CEventServer& event)
+   TRY
    {
 
@@ -1094,4 +1184,5 @@
       get(id)->recvAddField(*buffer);
    }
+   CATCH
 
    /*!
@@ -1100,4 +1191,5 @@
    */
    void CFile::recvAddField(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -1105,4 +1197,5 @@
       addField(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1111,4 +1204,5 @@
    */
    void CFile::recvAddFieldGroup(CEventServer& event)
+   TRY
    {
 
@@ -1118,4 +1212,5 @@
       get(id)->recvAddFieldGroup(*buffer);
    }
+   CATCH
 
    /*!
@@ -1124,4 +1219,5 @@
    */
    void CFile::recvAddFieldGroup(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -1129,4 +1225,5 @@
       addFieldGroup(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1137,4 +1234,5 @@
    */
    void CFile::sendAddAllVariables(CContextClient* client)
+   TRY
    {
      std::vector<CVariable*> allVar = getAllVariables();
@@ -1149,4 +1247,5 @@
      }
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1156,7 +1255,9 @@
    */
    void CFile::sendAddVariableGroup(const string& id, CContextClient* client)
+   TRY
    {
       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client);
    }
+   CATCH_DUMP_ATTR
 
    /*
@@ -1166,7 +1267,9 @@
    */
    void CFile::sendAddVariable(const string& id, CContextClient* client)
+   TRY
    {
       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1175,6 +1278,6 @@
    */
    void CFile::recvAddVariable(CEventServer& event)
-   {
-
+   TRY
+   {
       CBufferIn* buffer = event.subEvents.begin()->buffer;
       string id;
@@ -1182,4 +1285,5 @@
       get(id)->recvAddVariable(*buffer);
    }
+   CATCH
 
    /*!
@@ -1188,4 +1292,5 @@
    */
    void CFile::recvAddVariable(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -1193,4 +1298,5 @@
       addVariable(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1199,4 +1305,5 @@
    */
    void CFile::recvAddVariableGroup(CEventServer& event)
+   TRY
    {
 
@@ -1206,4 +1313,5 @@
       get(id)->recvAddVariableGroup(*buffer);
    }
+   CATCH
 
    /*!
@@ -1212,4 +1320,5 @@
    */
    void CFile::recvAddVariableGroup(CBufferIn& buffer)
+   TRY
    {
       string id;
@@ -1217,4 +1326,5 @@
       addVariableGroup(id);
    }
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1226,4 +1336,5 @@
    */
    void CFile::sendEnabledFields(CContextClient* client)
+   TRY
    {
      size_t size = this->enabledFields.size();
@@ -1237,5 +1348,5 @@
      }
    }
-
+   CATCH_DUMP_ATTR
 
    /*!
@@ -1247,4 +1358,5 @@
    */
    bool CFile::dispatchEvent(CEventServer& event)
+   TRY
    {
       if (SuperClass::dispatchEvent(event)) return true;
@@ -1278,7 +1390,26 @@
       }
    }
-
-
-
+   CATCH
+
+   ///--------------------------------------------------------------
+   /*!
+   */
+   StdString CFile::dumpClassAttributes(void)
+   {
+     StdString str;
+     CContext* context = CContext::getCurrent();
+     str.append("context=\"");
+     str.append(context->getId());
+     str.append("\"");
+     str.append(" enabled fields=\"");
+     int size = this->enabledFields.size();
+     for (int i = 0; i < size; ++i)
+     {
+       str.append(this->enabledFields[i]->getId());
+       str.append(" ");
+     }
+     str.append("\"");
+     return str;
+   }
 
    ///---------------------------------------------------------------
