Changeset 131


Ignore:
Timestamp:
10/13/10 15:25:55 (14 years ago)
Author:
hozdoba
Message:

Début Interface c<->fortran

Location:
XMLIO_V2/dev/dev_rv/src/XMLIO
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/XMLIO/NetCDF4_data_output.hpp

    r130 r131  
    5454            for ( it = saxis.begin() ; it != saxis.end(); it++ ) 
    5555            { 
    56                string axisid = ((*it)->name.hasValue()) ? (string)(*it)->name : (*it)->getId(); 
    57                dims[axisid]  = (*it)->size; 
     56               string axisid = ((*it)->name.hasValue()) ? 
     57                        (string)(*it)->name : (*it)->getId(); 
     58               dims[axisid]  =  (*it)->size; 
    5859            } 
    5960 
     
    6263 
    6364         std::string getFileName(void) 
    64          { return ((getRelFile()->name.hasValue()) ? string(getRelFile()->name): getRelFile()->name.getId()); } 
     65         { 
     66            return ((getRelFile()->name.hasValue()) ? 
     67              string(getRelFile()->name): getRelFile()->name.getId()); 
     68         } 
    6569 
    6670         std::string getTimeStamp(void) 
     
    111115               hm ["title"]         = "Time"; 
    112116               hm ["long_name"]     = "Time axis"; 
    113                hm ["units"]         = string("seconds since ").append(ccal->getInitDate().toString()); //"seconds since 1979-01-01 00:00:00" 
    114                hm ["calendar"]      = ccal->getType(); //"360d" 
    115                hm ["time_origin"]   = ccal->getInitDate().toString();//" 1979-JAN-01 00:00:00" ; 
     117               hm ["units"]         = string("seconds since ").append(ccal->getInitDate().toString()); 
     118               hm ["calendar"]      = ccal->getType(); 
     119               hm ["time_origin"]   = ccal->getInitDate().toString(); 
    116120               this->addStringAttributesToVar_str(oVar, hm); 
    117121               hm.clear(); 
     
    263267            NcType tvar = ncFloat; 
    264268            NcVar *var  = NULL; 
     269 
    265270            Poco::HashMap<string, string> hm; 
    266271            Poco::HashMap<string, float>  hmf; 
     272 
    267273            bool lonlat = false, wtime = true; 
     274 
    268275            const std::vector<CField*>& enabledFields = getRelFile()->getEnabledFields(); 
    269276            const std::set<const CDomain*> sdom = this->getRelFile()->getEnabledDomains(); 
     
    280287               //Duration    * const  ffope = field->freq_op.getValue(); 
    281288 
    282                string fieldid = (field->name.hasValue()) ? (string)field->name : bfield->getId(); 
    283                string domid   = (rdom ->name.hasValue()) ? (string)rdom ->name : rdom  ->getId(); 
    284                string axisid  = (raxis->name.hasValue()) ? (string)raxis->name : raxis ->getId(); 
     289               string fieldid = (field->name.hasValue()) ? 
     290                                 (string)field->name : bfield->getId(); 
     291               string domid   = (rdom ->name.hasValue()) ? 
     292                                 (string)rdom ->name : rdom  ->getId(); 
     293               string axisid  = (raxis->name.hasValue()) ? 
     294                                 (string)raxis->name : raxis ->getId(); 
    285295 
    286296               string lonid = (sdom.size() == 1)? string("lon") 
     
    305315                  { 
    306316                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    307                         dataFile->get_dim(TimeName), dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
     317                                 dataFile->get_dim(TimeName), 
     318                                 dataFile->get_dim(latid.c_str()), 
     319                                 dataFile->get_dim(lonid.c_str())))) 
    308320                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    309321                  } 
     
    311323                  { 
    312324                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    313                         dataFile->get_dim(TimeName), dataFile->get_dim(axisid.c_str()), 
    314                         dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
     325                                 dataFile->get_dim(TimeName), 
     326                                 dataFile->get_dim(axisid.c_str()), 
     327                                 dataFile->get_dim(latid.c_str()), 
     328                                 dataFile->get_dim(lonid.c_str())))) 
    315329                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    316330                  } 
     
    321335                  { 
    322336                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    323                         dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
     337                                 dataFile->get_dim(latid.c_str()), 
     338                                 dataFile->get_dim(lonid.c_str())))) 
    324339                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    325340                  } 
    326341                  else // 3D spatio sans temps 
    327342                  { 
    328                      if (!(var = dataFile->add_var(fieldid.c_str(), tvar, dataFile->get_dim(axisid.c_str()), 
    329                         dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
     343                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
     344                                 dataFile->get_dim(axisid.c_str()), 
     345                                 dataFile->get_dim(latid.c_str()), 
     346                                 dataFile->get_dim(lonid.c_str())))) 
    330347                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    331348                  } 
     
    361378            for ( it = attr.begin() ; it != attr.end(); it++ ) 
    362379               if (!var->add_att((*it).first.c_str(), (*it).second)) 
    363                   throw XMLIOUndefinedValueException("Impossible d'ajouter l'attribut' "+ (*it).first +" à la variable "+ var->name() +" !"); 
     380                  throw XMLIOUndefinedValueException 
     381                     ("Impossible d'ajouter l'attribut' "+ (*it).first +" à la variable "+ var->name() +" !"); 
    364382         } 
    365383 
     
    370388            for ( it = attr.begin() ; it != attr.end(); it++ ) 
    371389               if (!var->add_att((*it).first.c_str(), (*it).second.c_str())) 
    372                   throw XMLIOUndefinedValueException("Impossible d'ajouter l'attribut' "+ (*it).first +" à la variable "+ var->name() +" !"); 
     390                  throw XMLIOUndefinedValueException 
     391                     ("Impossible d'ajouter l'attribut' "+ (*it).first +" à la variable "+ var->name() +" !"); 
    373392         } 
    374393 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_calendar.hpp

    r130 r131  
    2020         } 
    2121 
    22          virtual string getType(void) const { return (string(this->getId())); } 
    23  
    2422         const Date& getInitDate(void) const { return(initDate); } 
    2523         Date& getCurrentDate(void) { return(currentDate); } 
     
    3836            return (NoLeapMonthLength[d.getMonth()-1]); 
    3937         } 
     38 
     39         virtual string getType(void) const { return (string(this->getId())); } 
    4040 
    4141         virtual int getYearTotalLength(const Date& d) const { return (365 * 86400); } // Retourne la durée d'une année en seconde. 
     
    7777 
    7878         AbstractCalendar(const string& _id, 
    79                           int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) 
     79                          int yr = 0, int mth = 1, int d   = 1, 
     80                          int hr = 0, int min = 0, int sec = 0) 
    8081            : AbstractObject(_id), 
    8182              initDate(*this, yr, mth, d, hr, min, sec), currentDate(initDate), timestep(Hour) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp

    r128 r131  
    1 #include "xmlio.hpp" 
     1#include "c_interface.hpp" 
    22 
    3 using namespace XMLIOSERVER; 
    4 using namespace XMLIOSERVER::XML; 
     3/* ********************************************************** */ 
     4/*                      CONVERSION FUNCTION                   */ 
     5/* ********************************************************** */ 
    56 
    6 using namespace std; 
     7static inline std::string stringXtoStd(XString _str) 
     8{ 
     9   char * const temp = new char[_str.len+1](); 
     10   memset(temp, '\0', _str.len+1); 
     11   memcpy(temp, _str.str, _str.len); 
     12   std::string _retstr(temp); 
     13   size_t d = _retstr.find_first_not_of(' '); 
     14   size_t f = _retstr.find_last_not_of (' '); 
    715 
    8 extern "C" void main_c_(void) ; 
    9  
    10 // Cette fonction remplit un tableau à N dimensions de valeurs de type T (T = double ou float) de la maniÚre suivante : 
    11 // 0.0 1.0 2.0 3.0, puis 0.1 1.1 2.1 3.1 ... au second appel de la fonction, etc. 
    12 template <class T> 
    13    static void updateDataTest(T begin, T end) 
    14 { 
    15    static int called = 0; int i = 0; 
    16    for (T it = begin; it != end; it++, i++) 
    17       (*it) = i + called * 0.01; 
    18    called++; 
     16   delete[] temp; 
     17   return (_retstr.substr(d, f-d+1)); 
    1918} 
    2019 
    21 void main_c_ (void) 
     20static inline XString stringXtoStd(const std::string& _str) 
    2221{ 
    23    try 
    24    { 
    25       Array<double, 3> arr(100, 100, 20) ; // Initialisation des données (les arguments en fonction des dimensions). 
    26       string file("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml"); // Le fichier de définition. 
    27       ifstream istr( file.c_str() , ifstream::in ); 
     22   XString _retstr = {new char[_str.size()](), _str.size()}; 
     23   memcpy(_retstr.str, _str.c_str(), _str.size()); 
     24   return (_retstr); 
     25} 
    2826 
    29       // On commence la lecture du flux de donnée xml qui doit posséder pour racine un unique noeud nommé "simulation". 
    30       XMLNode node = XMLNode::CreateNode(istr, Context::GetRootName()); 
     27/* ********************************************************** */ 
     28/*                      HANDLE INTERFACE                      */ 
     29/* ********************************************************** */ 
    3130 
    32       // On parse le fichier xml noeud par noeud (ie on construit dynamiquement notre arbre d'objets). 
     31void xios_handle_create_(XHandle * _ret, const XDType * const _dtype, const XString * const _id) 
     32{ 
     33   try { 
     34      switch(*_dtype) 
     35      { 
     36         /*ECONTEXT, 
     37      EAXIS, EDOMAIN, EFIELD, EFILE, EGRID, 
     38      GAXIS, GDOMAIN, GFIELD, GFILE, GGRID*/ 
     39         case (ECONTEXT): 
     40            //if (Context::) 
     41            break; 
     42 
     43         default : 
     44            break; 
     45      }; 
     46   } catch(const Exception &exc) 
     47   { ERROR(exc.displayText()); } 
     48} 
     49 
     50void xios_handle_verify_(XBool * _ret, const XHandle * const _hd) 
     51{ 
     52   try { 
     53 
     54   } catch(const Exception &exc) 
     55   { ERROR(exc.displayText()); } 
     56} 
     57 
     58void xios_handle_getType_(XDType * _ret, const XHandle * const _hd) 
     59{ 
     60   try { 
     61 
     62   } catch(const Exception &exc) 
     63   { ERROR(exc.displayText()); } 
     64} 
     65 
     66void xios_handle_isType_(XBool * _ret, const XHandle * const _hd, const XDType  * const _dtype) 
     67{ 
     68   try { 
     69 
     70   } catch(const Exception &exc) 
     71   { ERROR(exc.displayText()); } 
     72} 
     73 
     74void xios_handle_isId_(XBool * _ret, const XHandle * const _hd, const XString * const _id) 
     75{ 
     76   try { 
     77 
     78   } catch(const Exception &exc) 
     79   { ERROR(exc.displayText()); } 
     80} 
     81 
     82void xios_handle_isGroup_(XBool * _ret, const XHandle * const _hd) 
     83{ 
     84   try { 
     85 
     86   } catch(const Exception &exc) 
     87   { ERROR(exc.displayText()); } 
     88} 
     89 
     90void xios_handle_isElement_(XBool * _ret, const XHandle * const _hd) 
     91{ 
     92   try { 
     93 
     94   } catch(const Exception &exc) 
     95   { ERROR(exc.displayText()); } 
     96} 
     97 
     98/* ********************************************************** */ 
     99/*                      XML INTERFACE                         */ 
     100/* ********************************************************** */ 
     101 
     102void xios_xml_parse_file_(XString _filename) 
     103{ 
     104   try { 
     105      std::string   __filename = stringXtoStd(_filename); 
     106      std::ifstream __istr( __filename.c_str() , std::ifstream::in ); 
     107 
     108      // On commence la lecture du flux de donnée xml. 
     109      XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName()); 
     110 
     111      // On parse le fichier xml noeud par noeud 
     112      // (ie on construit dynamiquement notre arbre d'objets). 
    33113      XMLParser::Parse(node); 
    34114 
    35       // On se place dans le contexte 'context1'. 
    36       Context::SetCurrentContext("context1", true) ; 
    37  
    38       std::cout << " * ----------- Début du traitement ----------- * " << std::endl << std::endl; 
    39  
    40       { 
    41          // On crée une instance de traitement de données dans le format NetCDF4. 
    42          DataTreatment dtreat; 
    43          dtreat.createDataOutput<NetCDF4DataOutput>(); 
    44  
    45          // Récupération du calendrier assossié au context courant et initialisation des delais d'écriture. 
    46          AbstractCalendar* calendar = dtreat.getCurrentContext()->getCalendar(); 
    47          calendar->setTimeStep(1 * Hour); 
    48  
    49          // Affichage de la date initiale (pour vérification). 
    50          std::cout << "Calendrier associé au contexte : " << *calendar << std::endl << std::endl; 
    51  
    52          for(int tcourant = 0, tfinal = 9; tcourant <= tfinal; tcourant++) 
    53          { /***************************** BOUCLE DE CALCUL *****************************/ 
    54  
    55             // Mise à jour de la date. 
    56             calendar->update(); 
    57  
    58             // Affichage des informations temporelles sur l'itération actuelle. 
    59             std::cout << "> Itération de calcul effectuée à la date t" << tcourant << " = " << calendar->getCurrentDate() 
    60                       << " (soit aprÚs " << (Time)calendar->getCurrentDate() << " sec.)." << std::endl; 
    61  
    62             // Mise à jour des données. 
    63             updateDataTest<Array<double, 3>::iterator>(arr.begin(), arr.end()); 
    64  
    65             // Ecriture des données. 
    66             dtreat.writeData<Array<double, 3> >("champ1", arr); 
    67          } 
    68  
    69          // Ecriture des avertissements obtenus jusqu'à présent. 
    70          std::cout << std::endl; ILogger::Flush(std::cout); 
    71  
    72          /*std::cout << " * ----------- Affichage de l'arborescence ----------- * " << std::endl << std::endl; 
    73  
    74          // On écrit l'arborescence résultante du traitement sur la sortie de log. 
    75          Context::ShowTree(std::clog); 
    76          std::cout << std::endl;*/ 
    77       } 
    78  
    79    } 
    80    catch(const Exception &exc) 
    81    {  // Pour tout type d'exceptions, on note les informations sur la sortie paramétrée. 
    82       ERROR(exc.displayText()); 
    83       // On retourne le code d'erreur en fin d'application pour traitements éventuels. 
    84       // return (exc.code()); 
    85    } 
    86  
    87    // return (0); 
     115   } catch(const Exception &exc) 
     116   { ERROR(exc.displayText()); } 
    88117} 
    89118 
     119void xios_xml_parse_string_(XString _xmlcontent) 
     120{ 
     121   try { 
     122      std::string        __xmlcontent = stringXtoStd(_xmlcontent); 
     123      std::istringstream __istr(__xmlcontent); 
    90124 
     125      // On commence la lecture du flux de donnée xml. 
     126      XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName()); 
     127 
     128      // On parse le fichier xml noeud par noeud 
     129      // (ie on construit dynamiquement notre arbre d'objets). 
     130      XMLParser::Parse(node); 
     131 
     132   } catch(const Exception &exc) 
     133   { ERROR(exc.displayText()); } 
     134} 
     135 
     136/* ********************************************************** */ 
     137/*                      MAIN ENTRY                            */ 
     138/* ********************************************************** */ 
     139 
     140void main_c_(void) // voué à disparaître 
     141{ /* Ne rien faire de plus */ } 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/calendar.hpp

    r130 r131  
    88      public : 
    99 
    10          JulianCalendar() : AbstractCalendar("Julian") 
    11          {/* Ne rien faire de plus */} 
    12          JulianCalendar(const string& _dateStr) : AbstractCalendar("Julian", _dateStr) 
    13          {/* Ne rien faire de plus */} 
     10         JulianCalendar(void) 
     11            : AbstractCalendar("Julian") 
     12         { /* Ne rien faire de plus */ } 
     13 
     14         JulianCalendar(const string& _dateStr) 
     15            : AbstractCalendar("Julian", _dateStr) 
     16         { /* Ne rien faire de plus */ } 
    1417 
    1518      public : /* virtual */ 
     
    1720         virtual int getYearTotalLength(const Date& _d) const 
    1821         { // Retourne la durée d'une année en seconde. 
    19             if (_d.getYear()%4 == 0) return (366 * 86400); 
     22            if (_d.getYear()%4 == 0) 
     23               return (366 * 86400); 
    2024            return (365 * 86400); 
    2125         } 
     
    2428         { // Retourne la durée du mois en jour. 
    2529            if (_d.getMonth() == 2) 
    26             { if (_d.getYear()%4 == 0) return 29; return 28; } 
     30            { 
     31               if (_d.getYear()%4 == 0) 
     32                  return 29; 
     33               return 28; 
     34            } 
    2735            return (AbstractCalendar::getMonthLength(_d)); 
    2836         } 
     
    3038         virtual string getType(void) const { return (string("julian")); } 
    3139 
    32          virtual ~JulianCalendar() 
     40         virtual ~JulianCalendar(void) 
    3341         {/* Ne rien faire de plus */} 
    3442 
     
    3947      public : 
    4048 
    41          GregorianCalendar() : AbstractCalendar("Gregorian") 
     49         GregorianCalendar(void) 
     50            : AbstractCalendar("Gregorian") 
    4251         {/* Ne rien faire de plus */} 
    43          GregorianCalendar(const string& dateStr) : AbstractCalendar("Gregorian", dateStr) 
     52 
     53         GregorianCalendar(const string& dateStr) 
     54            : AbstractCalendar("Gregorian", dateStr) 
    4455         {/* Ne rien faire de plus */} 
    4556 
     
    6778         virtual string getType(void) const { return (string("gregorian")); } 
    6879 
    69          virtual ~GregorianCalendar() 
     80         virtual ~GregorianCalendar(void) 
    7081         {/* Ne rien faire de plus */} 
    7182 
     
    7687      public : 
    7788 
    78          NoLeapCalendar() : AbstractCalendar("NoLeap") 
    79          {/* Ne rien faire de plus */} 
    80          NoLeapCalendar(const string& dateStr) : AbstractCalendar("NoLeap", dateStr) 
     89         NoLeapCalendar(void) 
     90            : AbstractCalendar("NoLeap") 
    8191         {/* Ne rien faire de plus */} 
    8292 
    83          virtual string getType(void) const { return (string("noleap")); } 
     93         NoLeapCalendar(const string& dateStr) 
     94            : AbstractCalendar("NoLeap", dateStr) 
     95         {/* Ne rien faire de plus */} 
    8496 
    85          virtual ~NoLeapCalendar() 
     97      public : /* virtual */ 
     98 
     99         virtual string getType(void) const 
     100         { return (string("noleap")); } 
     101 
     102         virtual ~NoLeapCalendar(void) 
    86103         {/* Ne rien faire de plus */} 
    87104 
     
    92109      public : 
    93110 
    94          AllLeapCalendar() : AbstractCalendar("AllLeap") 
     111         AllLeapCalendar(void) 
     112            : AbstractCalendar("AllLeap") 
    95113         {/* Ne rien faire de plus */} 
    96          AllLeapCalendar(const string& dateStr) : AbstractCalendar("AllLeap", dateStr) 
     114 
     115         AllLeapCalendar(const string& dateStr) 
     116            : AbstractCalendar("AllLeap", dateStr) 
    97117         {/* Ne rien faire de plus */} 
    98118 
     
    100120 
    101121         virtual int getMonthLength(const Date& d) const 
    102          { if (d.getMonth() == 2) return (29); return (AbstractCalendar::getMonthLength(d)); } 
     122         { 
     123            if (d.getMonth() == 2) 
     124               return (29); 
     125            return (AbstractCalendar::getMonthLength(d)); 
     126         } 
    103127 
    104          virtual int getYearTotalLength(const Date& d) const { return (366 * 86400); } 
     128         virtual int getYearTotalLength(const Date& d) const 
     129         { return (366 * 86400); } 
    105130 
    106          virtual string getType(void) const { return (string("allleap")); } 
     131         virtual string getType(void) const 
     132         { return (string("allleap")); } 
    107133 
    108          virtual ~AllLeapCalendar() 
     134         virtual ~AllLeapCalendar(void) 
    109135         {/* Ne rien faire de plus */} 
    110136 
     
    115141      public : 
    116142 
    117          D360Calendar() : AbstractCalendar("D360") 
     143         D360Calendar(void) 
     144            : AbstractCalendar("D360") 
    118145         {/* Ne rien faire de plus */} 
    119          D360Calendar(const string& dateStr) : AbstractCalendar("D360", dateStr) 
     146 
     147         D360Calendar(const string& dateStr) 
     148            : AbstractCalendar("D360", dateStr) 
    120149         {/* Ne rien faire de plus */} 
    121150 
    122151      public : /* virtual */ 
    123152 
    124          virtual int getYearTotalLength(const Date& d) const { return (360 * 86400); } 
    125          virtual int getMonthLength(const Date& d) const { return (30); } 
     153         virtual int getYearTotalLength(const Date& d) const 
     154         { return (360 * 86400); } 
    126155 
    127          virtual string getType(void) const { return (string("360d")); } 
     156         virtual int getMonthLength(const Date& d) const 
     157         { return (30); } 
    128158 
    129          virtual ~D360Calendar() 
     159         virtual string getType(void) const 
     160         { return (string("360d")); } 
     161 
     162         virtual ~D360Calendar(void) 
    130163         {/* Ne rien faire de plus */} 
    131164 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp

    r126 r131  
    1616      public : 
    1717 
    18          Mapped* operator[] (const Key& kval) throw (XMLIOUndefinedValueException) 
     18         Mapped* operator[] (const Key& kval) 
     19                     throw (XMLIOUndefinedValueException) 
    1920         { 
    2021            if(!hasMappedValue(kval)) 
    21                throw XMLIOSERVER::XMLIOUndefinedValueException("Appel de la méthode ExHashMap::operator["+kval+"] invalide."); 
     22               throw XMLIOSERVER::XMLIOUndefinedValueException 
     23                  ("Appel de la méthode ExHashMap::operator["+kval+"] invalide."); 
    2224            return (find(kval)->second); 
    2325         } 
    2426 
    25          bool hasMappedValue(const Key& kval) const {return (find(kval) != this->end());} 
     27         bool hasMappedValue(const Key& kval) const 
     28         { return (find(kval) != this->end()); } 
    2629 
    27          const vector<Mapped*>& getVector(void) const { return (this->_elemList); } 
     30         const vector<Mapped*>& getVector(void) const 
     31         { return (this->_elemList); } 
    2832 
    29          size_t getVectorSize(void) const {return (this->_elemList.size());} 
    30          size_t getSize(void) const {return (this->size());} 
     33         size_t getVectorSize(void) const 
     34         { return (this->_elemList.size()); } 
    3135 
    32          virtual ~ExHashMap() 
     36         size_t getSize(void) const 
     37         { return (this->size()); } 
     38 
     39      public : /* virtual */ 
     40 
     41         virtual ~ExHashMap(void) 
    3342         {/* Ne rien faire de plus */} 
    3443 
    3544      protected : 
    3645 
    37          ExHashMap() :  Poco::HashMap<Key, Mapped*, Poco::Hash<Key> >(), _elemList() 
     46         ExHashMap(void) 
     47            :  Poco::HashMap<Key, Mapped*, Poco::Hash<Key> >(), _elemList() 
    3848         {/* Ne rien faire de plus */} 
    3949 
     
    4656 
    4757         bool addValue(Mapped* const element) 
    48          {   this->_elemList.insert(this->_elemList.end(), element);   return (true);   } 
    49  
     58         { 
     59            this->_elemList.insert(this->_elemList.end(), element); 
     60            return (true); 
     61         } 
    5062 
    5163         void removeValue(const Key& kval) // Non testé 
    52          { Mapped* element = find(kval)->second; removeValue(element); this->erase(kval); } 
     64         { 
     65            Mapped* element = find(kval)->second; 
     66            this->removeValue(element); 
     67            this->erase(kval); 
     68         } 
    5369 
    5470         void removeValue(const Mapped* element) // Non testé 
     
    6278 
    6379      private : 
    64          vector<Mapped*> _elemList; 
     80 
     81         std::vector<Mapped*> _elemList; 
    6582 
    6683   }; // class ExHashMap 
     
    7491      public : 
    7592 
    76          StrHashMap() :  ExHashMap<string, Mapped, Poco::Hash<string> >() 
     93         StrHashMap(void) 
     94            :  ExHashMap<string, Mapped, Poco::Hash<string> >() 
    7795         {/* Ne rien faire de plus */} 
    7896 
    7997         bool addObject(Mapped* element) 
    80          { if(element->hasId()) return(addValue(element->getId(), element)); return(addValue(element)); } 
     98         { 
     99            if(element->hasId()) 
     100               return(addValue(element->getId(), element)); 
     101            return(addValue(element)); 
     102         } 
    81103 
    82104         bool removeObject(const string& kval) 
     
    86108         } 
    87109 
    88          virtual ~StrHashMap() 
     110      public : /* virtual */ 
     111 
     112         virtual ~StrHashMap(void) 
    89113         {/* Ne rien faire de plus */} 
    90114 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp

    r128 r131  
    99      public: 
    1010 
    11          Context(void) : ObjectTemplate<Context>(), ccalendar(NULL), 
    12             fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
     11         Context(void) 
     12            : ObjectTemplate<Context>(), ccalendar(NULL), 
     13              fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
    1314         {/* Ne rien faire de plus */} 
    1415 
    15          Context(const string& _id) : ObjectTemplate<Context>(_id), ccalendar(NULL), 
    16             fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
     16         Context(const string& _id) 
     17            : ObjectTemplate<Context>(_id), ccalendar(NULL), 
     18              fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
    1719         {/* Ne rien faire de plus */} 
    1820 
    19          FieldDefinition  * getFieldDefinition(void) const { return (this->fieldDef ); } 
    20          FileDefinition   * getFileDefinition(void)  const { return (this->fileDef  ); } 
    21          AxisDefinition   * getAxisDefinition(void)  const { return (this->axisDef  ); } 
    22          GridDefinition   * getGridDefinition(void)  const { return (this->gridDef  ); } 
     21         FieldDefinition  * getFieldDefinition (void) const { return (this->fieldDef ); } 
     22         FileDefinition   * getFileDefinition  (void) const { return (this->fileDef  ); } 
     23         AxisDefinition   * getAxisDefinition  (void) const { return (this->axisDef  ); } 
     24         GridDefinition   * getGridDefinition  (void) const { return (this->gridDef  ); } 
    2325         DomainDefinition * getDomainDefinition(void) const { return (this->domainDef); } 
    2426 
    2527         AbstractCalendar * getCalendar(void) const { return (this->ccalendar ); } 
     28 
    2629         AbstractCalendar * setCalendar(const string& _calName, const string& _dateStr) 
    2730         { 
     
    4245         } 
    4346 
    44          ~Context() 
     47         ~Context(void) 
    4548         { 
    4649            // Désallocation dynamique de mémoire pour chacun des groupes de définition si nécessaire. 
     
    7679                  { WARNING("Le noeud de définition possÚde un identifiant, ce dernier ne sera pas pris en compte lors du traitement !"); } 
    7780 
    78                   if (name.compare(FieldDefinition::GetDefName())  == 0) // Parsing pour la définition des champs. 
    79                   { fieldDef  = CreateInstanceAndParse<FieldDefinition >(_node, FieldDefinition::GetDefName().c_str()); continue; } 
    80  
    81                   if (name.compare(FileDefinition::GetDefName())  == 0) // Parsing pour la définition des fichiers. 
    82                   { fileDef   = CreateInstanceAndParse<FileDefinition  >(_node, FileDefinition  ::GetDefName().c_str()); continue; } 
    83  
    84                   if (name.compare(AxisDefinition::GetDefName())  == 0) // Parsing pour la définition des axes. 
    85                   { axisDef   = CreateInstanceAndParse<AxisDefinition  >(_node, AxisDefinition  ::GetDefName().c_str()); continue; } 
    86  
    87                   if (name.compare(GridDefinition::GetDefName())  == 0) // Parsing pour la définition des grilles. 
    88                   { gridDef   = CreateInstanceAndParse<GridDefinition  >(_node, GridDefinition  ::GetDefName().c_str()); continue; } 
    89  
    90                   if (name.compare(DomainDefinition::GetDefName()) == 0) // Parsing pour la définition des domaines. 
    91                   { domainDef = CreateInstanceAndParse<DomainDefinition>(_node, DomainDefinition::GetDefName().c_str()); continue; } 
     81                  if (name.compare(FieldDefinition::GetDefName())  == 0) 
     82                  // Parsing pour la définition des champs. 
     83                  { fieldDef  = CreateInstanceAndParse<FieldDefinition > 
     84                                 (_node, FieldDefinition::GetDefName().c_str()); continue; } 
     85 
     86                  if (name.compare(FileDefinition::GetDefName())  == 0) 
     87                  // Parsing pour la définition des fichiers. 
     88                  { fileDef   = CreateInstanceAndParse<FileDefinition  > 
     89                                 (_node, FileDefinition  ::GetDefName().c_str()); continue; } 
     90 
     91                  if (name.compare(AxisDefinition::GetDefName())  == 0) 
     92                  // Parsing pour la définition des axes. 
     93                  { axisDef   = CreateInstanceAndParse<AxisDefinition  > 
     94                                 (_node, AxisDefinition  ::GetDefName().c_str()); continue; } 
     95 
     96                  if (name.compare(GridDefinition::GetDefName())  == 0) 
     97                  // Parsing pour la définition des grilles. 
     98                  { gridDef   = CreateInstanceAndParse<GridDefinition  > 
     99                                 (_node, GridDefinition  ::GetDefName().c_str()); continue; } 
     100 
     101                  if (name.compare(DomainDefinition::GetDefName()) == 0) 
     102                  // Parsing pour la définition des domaines. 
     103                  { domainDef = CreateInstanceAndParse<DomainDefinition> 
     104                                 (_node, DomainDefinition::GetDefName().c_str()); continue; } 
    92105 
    93106                  WARNING("La définition est invalide, seuls les champs, grilles, axes et fichiers peuvent être définis !"); 
     
    134147 
    135148            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    136             for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     149            Poco::HashMap<string, StrHashMap<Context> >::Iterator it; 
     150 
     151            for (it = AllListContext.begin(); it != AllListContext.end(); it++) 
    137152               // On sort chacun des contextes successivement. 
    138153            { 
     
    149164         { 
    150165            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    151             for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     166            Poco::HashMap<string, StrHashMap<Context> >::Iterator it; 
     167 
     168            for (it = AllListContext.begin(); it != AllListContext.end(); it++) 
    152169            { Context::SetCurrentContext((*it).first); delete ((*it).second)[(*it).first]; } 
    153170         } 
     
    157174         { 
    158175            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    159             for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     176            Poco::HashMap<string, StrHashMap<Context> >::Iterator it; 
     177 
     178            for ( it = AllListContext.begin(); it != AllListContext.end(); it++) 
    160179            { 
    161180               // Résolution des héritages descendants (càd des héritages de groupes) pour chacun des contextes. 
     
    164183 
    165184               // Résolution des héritages par référence au niveau des fichiers. 
    166                const std::vector<CFile*>& allFiles = CFile::GetCurrentListObject().getVector(); 
    167                for (unsigned int i = 0; i < allFiles.size(); i++) allFiles[i]->solveFieldRefInheritance(); 
     185               const std::vector<CFile*>& allFiles = 
     186                                 CFile::GetCurrentListObject().getVector(); 
     187 
     188               for (unsigned int i = 0; i < allFiles.size(); i++) 
     189                  allFiles[i]->solveFieldRefInheritance(); 
    168190            } 
    169191         } 
     
    180202         } 
    181203 
     204         static const std::stack<string>& GetStackContextId(void) 
     205         { return (Context::Stid); } 
     206 
    182207         static Context* GetCurrentContext(void) 
    183208         { return (Context::GetObject(Context::GetCurrentContextId())); } 
     
    208233      private: 
    209234 
    210          static stack<string> Stid; 
     235         static std::stack<string> Stid; 
    211236 
    212237         AbstractCalendar * ccalendar; 
     
    220245   }; //class Context 
    221246 
    222    stack<string> Context::Stid; 
     247   std::stack<string> Context::Stid; 
    223248 
    224249}// namespace XMLIOSERVER 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/data_treatment.hpp

    r130 r131  
    88      public : 
    99 
    10          DataTreatment(Context* const _ctxt       = Context::GetCurrentContext(), 
     10         DataTreatment(Context* const _ctxt       =  Context::GetCurrentContext(), 
    1111                      const AbstractCalendar& cal = *Context::GetCurrentContext()->getCalendar()) 
    1212            : enabledFiles(), currentContext(_ctxt) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/date.hpp

    r130 r131  
    99 
    1010         Date(const AbstractCalendar& cal, 
    11               int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) 
     11              int yr = 0, int mth = 1, int d   = 1, 
     12              int hr = 0, int min = 0, int sec = 0) 
    1213                  : relCalendar(cal) 
    1314                  , year(yr), month(mth), day(d), hour(hr), minute(min), second(sec) 
     
    1718         } 
    1819 
    19          Date(const Date& d) : relCalendar(d.getRelCalendar()) 
    20             , year(d.year), month(d.month), day(d.day), hour(d.hour), minute(d.minute), second(d.second) 
     20         Date(const Date& d) 
     21            : relCalendar(d.getRelCalendar()), 
     22              year(d.year), month(d.month)  , day(d.day), 
     23              hour(d.hour), minute(d.minute), second(d.second) 
    2124         { 
    2225            if(!this->checkDate()) 
     
    2730         { 
    2831            // relCalendar = d.getRelCalendar(); << inutile si fonction bien utilisée 
    29             year = d.year; month = d.month; day = d.day; 
     32            year = d.year; month  = d.month ; day    = d.day; 
    3033            hour = d.hour; minute = d.minute; second = d.second; 
    3134            return (*this); 
    3235         } 
    3336 
    34          operator Time(void);  // Retourne le nombre de secondes écoulées depuis la date initiale définie dans le calendrier. 
    35          bool checkDate(void); // Vérifie la validité de la date. 
     37         inline operator Time(void);  // Retourne le nombre de secondes écoulées depuis la date initiale définie dans le calendrier. 
     38         inline bool checkDate(void); // Vérifie la validité de la date. 
    3639 
    3740         std::string toString(void) const 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp

    r128 r131  
    1111      public:                                         \ 
    1212                                                      \ 
    13          virtual string       getName(void) const { return (#att_name) ;}           \ 
     13         virtual std::string  getName(void) const { return (#att_name) ;}           \ 
    1414         virtual const char * getType(void) const { return (#att_type) ;}           \ 
    1515                                                                                    \ 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/duration.hpp

    r130 r131  
    7070         bool isNone(void) const 
    7171         { 
    72             if ((year==0) && (month ==0) && (day   ==0) && 
    73                 (hour==0) && (minute==0) && (second==0)) 
     72            if ((year == 0) && (month  == 0) && (day    == 0) && 
     73                (hour == 0) && (minute == 0) && (second == 0)) 
    7474               return (true); 
    7575            return (false); 
     
    8181         { 
    8282            const struct _duration& own = *this; 
    83             std::ostringstream oss; oss << own; return (oss.str()); 
     83            std::ostringstream oss; oss << own; 
     84            return (oss.str()); 
    8485         } 
    8586 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp

    r115 r131  
    1414      public : 
    1515 
    16          XMLIOException(int _code): Exception(_code) 
    17          { /* Ne rien faire de plus */ } 
    18          XMLIOException(const std::string& _msg, int _code): Exception(_msg, _code) 
    19          { /* Ne rien faire de plus */ } 
    20          XMLIOException(const std::string& _msg, const std::string& _arg, int _code): Exception(_msg, _arg, _code) 
    21          { /* Ne rien faire de plus */ } 
    22          XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code): Exception(_msg, _exc, _code) 
     16         XMLIOException(int _code) 
     17            : Exception(_code) 
    2318         { /* Ne rien faire de plus */ } 
    2419 
     20         XMLIOException(const std::string& _msg, int _code) 
     21            : Exception(_msg, _code) 
     22         { /* Ne rien faire de plus */ } 
    2523 
    26          XMLIOException(const XMLIOException& _exc): Exception(_exc) 
     24         XMLIOException(const std::string& _msg, const std::string& _arg, int _code) 
     25            : Exception(_msg, _arg, _code) 
     26         { /* Ne rien faire de plus */ } 
     27 
     28         XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code) 
     29            : Exception(_msg, _exc, _code) 
     30         { /* Ne rien faire de plus */ } 
     31 
     32         XMLIOException(const XMLIOException& _exc) 
     33            : Exception(_exc) 
    2734         { /* Ne rien faire de plus */ } 
    2835 
     
    4451   { 
    4552      public : 
    46          XMLIOUndefinedValueException(const std::string& _msg): XMLIOException(_msg, 1001) {} 
    47          const char* name(void) const throw() { return ("XMLIO>UndefinedValueException"); } 
     53         XMLIOUndefinedValueException(const std::string& _msg) 
     54            : XMLIOException(_msg, 1001) 
     55         { /* Ne rien faire de plus */ } 
     56 
     57         const char* name(void) const throw() 
     58         { return ("XMLIO>UndefinedValueException"); } 
    4859 
    4960   }; //class XMLIOUndefinedException 
     
    5263   { 
    5364      public : 
    54          XMLIOStreamException(const std::string& _msg): XMLIOException(_msg, 1002) {} 
    55          const char* name(void) const throw() { return ("XMLIO>StreamException"); } 
     65         XMLIOStreamException(const std::string& _msg) 
     66            : XMLIOException(_msg, 1002) 
     67         { /* Ne rien faire de plus */ } 
     68 
     69         const char* name(void) const throw() 
     70         { return ("XMLIO>StreamException"); } 
    5671 
    5772   }; //class XMLIOStreamException 
     
    6075   { 
    6176      public : 
    62          XMLParsingException(const std::string& _msg): XMLIOException(_msg, 1003) {} 
    63          const char* name(void) const throw() { return ("XMLIO>XMLParsingException"); } 
     77         XMLParsingException(const std::string& _msg) 
     78            : XMLIOException(_msg, 1003) 
     79         { /* Ne rien faire de plus */ } 
     80 
     81         const char* name(void) const throw() 
     82         { return ("XMLIO>XMLParsingException"); } 
    6483 
    6584   }; //class XMLParsingException 
     
    6887   { 
    6988      public : 
    70          XMLIOIncompatibleTypeException(const std::string& _msg): XMLIOException(_msg, 1003) {} 
    71          const char* name(void) const throw() { return ("XMLIO>XMLIOIncompatibeTypeException"); } 
     89         XMLIOIncompatibleTypeException(const std::string& _msg) 
     90            : XMLIOException(_msg, 1003) 
     91         { /* Ne rien faire de plus */ } 
     92 
     93         const char* name(void) const throw() 
     94         { return ("XMLIO>XMLIOIncompatibeTypeException"); } 
    7295 
    7396   }; //class XMLIOIncompatibleTypeException 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field.hpp

    r130 r131  
    1414      public: 
    1515 
    16          CField(void) : ObjectTemplate<CField>(), FieldAttribut(), lastStored(NULL), grid(NULL), file(NULL) 
    17          {/* Ne rien faire de plus */} 
    18          CField(const string& _id) : ObjectTemplate<CField>(_id), FieldAttribut(), lastStored(NULL), grid(NULL), file(NULL) 
    19          {/* Ne rien faire de plus */} 
     16         CField(void) 
     17            : ObjectTemplate<CField>(), FieldAttribut(), 
     18              lastStored(NULL), grid(NULL), file(NULL) 
     19         { /* Ne rien faire de plus */ } 
     20 
     21         CField(const string& _id) 
     22            : ObjectTemplate<CField>(_id), FieldAttribut(), 
     23              lastStored(NULL), grid(NULL), file(NULL) 
     24         { /* Ne rien faire de plus */ } 
    2025 
    2126         inline void solveGridRef(void) ; 
    2227 
    23          const CGrid* getGrid(void) const { return (grid); } 
     28         const CGrid* getGrid   (void) const { return (grid); } 
     29         const CFile* getRelFile(void) const { return (file); } 
    2430         const Array<double, 1>& getData(void) const { return (data); } 
     31         void setRelFile(CFile* const _file) { file = _file; } 
    2532 
    2633         void initLastStoredDate(const Date& _newlastStored) 
    27          { if(lastStored == NULL) lastStored = new Date(_newlastStored); }; 
     34         { 
     35            if(lastStored == NULL) 
     36               lastStored = new Date(_newlastStored); 
     37         }; 
    2838 
    2939         bool isStorable(const Date& currDate) 
     
    4454         void solveOperation(void) 
    4555         { 
    46             FieldOperation*   fope = this->operation.getValue(); 
    47             Duration      * ffope = this->freq_op.getValue(); 
     56            FieldOperation* const  fope = this->operation.getValue(); 
     57            Duration      * const ffope = this->freq_op.getValue(); 
    4858 
    4959            if (fope != NULL) 
     
    5868            } 
    5969 
    60             // Si la fréquence d'opération n'est pas définie, on l'initialise à 0s. 
    61             // Une fréquence à 0s signifie que l'opération se fera à chaque écriture de données depuis la simulation. 
    6270            if (ffope == NULL) 
    6371               this->freq_op.setValue(NoneDu); 
    64  
    6572            this->operation.getValue()->setFreqOp(this->freq_op); 
    6673         } 
    67  
    68          const CFile* getRelFile(void) const { return (file); } 
    69          void setRelFile(CFile* _file) { file = _file; } 
    7074 
    7175      public: /* virtual */ 
     
    8589      public: /* static */ 
    8690 
    87          static string GetName(void) { return ("field"); } 
    88          static string GetDefName(void)  { return (CField::GetName()); } 
     91         static string GetName   (void) { return ("field"); } 
     92         static string GetDefName(void) { return (CField::GetName()); } 
    8993 
    9094      private : 
    9195 
    9296         Date* lastStored; 
    93  
    9497         CGrid* grid ; 
    9598         CFile* file; 
    96  
    97          Array<double, 1>  data; 
     99         Array<double, 1> data; 
    98100 
    99101   }; // class CField 
     
    110112   { 
    111113      if (!_ori->hasId()) 
    112          throw (new XMLIOUndefinedValueException("Impossible de créer une référence à un élément sans identifiant !")); 
     114         throw (new XMLIOUndefinedValueException 
     115            ("Impossible de créer une référence à un élément sans identifiant !")); 
    113116 
    114117      CField& obj = *ObjectTemplate<CField>::CreateObject(); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90

    r127 r131  
    1 PROGRAM main 
     1! --------------------------------------------------- ! 
     2! ------------- XMLIO SERVER MAIN TEST  ------------- ! 
     3! --------------------------------------------------- ! 
     4 
     5MODULE XML 
     6   INTERFACE 
     7 
     8      SUBROUTINE xios_xml_Parse_File(filename) 
     9         CHARACTER*(*), INTENT(IN) :: filename 
     10      END SUBROUTINE xios_xml_Parse_File 
     11 
     12      SUBROUTINE xios_xml_Parse_String(xmlcontent) 
     13         CHARACTER*(*), INTENT(IN) :: xmlcontent 
     14      END SUBROUTINE xios_xml_Parse_String 
     15 
     16   END INTERFACE 
     17END MODULE XML 
     18 
     19PROGRAM MAIN 
     20   USE XML 
    221   IMPLICIT NONE 
    322 
    4    CALL main_c 
     23   CHARACTER(LEN = 100):: filename 
    524 
    6 END PROGRAM main 
     25   filename = "/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml" 
     26 
     27   CALL xios_xml_Parse_File(filename) 
     28 
     29END PROGRAM MAIN 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio.hpp

    r128 r131  
    55#include <utility> 
    66#include <string> 
     7#include <cstring> 
    78#include <cmath> 
    89 
Note: See TracChangeset for help on using the changeset viewer.