Changeset 126


Ignore:
Timestamp:
10/07/10 10:29:38 (14 years ago)
Author:
hozdoba
Message:

Amélioration de quelques portions de code.
Ajout de contructeurs par copie.

Location:
XMLIO_V2/dev/dev_rv/src/XMLIO
Files:
1 added
2 deleted
21 edited

Legend:

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

    r125 r126  
    1010      public : 
    1111 
    12          NetCDF4DataOutput(CFile* const _file) : AbstractDataOutput(_file), dataFile(NULL) 
     12         NetCDF4DataOutput(CFile* const _file) 
     13            : AbstractDataOutput(_file), dataFile(NULL) 
    1314         { /* Ne rien faire de plus */ } 
    1415 
    1516         const NcFile* getDataFile(void) const { return (dataFile); } 
     17 
     18         void writeVarData(const string& id, const Array<float, 1>& vdata) 
     19         { 
     20            //if (!latVar->put(lats, NLAT)) 
     21            //   return NC_ERR; 
     22         } 
    1623 
    1724         virtual ~NetCDF4DataOutput() 
     
    2633            const std::set<const CAxis*>  saxis = this->getRelFile()->getEnabledAxis(); 
    2734 
    28             // std::cout << "Nombre de domaines disponibles pour le fichier : " << sdom.size() << std::endl; 
    29             // std::cout << "Nombre d'axes disponibles pour le fichier : " << saxis.size() << std::endl; 
     35            // std::cout << "Nombre de domaines disponibles pour le fichier : " << sdom.size()  << std::endl; 
     36            // std::cout << "Nombre d'axes disponibles pour le fichier : "      << saxis.size() << std::endl; 
    3037 
    3138            std::set<const CDomain*>::const_iterator itt; 
     39            std::set<const CAxis*>::const_iterator it; 
     40 
    3241            for ( itt = sdom.begin() ; itt != sdom.end(); itt++ ) 
    3342            { 
     
    3948            } 
    4049 
    41             std::set<const CAxis*>::const_iterator it; 
    4250            for ( it = saxis.begin() ; it != saxis.end(); it++ ) 
    4351            { 
     
    5462         std::string getTimeStamp(void) 
    5563         { 
    56               time_t rawtime; 
    57               struct tm * timeinfo = NULL; 
    58               char buffer [100]; 
    59  
    60               time ( &rawtime ); 
    61               timeinfo = localtime ( &rawtime ); 
    62  
    63               strftime (buffer, 100, "%Y-%b-%d %H:%M:%S %Z", timeinfo); 
    64  
    65               return (string(buffer)); 
    66          } 
     64            const int buffer_size = 100; 
     65            time_t rawtime; 
     66            struct tm * timeinfo = NULL; 
     67            char buffer [buffer_size]; 
     68 
     69            time ( &rawtime ); 
     70            timeinfo = localtime ( &rawtime ); 
     71            strftime (buffer, buffer_size, "%Y-%b-%d %H:%M:%S %Z", timeinfo); 
     72 
     73            return (string(buffer)); 
     74         } 
     75 
     76         void writeCoords(const string& id, const Array<float, 1>& cdata) 
     77         { 
     78            NcVar *cVar = dataFile->get_var(id.c_str()); 
     79 
     80            if (!cVar->put(cdata.dataFirst(), cdata.size())) 
     81               throw XMLIOUndefinedValueException("Impossible d'écrire les valeurs de coordonnées "+ id +" !"); 
     82         } 
     83 
     84      protected : /* virtual */ 
    6785 
    6886         virtual void initFile(void) 
    6987         { 
    70             string filename = getFileName(); 
     88            string filename = this->getFileName(); 
    7189 
    7290            // Création du fichier ou remplacement si celui-ci existe déjà. 
     
    150168 
    151169               hm["axis"] = "Z" ; 
    152                if ((*it)->name.hasValue())        hm["standard_name"] = (*it)->name ; 
    153                if ((*it)->unit.hasValue())        hm["units"]         = (*it)->unit; 
    154                if ((*it)->description.hasValue()) hm["long_name"]     = (*it)->description ; 
     170               if ((*it)->standard_name.hasValue())hm["standard_name"] = (*it)->standard_name ; 
     171               if ((*it)->long_name.hasValue())    hm["long_name"]     = (*it)->long_name ; 
     172               if ((*it)->unit.hasValue())         hm["units"]         = (*it)->unit; 
    155173               addStringAttributesToVar(othvar, hm); 
    156174               hm.clear(); 
     
    160178         virtual void setVars(void) 
    161179         { 
    162             NcType tvar; 
     180            NcType tvar = ncFloat; 
    163181            NcVar *var  = NULL; 
    164182            Poco::HashMap<string, string> hm; 
     
    167185 
    168186            std::vector<CField*>::const_iterator it; 
     187 
    169188            for ( it = enabledFields.begin() ; it != enabledFields.end(); it++ ) 
    170189            { 
     
    209228                  { 
    210229                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    211                         dataFile->get_dim("time"), dataFile->get_dim(lonid.c_str()), dataFile->get_dim(latid.c_str())))) 
     230                        dataFile->get_dim("time"), dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
    212231                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    213232                  } 
     
    215234                  { 
    216235                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    217                         dataFile->get_dim("time"), dataFile->get_dim(lonid.c_str()), dataFile->get_dim(latid.c_str()), 
    218                         dataFile->get_dim(axisid.c_str())))) 
     236                        dataFile->get_dim("time"), dataFile->get_dim(axisid.c_str()), 
     237                        dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
    219238                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    220239                  } 
     
    225244                  { 
    226245                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    227                         dataFile->get_dim(lonid.c_str()), dataFile->get_dim(latid.c_str())))) 
     246                        dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
    228247                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    229248                  } 
    230249                  else // 3D spatio sans temps 
    231250                  { 
    232                      if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    233                         dataFile->get_dim(lonid.c_str()), dataFile->get_dim(latid.c_str()), 
    234                         dataFile->get_dim(axisid.c_str())))) 
    235                         throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    236                   } 
    237                } 
    238  
    239                if (field->name.hasValue())        hm["standard_name"] = field->name ; 
    240                if (field->unit.hasValue())        hm["units"]         = field->unit; 
    241                if (field->description.hasValue()) hm["long_name"]     = field->description ; 
     251                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, dataFile->get_dim(axisid.c_str()), 
     252                        dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
     253                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
     254                  } 
     255               } 
     256 
     257               if (field->standard_name.hasValue())hm["standard_name"] = field->standard_name ; 
     258               if (field->long_name.hasValue())    hm["long_name"]     = field->long_name ; 
     259               if (field->unit.hasValue())         hm["units"]         = field->unit; 
    242260               addStringAttributesToVar(var, hm); 
    243261               hm.clear(); 
     
    245263         } 
    246264 
    247          virtual void writeCoords(const string& id, const Array<float, 1>& cdata) 
    248          { 
    249             //if (!latVar->put(lats, NLAT)) 
    250             //   return NC_ERR; 
    251          } 
    252  
    253          virtual void writeVarData(const string& id, const Array<float, 1>& vdata) 
    254          { 
    255             //if (!latVar->put(lats, NLAT)) 
    256             //   return NC_ERR; 
    257          } 
    258  
    259265      private : 
    260266 
     
    262268         { 
    263269            Poco::HashMap<string, string>::ConstIterator it; 
     270 
    264271            for ( it = attr.begin() ; it != attr.end(); it++ ) 
    265272               if (!var->add_att((*it).first.c_str(), (*it).second.c_str())) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_calendar.hpp

    r124 r126  
    5757         { string value = getMonthName(_mi); value.resize(3); return (value); } 
    5858 
    59          virtual ~AbstractCalendar() 
    60          {/* Ne rien faire de plus */} 
     59         virtual ~AbstractCalendar(void) 
     60         { /* Ne rien faire de plus */ } 
    6161 
    6262      protected : 
    6363 
    64          AbstractCalendar() 
     64         AbstractCalendar(void) 
    6565            : AbstractObject(), initDate(*this), currentDate(initDate), tempo(Hour) 
    66          {/* Ne rien faire de plus */} 
     66         { /* Ne rien faire de plus */ } 
    6767 
    68          AbstractCalendar(const string& _id, int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) 
     68         AbstractCalendar(const string& _id, 
     69                          int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) 
    6970            : AbstractObject(_id), initDate(*this, yr, mth, d, hr, min, sec), currentDate(initDate), tempo(Hour) 
    70          {/* Ne rien faire de plus */} 
     71         { /* Ne rien faire de plus */ } 
    7172 
    7273         AbstractCalendar(const string& _id, const string& dateStr) 
    7374            : AbstractObject(_id), initDate(Date::FromString(dateStr, *this)), currentDate(initDate), tempo(Hour) 
    74          {/* Ne rien faire de plus */} 
     75         { /* Ne rien faire de plus */ } 
    7576 
    7677      private : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_data_output.hpp

    r125 r126  
    1616         { 
    1717            // Création du fichier de sortie. 
    18             initFile(); 
     18            this->initFile(); 
    1919            // Définition des dimensions. 
    20             setDims(); 
     20            this->setDims(); 
    2121            // Définition des coordonnées. 
    22             setCoords(); 
     22            this->setCoords(); 
    2323            // Définitions des variables. 
    24             setVars(); 
     24            this->setVars(); 
    2525         } 
    2626 
     
    3232         AbstractDataOutput(CFile* const _file): file(_file) 
    3333         { /* Ne rien faire de plus */ } 
    34  
    3534 
    3635         virtual void initFile (void) = 0; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_object.hpp

    r120 r126  
    1515         } 
    1616 
    17          bool hasId(void) const { return(IdDefined); } 
     17         bool hasId(void) const { return (IdDefined); } 
     18 
    1819         void resetId(void) { IdDefined = false ;} 
    19          void setId(const std::string& _id) { id = _id ; IdDefined = true ;} 
     20 
     21         void setId(const std::string& _id) 
     22         { id = _id ; IdDefined = true ; } 
    2023 
    2124         bool operator==(const AbstractObject& other) const 
     
    2629         } 
    2730 
     31         bool operator!=(const AbstractObject& other) const 
     32         { return (!(*this == other)); } 
     33 
    2834         std::string printId(void) const 
    29          { if(hasId()) return (" id=\""+getId()+"\""); return (""); } 
     35         { 
     36            if(this->hasId()) 
     37               return (string(" id=\""+getId()+"\"")); 
     38            return (string("")); 
     39         } 
    3040 
    3141         virtual ~AbstractObject(void) 
    32          {/* Ne rien faire de plus */} 
     42         { /* Ne rien faire de plus */ } 
    3343 
    3444      protected : 
    3545 
    36          AbstractObject(void) : IdDefined(false) 
    37          {/* Ne rien faire de plus */} 
     46         AbstractObject(void) 
     47            : IdDefined(false) // Sans identifiant. 
     48         { /* Ne rien faire de plus */ } 
    3849 
    39          AbstractObject(const std::string& _id) : id(_id), IdDefined(true) 
    40          {/* Ne rien faire de plus */} 
     50         AbstractObject(const std::string& _id) 
     51            : id(_id), IdDefined(true) 
     52         { /* Ne rien faire de plus */ } 
     53 
     54         AbstractObject(const AbstractObject& _ao) 
     55            : id(_ao.id), IdDefined(_ao.IdDefined) 
     56         { /* Ne rien faire de plus */ } 
    4157 
    4258      private : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp

    r122 r126  
    1515   { 
    1616      public : 
     17 
     18         Attribut(void) 
     19            : BaseAttribut(), _hasValue(false) 
     20         { /* Ne rien faire de plus */ } 
     21 
     22         Attribut(const Ctype& value_) 
     23            : BaseAttribut(), _hasValue(true), value(value_) 
     24         { /* Ne rien faire de plus */ } 
     25 
     26         Attribut(const Attribut& attr) 
     27            : BaseAttribut(attr), _hasValue(attr._hasValue) 
     28         { if (_hasValue) value = attr.value ; } 
     29 
     30         Attribut& operator = (const Attribut & attr) 
     31         { 
     32            _hasValue = attr._hasValue ; 
     33            if (_hasValue) this->setValue(attr.value) ; 
     34            return (*this) ; 
     35         } 
     36 
    1737         operator Ctype() const 
    1838         { 
     
    2141         } 
    2242 
    23          Ctype* operator ->() { return (&value) ; } 
    24          Ctype& operator *() { return (value) ; } 
     43         Ctype* operator ->(void) { return (&value); } 
     44         Ctype& operator * (void) { return (value) ; } 
    2545 
    26          virtual bool hasValue() const { return (_hasValue); } 
     46      public : /* virtual */ 
     47 
     48         virtual bool hasValue(void) const { return (_hasValue); } 
    2749         virtual const char * getType(void) const = 0; 
    28  
    29          Attribut(void) : _hasValue(false) {} ; 
    30          Attribut(const Ctype& value_) : _hasValue(true), value(value_) {} ; 
    31  
    32          Attribut(const Attribut& attr) : _hasValue(attr._hasValue) 
    33          {  if (_hasValue) value = attr.value ; } 
    34  
    35          Attribut& operator = (const Attribut & attr) 
    36          { 
    37             _hasValue = attr._hasValue ; 
    38             if (_hasValue) setValue(attr.value) ; 
    39             return (*this) ; 
    40          } 
    4150 
    4251         virtual void setFromString(const std::string& str) 
     
    5059         { value = ((Attribut*)_ba) -> value; _hasValue = true; } 
    5160 
    52          virtual ostream& print(ostream & o) const 
    53          { if (_hasValue) o << " " << getName() << "=\"" << boolalpha << value << "\"" ; return o ; } 
     61         virtual ostream& print(std::ostream & _out) const 
     62         { if (_hasValue) _out << " " << getName() << "=\"" << boolalpha << value << "\"" ; return (_out) ; } 
    5463 
    5564         virtual void setValue(const Ctype & value_) 
     
    6271         } 
    6372 
     73         virtual ~Attribut() 
     74         { /* Ne rien faire de plus */ } 
     75 
    6476      private : 
    6577 
     
    6981   }; // class Attribut 
    7082 
    71 #define SET_ARRAY_DIM(type,dim)                                              \ 
     83#define SET_ARRAY_DIM(type, dim)                                             \ 
    7284   template<>                                                                \ 
    7385      void Attribut<Array<type,dim> >::setValue (const Array<type,dim>& val) \ 
     
    88100   { 
    89101      if (_hasValue) o << " " << getName() << "=\"" << value(0); 
    90       for (int i = 1; i < value.size(); i++) { o << "," << value(i); } 
     102      /*for (int i = 1; i < value.size(); i++) 
     103      { o << "," << value(i); }*/ 
     104      o << value(0) << "..." << value(value.size()-1); 
    91105      o << "\"" ; 
    92106      return (o) ; 
     
    94108 
    95109   template <> 
    96       void Attribut<Array<double,1> >::setFromString(const std::string& str) 
     110      void Attribut<Array<double,1> >::setFromString(const std::string& _str) 
    97111   { 
    98       istringstream iss(str) ; 
    99       char c = '\0'; double d = 0.; 
    100       vector<double> vect; 
    101       Array<double, 1> arr; 
     112      istringstream iss(_str) ; 
     113      char c = '\0'; int size = 0; 
     114      double d = 0.,valsup = 0., valinf = 0.; 
     115      std::vector<double> vect; Array<double, 1> arr; 
    102116 
    103117      iss >> d; vect.push_back(d); 
    104       while(!iss.eof ()) { iss >> c >> d; vect.push_back(d); } 
     118      if (!iss.eof ()) 
     119      { 
     120         iss >> c; 
     121         switch (c) 
     122         { 
     123            case ',' : // Le tableau est généré valeur par valeur. 
     124               iss.unget(); 
     125               while(!iss.eof ()) 
     126               { // On récupÚre chacune des valeurs une par une jusqu'à ce que le buffer soit vide. 
     127                  iss >> c >> d; 
     128                  if (c != ',') 
     129                     throw XMLIOUndefinedValueException("Le tableau de valeur est mal défini !"); 
     130                  vect.push_back(d); 
     131               } 
     132               size = vect.size(); 
     133               break; 
     134            case '(' : // Le tableau est généré automatiquement. 
     135               if (!iss.eof ()) 
     136               { // on récupÚre la borne supérieure 
     137                  valinf = d; 
     138                  iss >> size >> c >> d; 
     139                  if ((c != ')') || (size <= 0)) 
     140                     throw XMLIOUndefinedValueException("Le tableau de valeur est mal défini !"); 
     141                  valsup = d; 
     142               } 
     143               d = (valsup - valinf) / (double)(size - 1); 
     144               for (int j = 1; j <= size; j++) 
     145                  vect.push_back(valinf + j * d); 
     146               break; 
     147            default : 
     148               throw XMLIOUndefinedValueException("Le tableau de valeur est mal défini !"); 
     149         } 
     150      } 
    105151 
    106       arr.resize(vect.size()); 
    107       for (unsigned int i = 0; i < vect.size(); i++) arr(i) = vect[i]; 
     152      arr.resize(size); 
     153      for (int i = 0; i < size; i++) 
     154         arr(i) = vect[i]; 
    108155 
    109156      this->setValue(arr); 
     
    114161   { 
    115162      istringstream iss(str) ; 
    116       bool val = (! iss.str().compare(string(".TRUE."))) ? true : false; 
     163      const bool val = (! iss.str().compare(string(".TRUE."))) ? true : false; 
    117164      this->setValue(val); 
    118165   } 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp

    r124 r126  
    1212      protected : 
    1313 
    14          AttributRegistrar():attrList() 
    15          {/* Ne rien faire de plus */} 
     14         AttributRegistrar(void) 
     15            : attrList() 
     16         { /* Ne rien faire de plus */ } 
    1617 
    17          void RegisterAttribut(BaseAttribut* attribut){ attrList.addObject(attribut); } 
     18         AttributRegistrar(const AttributRegistrar& _ar) 
     19            : attrList(_ar.attrList) 
     20         { /* Ne rien faire de plus */ } 
     21 
     22         void RegisterAttribut(BaseAttribut* const attribut){ attrList.addObject(attribut); } 
     23 
    1824         const StrHashMap<BaseAttribut>& getAttributList(void) const { return (attrList); } 
    19          size_t getNbAttributes() const {return (attrList.getSize()); } 
     25 
     26         size_t getNbAttributes(void) const { return (attrList.getSize()); } 
     27 
    2028         bool hasAttribut(const string& _id) const { return (attrList.hasMappedValue(_id)); } 
     29 
     30         const StrHashMap<BaseAttribut>& getAttrList(void) const { return (attrList); } 
    2131 
    2232         BaseAttribut* getAttribut(const string& _id) throw (XMLIOUndefinedValueException) { return (attrList[_id]); } 
     
    5565         { 
    5666            if (hasAttribut(att_name)) getAttribut(att_name)->setFromString(value); 
    57             else throw XMLIOUndefinedValueException("Impossible de trouver l'attribut nommé \"" + att_name +"\" dans la liste des attributs enregistrés !"); 
     67            else throw XMLIOUndefinedValueException("Impossible de trouver l'attribut nommé \"" 
     68               + att_name +"\" dans la liste des attributs enregistrés !"); 
    5869         } 
    5970 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/axis_attribut.hpp

    r120 r126  
    1010      public : 
    1111 
    12          DECLARE_ATTR(name, string) ; 
    13          DECLARE_ATTR(description, string) ; 
    14          DECLARE_ATTR(unit, string) ; 
    15          DECLARE_ATTR(size, int) ; 
    16          DECLARE_ATTR(value, Array(double,1)) ; 
     12         DECLARE_ATTR(name          , string) ; 
     13         DECLARE_ATTR(standard_name , string) ; 
     14         DECLARE_ATTR(long_name     , string) ; 
     15 
     16         DECLARE_ATTR(unit          , string) ; 
     17         DECLARE_ATTR(size          , int) ; 
     18         DECLARE_ATTR(value         , Array(double, 1)) ; 
    1719 
    1820         AxisAttribut(void) : AttributRegistrar() 
    19          { registerAllAttributes(); } 
     21         { this->registerAllAttributes(); } 
    2022 
    2123      private : 
     
    2426         { 
    2527            RegisterAttribut(&name) ; 
    26             RegisterAttribut(&description) ; 
     28            RegisterAttribut(&standard_name) ; 
     29            RegisterAttribut(&long_name) ; 
    2730            RegisterAttribut(&unit) ; 
    2831            RegisterAttribut(&size) ; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/base_attribut.hpp

    r122 r126  
    44using std::ostream; 
    55using namespace blitz ; 
    6  
    76 
    87using XMLIOSERVER::XMLIOIncompatibleTypeException; 
     
    1211   class BaseAttribut 
    1312   { 
    14       public: 
     13      protected : 
    1514 
    16          virtual string getName(void) const = 0  ; 
    17          virtual ostream & print(ostream& o) const = 0  ; 
     15         BaseAttribut(void) 
     16         { /* Ne rien faire de plus */ } 
    1817 
    19          friend ostream& operator <<(ostream& o,const BaseAttribut& attr) { return (attr.print(o)) ; } 
     18         BaseAttribut(const BaseAttribut& _ba) 
     19         { /* Ne rien faire de plus */ } 
     20 
     21      public : 
     22 
     23         friend ostream& operator <<(ostream& _out,const BaseAttribut& _attr) 
     24         { return (_attr.print(_out)) ; } 
    2025 
    2126         bool hasId(void) const { return (true); } 
    2227 
     28      public : /* virtual */ 
     29 
    2330         virtual string getId(void) const { return (getName()); } ; 
    2431 
    25          virtual void assignValue(const BaseAttribut*) = 0; 
    26          virtual void setFromString(const std::string&) = 0; 
    27          virtual bool hasValue() const = 0; 
     32         virtual bool      hasValue     (void)          const = 0; 
     33         virtual string    getName      (void)          const = 0; 
     34         virtual ostream & print        (ostream& o)    const = 0; 
     35         virtual void      assignValue  (const BaseAttribut*) = 0; 
     36         virtual void      setFromString(const std::string&)  = 0; 
    2837 
    29 #define  SETTER_AND_GETTER(TYPE) \ 
    30          virtual void setValue(const TYPE & value)          { error_set() ; }\ 
    31          virtual void setValue(const Array<TYPE,1>& value)  { error_set() ; }\ 
    32          virtual void setValue(const Array<TYPE,2>& value)  { error_set() ; }\ 
    33          virtual void setValue(const Array<TYPE,3>& value)  { error_set() ; }\ 
    34          virtual void setValue(const Array<TYPE,4>& value)  { error_set() ; }\ 
    35          virtual void getValue(TYPE & value)         const  { error_get() ; }\ 
    36          virtual void getValue(Array<TYPE,1>& value) const  { error_get() ; }\ 
    37          virtual void getValue(Array<TYPE,2>& value) const  { error_get() ; }\ 
    38          virtual void getValue(Array<TYPE,3>& value) const  { error_get() ; }\ 
    39          virtual void getValue(Array<TYPE,4>& value) const  { error_get() ; } 
     38#define  SETTER_AND_GETTER(TYPE)                                                     \ 
     39         virtual void setValue(const TYPE&)           { BaseAttribut::error_set() ; }\ 
     40         virtual void setValue(const Array<TYPE,1>&)  { BaseAttribut::error_set() ; }\ 
     41         virtual void setValue(const Array<TYPE,2>&)  { BaseAttribut::error_set() ; }\ 
     42         virtual void setValue(const Array<TYPE,3>&)  { BaseAttribut::error_set() ; }\ 
     43         virtual void setValue(const Array<TYPE,4>&)  { BaseAttribut::error_set() ; }\ 
     44         virtual void getValue(TYPE&)          const  { BaseAttribut::error_get() ; }\ 
     45         virtual void getValue(Array<TYPE,1>&) const  { BaseAttribut::error_get() ; }\ 
     46         virtual void getValue(Array<TYPE,2>&) const  { BaseAttribut::error_get() ; }\ 
     47         virtual void getValue(Array<TYPE,3>&) const  { BaseAttribut::error_get() ; }\ 
     48         virtual void getValue(Array<TYPE,4>&) const  { BaseAttribut::error_get() ; } 
    4049 
    4150         SETTER_AND_GETTER(int) 
     
    4352         SETTER_AND_GETTER(double) 
    4453         SETTER_AND_GETTER(char) 
    45          SETTER_AND_GETTER(string) 
     54         SETTER_AND_GETTER(std::string) 
    4655 
    4756#undef SETTER_AND_GETTER 
    4857 
     58         virtual ~BaseAttribut(void) 
     59         { /* Ne rien faire de plus */ } 
     60 
     61      public : /* static */ 
     62 
    4963         static void error_set(void) 
    50          { throw XMLIOIncompatibleTypeException("BaseAttribut::set<type> > Setting value type is incompatible with attribut type"); } 
     64         { throw XMLIOIncompatibleTypeException 
     65           ("BaseAttribut::set<type> > Setting value type is incompatible with attribut type"); } 
    5166 
    5267         static void error_get(void) 
    53          { throw XMLIOIncompatibleTypeException("BaseAttribut::set<type> >Getting value type is incompatible with attribut type"); } 
     68         { throw XMLIOIncompatibleTypeException 
     69           ("BaseAttribut::set<type> >Getting value type is incompatible with attribut type"); } 
    5470 
    5571   }; //class BaseAttribut 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp

    r125 r126  
    1515   static int called = 0; int i = 0; 
    1616   for (T it = begin; it != end; it++, i++) 
    17       (*it) = i + called * 0.1; 
     17      (*it) = i + called * 0.01; 
    1818   called++; 
    1919} 
     
    2323   try 
    2424   { 
    25       Array<double, 3> arr(100, 100, 20) ; // Les données(les arguments en fonction des dimensions). 
     25      Array<double, 3> arr(100, 100, 20) ; // Initialisation des données (les arguments en fonction des dimensions). 
    2626      string file("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml"); // Le fichier de définition. 
    2727      ifstream istr( file.c_str() , ifstream::in ); 
     
    3434 
    3535      // On se place dans le contexte 'context1'. 
    36       Context::SetCurrentContext("context1") ; 
     36      Context::SetCurrentContext("context1", true) ; 
    3737 
    38       std::cout << " * ----------- Début du traitement ----------- * " << std::endl; 
     38      std::cout << " * ----------- Début du traitement ----------- * " << std::endl << std::endl; 
    3939 
    4040      { 
    4141         // On crée une instance de traitement de données dans le format NetCDF4. 
    42          AbstractDataTreatment *dtreat = new NetCDF4DataTreatment(); 
    43          dtreat->createDataOutput(); 
     42         DataTreatment dtreat; 
     43         dtreat.createDataOutput<NetCDF4DataOutput>(); 
    4444 
    4545         // Récupération du calendrier assossié au context courant et initialisation des delais d'écriture. 
    46          AbstractCalendar* calendar = dtreat->getCurrentContext()->getCalendar(); 
    47          calendar->setTempo(1*Hour); 
     46         AbstractCalendar* calendar = dtreat.getCurrentContext()->getCalendar(); 
     47         calendar->setTempo(1 * Hour); 
    4848 
    49          //Affichage de la date initiale (pour vérification). 
    50          std::cout << *calendar << std::endl; 
     49         // Affichage de la date initiale (pour vérification). 
     50         std::cout << "Calendrier associé au contexte : " << *calendar << std::endl << std::endl; 
    5151 
    5252         for(int tcourant = 0, tfinal = 9; tcourant <= tfinal; tcourant++) 
     
    5656            calendar->update(); 
    5757 
    58             std::cout << "> Itération de calcul " << tcourant << ", " << *calendar << std::endl; 
     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; 
    5961 
    6062            // Mise à jour des données. 
     
    6264 
    6365            // Ecriture des données. 
    64             dtreat->writeData<Array<double, 3> >("champ1", arr); 
     66            dtreat.writeData<Array<double, 3> >("champ1", arr); 
    6567         } 
    6668 
    6769         // On écrit l'arborescence résultante du traitement sur la sortie de log. 
    68          // Context::ShowTree(std::clog); 
    69  
    70          delete dtreat; 
     70         //Context::ShowTree(std::clog); 
    7171      } 
    7272 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp

    r120 r126  
    3838         {/* Ne rien faire de plus */} 
    3939 
    40          bool addValue(const Key& kval, Mapped* element) 
     40         bool addValue(const Key& kval, Mapped* const element) 
    4141         { 
    42             pair<typename ExHashMap::Iterator,bool> p = this->insert(make_pair (kval,element)); 
     42            std::pair<typename ExHashMap::Iterator, bool> p = this->insert(make_pair (kval,element)); 
    4343            if(!p.second) return (false); 
    4444            return (this->addValue(element)); 
    4545         } 
    4646 
    47          bool addValue(Mapped* element) 
     47         bool addValue(Mapped* const element) 
    4848         {   this->_elemList.insert(this->_elemList.end(), element);   return (true);   } 
    4949 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp

    r125 r126  
    1616            fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
    1717         {/* Ne rien faire de plus */} 
    18  
    19          static void ShowTree(ostream& os = std::clog) 
    20          { 
    21             os << NIndent << "<?xml version=\"1.0\"?>" << std::endl; 
    22             os << NIndent << "<" << Context::GetRootName() << ">" << std::endl; 
    23  
    24             Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    25             for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
    26                // On sort chacun des contextes successivement. 
    27             { Context::SetCurrentContext((*it).first); os << *((*it).second)[(*it).first] << std::endl; } 
    28  
    29             os << NIndent << "</" << Context::GetRootName() << ">" << std::endl  ; 
    30          } 
    31  
    32          static void FreeMemory(void) 
    33          { 
    34             Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    35             for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
    36             { Context::SetCurrentContext((*it).first); delete ((*it).second)[(*it).first]; } 
    37          } 
    38  
    39          // Ne plus utiliser, disponible dans les classe treatment. 
    40          static void ResolveInheritance(void) 
    41          { 
    42             Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    43             for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
    44             { 
    45                // Résolution des héritages descendants (càd des héritages de groupes) pour chacun des contextes. 
    46                Context::SetCurrentContext((*it).first); 
    47                ((*it).second)[(*it).first]->resolveDescInheritance(); 
    48  
    49                // Résolution des héritages par référence au niveau des fichiers. 
    50                const std::vector<CFile*>& allFiles = CFile::GetCurrentListObject().getVector(); 
    51                for (unsigned int i = 0; i < allFiles.size(); i++) allFiles[i]->resolveFieldRefInheritance(); 
    52             } 
    53          } 
    54  
    55          static Context* SwapContext(void) 
    56          { 
    57             if (Stid.size() == 0) 
    58             { 
    59                WARNING("SwapContext impossible car le pile des contextes est vides !"); 
    60                return (NULL); 
    61             } 
    62             string lastId = Stid.top (); Stid.pop (); 
    63             return (Context::GetObject(lastId)); 
    64          } 
    65  
    66          static Context* GetCurrentContext(void) 
    67          { return (Context::GetObject(Context::GetCurrentContextId())); } 
    68  
    69          static void SetCurrentContext(const string& id, bool withSwap = false) 
    70          { 
    71             if (withSwap) Stid.push (Context::GetCurrentContextId()); 
    72  
    73             // On modifie le context courrant pour tout les ObjectTemplate 
    74             Context::SetContext(id); 
    75  
    76             // Changement de context pour les champs et groupes de champs. 
    77             FieldGroup::SetContext(id);  CField::SetContext(id); 
    78  
    79             // Changement de context pour les fichiers et groupes de fichiers. 
    80             FileGroup::SetContext(id);   CFile::SetContext(id); 
    81  
    82             // Changement de context pour les grilles et groupes de grilles. 
    83             GridGroup::SetContext(id);   CGrid::SetContext(id); 
    84  
    85             // Changement de context pour les axes et groupes d'axes. 
    86             AxisGroup::SetContext(id);   CAxis::SetContext(id); 
    87  
    88             // Changement de context pour les domaines et groupes de domaines. 
    89             DomainGroup::SetContext(id); CDomain::SetContext(id); 
    90          } 
    91  
    92          virtual void parse (XMLNode& _node) 
    93          { 
    94             THashAttributes attributes; 
    95  
    96             /// PARSING POUR GESTION DES ENFANTS 
    97             if (_node.getElementName().compare(Context::GetName())) 
    98                WARNING("Le noeud est mal nommé mais sera traité comme un context !"); 
    99  
    100             if (!(_node.goToChildElement())) 
    101                WARNING("Le context ne contient pas d'enfant !"); 
    102             else 
    103             { 
    104               do { // Parcours des contexts pour traitement. 
    105  
    106                   string name = _node.getElementName(); 
    107                   attributes.clear(); 
    108                   _node.getAttributes(attributes); 
    109  
    110                   if (attributes.end() != attributes.find("id")) 
    111                   { WARNING("Le noeud de définition possÚde un identifiant, ce dernier ne sera pas pris en compte lors du traitement !"); } 
    112  
    113                   if (name.compare(FieldDefinition::GetDefName())  == 0) // Parsing pour la définition des champs. 
    114                   { fieldDef  = CreateInstanceAndParse<FieldDefinition >(_node, FieldDefinition::GetDefName().c_str()); continue; } 
    115  
    116                   if (name.compare(FileDefinition::GetDefName())  == 0) // Parsing pour la définition des fichiers. 
    117                   { fileDef   = CreateInstanceAndParse<FileDefinition  >(_node, FileDefinition  ::GetDefName().c_str()); continue; } 
    118  
    119                   if (name.compare(AxisDefinition::GetDefName())  == 0) // Parsing pour la définition des axes. 
    120                   { axisDef   = CreateInstanceAndParse<AxisDefinition  >(_node, AxisDefinition  ::GetDefName().c_str()); continue; } 
    121  
    122                   if (name.compare(GridDefinition::GetDefName())  == 0) // Parsing pour la définition des grilles. 
    123                   { gridDef   = CreateInstanceAndParse<GridDefinition  >(_node, GridDefinition  ::GetDefName().c_str()); continue; } 
    124  
    125                   if (name.compare(DomainDefinition::GetDefName()) == 0) // Parsing pour la définition des domaines. 
    126                   { domainDef = CreateInstanceAndParse<DomainDefinition>(_node, DomainDefinition::GetDefName().c_str()); continue; } 
    127  
    128                   WARNING("La définition est invalide, seuls les champs, grilles, axes et fichiers peuvent être définis !"); 
    129  
    130                } while (_node.goToNextElement()); 
    131  
    132                _node.goToParentElement(); // Retour au parent 
    133             } 
    134          } 
    135  
    136          static string GetRootName(void) { return ("simulation"); } 
    137          static string GetName(void)     { return ("context"); } 
    138          static string GetDefName(void)  { return (Context::GetName()); } 
    139  
    140  
    141          virtual bool hasChild(void) const 
    142          { return ((fieldDef != NULL) or (fileDef != NULL)  or (axisDef != NULL) or (gridDef != NULL) or (domainDef != NULL)); } 
    143  
    144          virtual void printChild(ostream& out) const 
    145          { 
    146             if(fieldDef  != NULL) out << *(FieldGroup*)       fieldDef  << std::endl; 
    147             if(fileDef   != NULL) out << *(FileGroup*)        fileDef   << std::endl; 
    148             if(axisDef   != NULL) out << *(AxisDefinition*)   axisDef   << std::endl; 
    149             if(gridDef   != NULL) out << *(GridDefinition*)   gridDef   << std::endl; 
    150             if(domainDef != NULL) out << *(DomainDefinition*) domainDef << std::endl; 
    151          } 
    152  
    153          virtual void resolveDescInheritance(const AttributRegistrar* const _parent = 0) 
    154          { 
    155             if (_parent != 0) return; 
    156             // Résolution des héritages descendants pour chacun des groupes de définitions. 
    157             if(fieldDef  != NULL) fieldDef ->resolveDescInheritance(); 
    158             if(fileDef   != NULL) fileDef  ->resolveDescInheritance(); 
    159             if(axisDef   != NULL) axisDef  ->resolveDescInheritance(); 
    160             if(gridDef   != NULL) gridDef  ->resolveDescInheritance(); 
    161             if(domainDef != NULL) domainDef->resolveDescInheritance(); 
    162          } 
    16318 
    16419         FieldDefinition  * getFieldDefinition(void)  const { return (this->fieldDef ); } 
     
    19853         } 
    19954 
     55      public : /* virtual */ 
     56 
     57         virtual void parse (XMLNode& _node) 
     58         { 
     59            THashAttributes attributes; 
     60 
     61            /// PARSING POUR GESTION DES ENFANTS 
     62            if (_node.getElementName().compare(Context::GetName())) 
     63               WARNING("Le noeud est mal nommé mais sera traité comme un context !"); 
     64 
     65            if (!(_node.goToChildElement())) 
     66               WARNING("Le context ne contient pas d'enfant !"); 
     67            else 
     68            { 
     69              do { // Parcours des contexts pour traitement. 
     70 
     71                  string name = _node.getElementName(); 
     72                  attributes.clear(); 
     73                  _node.getAttributes(attributes); 
     74 
     75                  if (attributes.end() != attributes.find("id")) 
     76                  { WARNING("Le noeud de définition possÚde un identifiant, ce dernier ne sera pas pris en compte lors du traitement !"); } 
     77 
     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; } 
     92 
     93                  WARNING("La définition est invalide, seuls les champs, grilles, axes et fichiers peuvent être définis !"); 
     94 
     95               } while (_node.goToNextElement()); 
     96 
     97               _node.goToParentElement(); // Retour au parent 
     98            } 
     99         } 
     100 
     101         virtual bool hasChild(void) const 
     102         { return ((fieldDef != NULL) or (fileDef != NULL)  or (axisDef != NULL) or (gridDef != NULL) or (domainDef != NULL)); } 
     103 
     104         virtual void printChild(ostream& out) const 
     105         { 
     106            if(fieldDef  != NULL) out << *(FieldGroup*)       fieldDef  << std::endl; 
     107            if(fileDef   != NULL) out << *(FileGroup*)        fileDef   << std::endl; 
     108            if(axisDef   != NULL) out << *(AxisDefinition*)   axisDef   << std::endl; 
     109            if(gridDef   != NULL) out << *(GridDefinition*)   gridDef   << std::endl; 
     110            if(domainDef != NULL) out << *(DomainDefinition*) domainDef << std::endl; 
     111         } 
     112 
     113         virtual void resolveDescInheritance(const AttributRegistrar* const _parent = 0) 
     114         { 
     115            if (_parent != 0) return; 
     116            // Résolution des héritages descendants pour chacun des groupes de définitions. 
     117            if(fieldDef  != NULL) fieldDef ->resolveDescInheritance(); 
     118            if(fileDef   != NULL) fileDef  ->resolveDescInheritance(); 
     119            if(axisDef   != NULL) axisDef  ->resolveDescInheritance(); 
     120            if(gridDef   != NULL) gridDef  ->resolveDescInheritance(); 
     121            if(domainDef != NULL) domainDef->resolveDescInheritance(); 
     122         } 
     123 
     124      public : /* static */ 
     125 
     126         static string GetRootName(void) { return ("simulation"); } 
     127         static string GetName(void)     { return ("context"); } 
     128         static string GetDefName(void)  { return (Context::GetName()); } 
     129 
     130         static void ShowTree(ostream& os = std::clog) 
     131         { 
     132            os << NIndent << "<?xml version=\"1.0\"?>" << std::endl; 
     133            os << NIndent << "<" << Context::GetRootName() << ">" << std::endl; 
     134 
     135            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
     136            for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     137               // On sort chacun des contextes successivement. 
     138            { 
     139               Context::SetCurrentContext((*it).first); 
     140               os << NIndent << std::endl; 
     141               os << *((*it).second)[(*it).first] << std::endl; 
     142            } 
     143 
     144            os << NIndent << std::endl; 
     145            os << NIndent << "</" << Context::GetRootName() << ">" << std::endl  ; 
     146         } 
     147 
     148         static void FreeMemory(void) 
     149         { 
     150            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
     151            for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     152            { Context::SetCurrentContext((*it).first); delete ((*it).second)[(*it).first]; } 
     153         } 
     154 
     155         // Ne plus utiliser, disponible dans les classe treatment. 
     156         static void ResolveInheritance(void) 
     157         { 
     158            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
     159            for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     160            { 
     161               // Résolution des héritages descendants (càd des héritages de groupes) pour chacun des contextes. 
     162               Context::SetCurrentContext((*it).first); 
     163               ((*it).second)[(*it).first]->resolveDescInheritance(); 
     164 
     165               // 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]->resolveFieldRefInheritance(); 
     168            } 
     169         } 
     170 
     171         static Context* SwapContext(void) 
     172         { 
     173            if (Stid.size() == 0) 
     174            { 
     175               WARNING("SwapContext impossible car le pile des contextes est vides !"); 
     176               return (NULL); 
     177            } 
     178            string lastId = Stid.top (); Stid.pop (); 
     179            return (Context::GetObject(lastId)); 
     180         } 
     181 
     182         static Context* GetCurrentContext(void) 
     183         { return (Context::GetObject(Context::GetCurrentContextId())); } 
     184 
     185         static void SetCurrentContext(const string& id, bool withSwap = false) 
     186         { 
     187            if (withSwap) Stid.push (Context::GetCurrentContextId()); 
     188 
     189            // On modifie le context courrant pour tout les ObjectTemplate 
     190            Context::SetContext(id); 
     191 
     192            // Changement de context pour les champs et groupes de champs. 
     193            FieldGroup::SetContext(id);  CField::SetContext(id); 
     194 
     195            // Changement de context pour les fichiers et groupes de fichiers. 
     196            FileGroup::SetContext(id);   CFile::SetContext(id); 
     197 
     198            // Changement de context pour les grilles et groupes de grilles. 
     199            GridGroup::SetContext(id);   CGrid::SetContext(id); 
     200 
     201            // Changement de context pour les axes et groupes d'axes. 
     202            AxisGroup::SetContext(id);   CAxis::SetContext(id); 
     203 
     204            // Changement de context pour les domaines et groupes de domaines. 
     205            DomainGroup::SetContext(id); CDomain::SetContext(id); 
     206         } 
     207 
    200208      private: 
    201209 
    202210         static stack<string> Stid; 
    203211 
    204          AbstractCalendar* ccalendar; 
    205  
    206          FieldDefinition* fieldDef; 
    207          FileDefinition fileDef; 
    208          AxisDefinition axisDef; 
    209          GridDefinition gridDef; 
    210          DomainDefinition* domainDef; 
     212         AbstractCalendar * ccalendar; 
     213 
     214         FieldDefinition  * fieldDef; 
     215         FileDefinition   * fileDef; 
     216         AxisDefinition   * axisDef; 
     217         GridDefinition   * gridDef; 
     218         DomainDefinition * domainDef; 
    211219 
    212220   }; //class Context 
    213221 
    214    //stack<string> Context::Stid(); 
     222   stack<string> Context::Stid; 
    215223 
    216224}// namespace XMLIOSERVER 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp

    r120 r126  
    66#define Array(x,y) Array<x,y> 
    77 
    8 #define DECLARE_ATTR(att_name,att_type)               \ 
    9    class attr_##att_name : public Attribut<att_type>  \ 
     8#define DECLARE_ATTR(att_name, att_type)              \ 
     9   class Attr_##att_name : public Attribut<att_type>  \ 
    1010   {                                                  \ 
    1111      public:                                         \ 
    12          virtual string getName(void) const { return #att_name ;}                   \ 
    13          virtual const char * getType(void) const { return #att_type ;}             \ 
    14          attr_##att_name(void) : Attribut<att_type>() {}                            \ 
    15          attr_##att_name(const att_type& value_) : Attribut<att_type>(value_) {}    \ 
    16          attr_##att_name(const attr_##att_name & att) : Attribut<att_type>(att) {}  \ 
    17    } att_name 
     12                                                      \ 
     13         virtual string       getName(void) const { return (#att_name) ;}           \ 
     14         virtual const char * getType(void) const { return (#att_type) ;}           \ 
     15                                                                                    \ 
     16         Attr_##att_name(void) : Attribut<att_type>()                               \ 
     17         { /* Ne rien faire de plus */ }                                            \ 
     18         Attr_##att_name(const att_type& _value) : Attribut<att_type>(_value)       \ 
     19         { /* Ne rien faire de plus */ }                                            \ 
     20         Attr_##att_name(const Attr_##att_name & att) : Attribut<att_type>(att)     \ 
     21         { /* Ne rien faire de plus */ }                                            \ 
     22                                                                                    \ 
     23         virtual ~Attr_##att_name()                                                 \ 
     24         { /* Ne rien faire de plus */ }                                            \ 
     25   };                                                                               \ 
     26                                                                                    \ 
     27   const Attr_##att_name& getAttr_##att_name(void) const { return (att_name); }     \ 
     28   const Attr_##att_name& get_##att_name(void)     const { return (att_name); }     \ 
     29                                                                                    \ 
     30   void setAttr##att_name(const Attr_##att_name& _newattr) { att_name = _newattr; } \ 
     31   void set_##att_name    (const Attr_##att_name& _newattr) { att_name = _newattr; }\ 
     32                                                                                    \ 
     33   void setAttr##att_name(const att_type& _newattr) { att_name.setValue(_newattr); }\ 
     34   void set_##att_name   (const att_type& _newattr) { att_name.setValue(_newattr); }\ 
     35   Attr_##att_name att_name 
    1836 
    1937#endif // __DECLARE_ATTRIBUT__ 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp

    r114 r126  
    22#define __DECLARE_GROUP__ 
    33 
    4 #define DECLARE_GROUP(child_type) \ 
    5    namespace XMLIOSERVER \ 
    6    {  \ 
    7       class child_type##Group : public GroupTemplate<C##child_type, child_type##Attribut>\ 
    8       {\ 
    9          public:\ 
    10             child_type##Group(void) : GroupTemplate<C##child_type, child_type##Attribut>(){}\ 
    11             child_type##Group(const string& _id) : GroupTemplate<C##child_type, child_type##Attribut>(_id) {}\ 
    12             void parse (XMLNode& _node, bool _withAttr = true) { _parse<child_type##Group>(_node, _withAttr); }\ 
    13             virtual ~child_type##Group(void){}\ 
    14       }; \ 
    15       typedef child_type##Group child_type##Definition; \ 
     4#define DECLARE_GROUP(child_type)                                          \ 
     5   namespace XMLIOSERVER                                                   \ 
     6   {                                                                       \ 
     7      class child_type##Group                                              \ 
     8         : public GroupTemplate<C##child_type, child_type##Attribut>       \ 
     9      {                                                                    \ 
     10         public:                                                           \ 
     11                                                                           \ 
     12            child_type##Group(void)                                        \ 
     13               : GroupTemplate<C##child_type, child_type##Attribut>()      \ 
     14            { /* Ne rien faire de plus */ }                                \ 
     15                                                                           \ 
     16            child_type##Group(const string& _id)                           \ 
     17               : GroupTemplate<C##child_type, child_type##Attribut>(_id)   \ 
     18            { /* Ne rien faire de plus */ }                                \ 
     19                                                                           \ 
     20            void parse (XMLNode& _node, bool _withAttr = true)             \ 
     21            { _parse<child_type##Group>(_node, _withAttr); }               \ 
     22                                                                           \ 
     23            virtual ~child_type##Group(void){}                             \ 
     24      };                                                                   \ 
     25                                                                           \ 
     26      typedef child_type##Group child_type##Definition;                    \ 
    1627   } 
    1728 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/domain_attribut.hpp

    r120 r126  
    1010      public : 
    1111 
    12          DECLARE_ATTR(name, string) ; 
    13          DECLARE_ATTR(description, string); 
    14          DECLARE_ATTR(ni_glo, int); 
    15          DECLARE_ATTR(nj_glo, int) ; 
    16          DECLARE_ATTR(ibegin, int) ; 
    17          DECLARE_ATTR(iend, int) ; 
    18          DECLARE_ATTR(ni, int) ; 
    19          DECLARE_ATTR(jbegin, int) ; 
    20          DECLARE_ATTR(jend, int) ; 
    21          DECLARE_ATTR(nj, int) ; 
    22          DECLARE_ATTR(mask, Array(bool, 2)) ; 
     12         DECLARE_ATTR(name          , string) ; 
     13         DECLARE_ATTR(standard_name , string) ; 
     14         DECLARE_ATTR(long_name     , string) ; 
    2315 
    24          DECLARE_ATTR(data_dim, int) ; 
    25          DECLARE_ATTR(data_ni, int); 
    26          DECLARE_ATTR(data_nj, int) ; 
    27          DECLARE_ATTR(data_ibegin, int) ; 
    28          DECLARE_ATTR(data_jbegin, int) ; 
    29          DECLARE_ATTR(data_n_index, int) ; 
    30          DECLARE_ATTR(data_i_index,Array(int, 1)) ; 
    31          DECLARE_ATTR(data_j_index,Array(int, 1)) ; 
     16         DECLARE_ATTR(ni_glo        , int) ; 
     17         DECLARE_ATTR(nj_glo        , int) ; 
     18         DECLARE_ATTR(ibegin        , int) ; 
     19         DECLARE_ATTR(iend          , int) ; 
     20         DECLARE_ATTR(ni            , int) ; 
     21         DECLARE_ATTR(jbegin        , int) ; 
     22         DECLARE_ATTR(jend          , int) ; 
     23         DECLARE_ATTR(nj            , int) ; 
     24         DECLARE_ATTR(mask          , Array(bool, 2)) ; 
     25 
     26         DECLARE_ATTR(data_dim      , int) ; 
     27         DECLARE_ATTR(data_ni       , int) ; 
     28         DECLARE_ATTR(data_nj       , int) ; 
     29         DECLARE_ATTR(data_ibegin   , int) ; 
     30         DECLARE_ATTR(data_jbegin   , int) ; 
     31         DECLARE_ATTR(data_n_index  , int) ; 
     32         DECLARE_ATTR(data_i_index  , Array(int, 1)) ; 
     33         DECLARE_ATTR(data_j_index  , Array(int, 1)) ; 
    3234 
    3335         DomainAttribut(void) : AttributRegistrar() 
    34          { registerAllAttributes(); } 
     36         { this->registerAllAttributes(); } 
    3537 
    3638      private : 
     
    3941         { 
    4042            RegisterAttribut(&name) ; 
    41             RegisterAttribut(&description) ; 
     43            RegisterAttribut(&standard_name) ; 
     44            RegisterAttribut(&long_name) ; 
    4245            RegisterAttribut(&ni_glo); 
    4346            RegisterAttribut(&nj_glo) ; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field_attribut.hpp

    r124 r126  
    88      public : 
    99 
    10          DECLARE_ATTR(name, string) ; 
    11          DECLARE_ATTR(description, string) ; 
    12          DECLARE_ATTR(unit, string) ; 
    13          DECLARE_ATTR(operation, FieldOperation); 
     10         DECLARE_ATTR(name         , string) ; 
     11         DECLARE_ATTR(standard_name, string) ; 
     12         DECLARE_ATTR(long_name    , string) ; 
    1413 
    15          DECLARE_ATTR(freq_op, Duration) ; 
    16          DECLARE_ATTR(level, int) ; 
    17          DECLARE_ATTR(prec, int) ; 
     14         DECLARE_ATTR(unit         , string) ; 
     15         DECLARE_ATTR(operation    , FieldOperation) ; 
    1816 
    19          DECLARE_ATTR(enabled, bool); 
     17         DECLARE_ATTR(freq_op      , Duration) ; 
     18         DECLARE_ATTR(level        , int) ; 
     19         DECLARE_ATTR(prec         , int) ; 
    2020 
    21          DECLARE_ATTR(domain_ref, string); 
    22          DECLARE_ATTR(axis_ref, string); 
    23          DECLARE_ATTR(grid_ref, string) ; 
    24          DECLARE_ATTR(zoom_ref, string); 
    25          DECLARE_ATTR(field_ref, string); 
     21         DECLARE_ATTR(enabled      , bool) ; 
     22 
     23         DECLARE_ATTR(domain_ref   , string) ; 
     24         DECLARE_ATTR(axis_ref     , string) ; 
     25         DECLARE_ATTR(grid_ref     , string) ; 
     26         DECLARE_ATTR(zoom_ref     , string) ; 
     27         DECLARE_ATTR(field_ref    , string) ; 
    2628 
    2729         FieldAttribut(void) : AttributRegistrar() 
    28          { registerAllAttributes(); } 
     30         { this->registerAllAttributes(); } 
    2931 
    3032      private : 
     
    3335         { 
    3436            RegisterAttribut(&name) ; 
    35             RegisterAttribut(&description) ; 
     37            RegisterAttribut(&standard_name) ; 
     38            RegisterAttribut(&long_name) ; 
    3639            RegisterAttribut(&unit) ; 
    3740            RegisterAttribut(&operation); 
     
    4245            RegisterAttribut(&enabled); 
    4346 
    44             RegisterAttribut(&domain_ref); 
    45             RegisterAttribut(&axis_ref); 
    46             RegisterAttribut(&grid_ref); 
    47             RegisterAttribut(&zoom_ref); 
    48             RegisterAttribut(&field_ref); 
     47            RegisterAttribut(&domain_ref) ; 
     48            RegisterAttribut(&axis_ref) ; 
     49            RegisterAttribut(&grid_ref) ; 
     50            RegisterAttribut(&zoom_ref) ; 
     51            RegisterAttribut(&field_ref) ; 
    4952         } 
    5053 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/file_attribut.hpp

    r123 r126  
    88      public : 
    99 
    10          DECLARE_ATTR(name, string) ; 
    11          DECLARE_ATTR(description, string) ; 
    12          DECLARE_ATTR(output_freq, Duration) ; 
     10         DECLARE_ATTR(name        , string) ; 
     11         DECLARE_ATTR(description , string) ; 
     12         DECLARE_ATTR(output_freq , Duration) ; 
    1313         DECLARE_ATTR(output_level, int) ; 
    14          DECLARE_ATTR(enabled, bool); 
     14         DECLARE_ATTR(enabled     , bool); 
    1515 
    1616         FileAttribut(void) : AttributRegistrar() 
    17          { registerAllAttributes(); } 
     17         { this->registerAllAttributes(); } 
    1818 
    1919      private : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/grid_attribut.hpp

    r120 r126  
    88      public : 
    99 
    10          DECLARE_ATTR(name, string) ; 
     10         DECLARE_ATTR(name       , string) ; 
    1111         DECLARE_ATTR(description, string) ; 
    12          DECLARE_ATTR(domain_ref, string) ; 
    13          DECLARE_ATTR(axis_ref, string) ;  
     12         DECLARE_ATTR(domain_ref , string) ; 
     13         DECLARE_ATTR(axis_ref   , string) ; 
    1414 
    1515         GridAttribut(void) : AttributRegistrar() 
    16          { registerAllAttributes(); } 
     16         { this->registerAllAttributes(); } 
    1717 
    1818      private : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp

    r122 r126  
    99      public: 
    1010 
    11          GroupTemplate(void) : ObjectTemplate<GroupTemplate<T, U> >(),  U(), childList(), groupList() 
    12          {/* Ne rien faire de plus */} 
    13          GroupTemplate(const string& _id) : ObjectTemplate<GroupTemplate<T, U> >(_id), U(), childList(), groupList() 
    14          {/* Ne rien faire de plus */} 
     11         GroupTemplate(void) 
     12            : ObjectTemplate<GroupTemplate<T, U> >(),  U(), childList(), groupList() 
     13         { /* Ne rien faire de plus */ } 
     14 
     15         GroupTemplate(const string& _id) 
     16            : ObjectTemplate<GroupTemplate<T, U> >(_id), U(), childList(), groupList() 
     17         { /* Ne rien faire de plus */ } 
    1518 
    1619         /// Pour les groupes d'objets enfants /// 
    1720 
    18          static string GetName(void) {return (T::GetName().append("_group")); } 
    19          static string GetDefName(void) {return (T::GetName().append("_definition")); } 
     21         GroupTemplate<T, U>& createGroup(const string& _id) 
     22            throw (XMLIOUndefinedValueException) 
     23         { 
     24            GroupTemplate<T, U> &obj = *GroupTemplate<T, U>::CreateObject(_id); 
     25            groupList.addObject(&obj); 
     26 
     27            return (obj); 
     28         } 
     29 
     30         GroupTemplate<T, U>& createGroup(void) 
     31         { 
     32            GroupTemplate<T, U>& obj = *(GroupTemplate<T, U>::CreateObject()); 
     33            groupList.addObject(&obj); 
     34 
     35            return (obj); 
     36         } 
     37 
     38         GroupTemplate<T, U>& getGroup(const string& _id) const 
     39            throw (XMLIOUndefinedValueException) 
     40         { return (*groupList[_id]); } 
     41 
     42         bool hasGroup(const string& _id) const { return (groupList.hasMappedValue(_id)); } 
     43 
     44         const StrHashMap<GroupTemplate<T, U>* >& getGroupList(void) const { return (groupList); } 
     45 
     46         size_t getNbGroup() const {return (groupList.getVectorSize()); } 
     47 
     48         /// Pour les objets enfants /// 
     49 
     50         T& createChild(const string& _id) 
     51            throw (XMLIOUndefinedValueException) 
     52         { 
     53            T& obj = *ObjectTemplate<T>::CreateObject(_id); 
     54            childList.addObject(&obj); 
     55            return (obj); 
     56         } 
     57 
     58         T& createChild(void) 
     59         { 
     60            T& obj = *ObjectTemplate<T>::CreateObject(); 
     61            childList.addObject(&obj); 
     62            return (obj); 
     63         } 
     64 
     65         T& getChild(const string& _id) const 
     66            throw (XMLIOUndefinedValueException) 
     67         { return (*childList[_id]); } 
     68 
     69         bool hasChild(const string& _id) const { return (childList.hasMappedValue(_id)); } 
     70 
     71         const StrHashMap<T*> & getCurrentListChild  (void) const { return (childList); } 
     72         const std::vector<T*>& getCurrentVectorChild(void) const { return (childList.getVector()); } 
     73 
     74         size_t getNbChild() const {return (childList.getVectorSize()); } 
     75 
     76         void getAllChildren(std::vector<T*>& _allc ) const 
     77         { 
     78            const vector<GroupTemplate<T, U>*>& groupvect = groupList.getVector(); 
     79            _allc.insert (_allc.end(), getCurrentVectorChild().begin(), getCurrentVectorChild().end()); 
     80 
     81            for(unsigned int i = 0; i < groupvect.size() ; i++) 
     82               groupvect[i] -> getAllChildren(_allc); 
     83         } 
     84 
     85      public : /* static */ 
     86 
     87         static string GetName(void)    { return (T::GetName().append("_group")); } 
     88         static string GetDefName(void) { return (T::GetName().append("_definition")); } 
     89 
     90      public : /* virtual */ 
     91 
     92         virtual ~GroupTemplate() 
     93         { 
     94            for (unsigned int i = 0; i < childList.getVector().size(); i++) 
     95               delete childList.getVector()[i]; 
     96            for (unsigned int i = 0; i < groupList.getVector().size(); i++) 
     97               delete groupList.getVector()[i]; 
     98         } 
    2099 
    21100         virtual bool hasChild(void) const { return ((getNbGroup() + getNbChild())>0); } 
     
    35114            const vector<GroupTemplate<T, U>*>& groupvect = groupList.getVector(); 
    36115 
    37             // On complÚte les propres attributs du groupe. 
    38             if (_parent!= NULL) AttributRegistrar::addAttributes(*_parent); 
     116            // On complÚte les propres attributs du groupe avec ceux du parent. 
     117            if (_parent != NULL) AttributRegistrar::addAttributes(*_parent); 
    39118 
    40119            for(unsigned int i = 0; i < childvect.size() ; i++) 
     
    45124            // on complÚte les attributs des groupes enfants. 
    46125               groupvect[i] -> resolveDescInheritance(this); 
    47          } 
    48  
    49          GroupTemplate<T, U>& createGroup(const string& _id) throw (XMLIOUndefinedValueException) 
    50          { 
    51             GroupTemplate<T, U> &obj = *GroupTemplate<T, U>::CreateObject(_id); 
    52             groupList.addObject(&obj); 
    53  
    54             return (obj); 
    55          } 
    56  
    57          GroupTemplate<T, U>& createGroup(void) 
    58          { 
    59             GroupTemplate<T, U>& obj = *(GroupTemplate<T, U>::CreateObject()); 
    60             groupList.addObject(&obj); 
    61  
    62             return (obj); 
    63          } 
    64  
    65          GroupTemplate<T, U>& getGroup(const string& _id) throw (XMLIOUndefinedValueException) { return (*groupList[_id]); } 
    66          bool hasGroup(const string _id) { return (groupList.hasMappedValue(_id)); } 
    67  
    68          const StrHashMap<GroupTemplate<T, U>* >& getGroupList(void) const { return (groupList); } 
    69  
    70          size_t getNbGroup() const {return (groupList.getVectorSize()); } 
    71  
    72          /// Pour les objets enfants /// 
    73  
    74          T& createChild(const string& _id) throw (XMLIOUndefinedValueException) 
    75          { 
    76             T& obj = *ObjectTemplate<T>::CreateObject(_id); 
    77             childList.addObject(&obj); 
    78             return (obj); 
    79          } 
    80  
    81          T& createChild(void) 
    82          { 
    83             T& obj = *ObjectTemplate<T>::CreateObject(); 
    84             childList.addObject(&obj); 
    85             return (obj); 
    86          } 
    87  
    88          T& getChild(const string& _id) throw (XMLIOUndefinedValueException) { return (*childList[_id]); } 
    89          bool hasChild(const string& _id) { return (childList.hasMappedValue(_id)); } 
    90  
    91          const StrHashMap<T*>& getCurrentListChild(void) const { return (childList); } 
    92          const vector<T*>& getCurrentVectorChild(void) const { return (childList.getVector()); } 
    93  
    94          size_t getNbChild() const {return (childList.getVectorSize()); } 
    95  
    96          void getAllChildren(std::vector<T*>& _allc ) 
    97          { 
    98             const vector<GroupTemplate<T, U>*>& groupvect = groupList.getVector(); 
    99             _allc.insert (_allc.end(), getCurrentVectorChild().begin(), getCurrentVectorChild().end()); 
    100  
    101             for(unsigned int i = 0; i < groupvect.size() ; i++) 
    102                groupvect[i] -> getAllChildren(_allc); 
    103          } 
    104  
    105          virtual ~GroupTemplate() 
    106          { 
    107             for (unsigned int i = 0; i < childList.getVector().size(); i++) 
    108                delete childList.getVector()[i]; 
    109             for (unsigned int i = 0; i < groupList.getVector().size(); i++) 
    110                delete groupList.getVector()[i]; 
    111126         } 
    112127 
     
    158173            {// Si l'identifiant est défini. 
    159174               if (V::HasObject(attributes["id"])) 
    160                   WARNING("Dans le context actuel, une instance de type "+V::GetName()+" nommée \""+attributes["id"]+"\" existe déjà, le second fera référence au premier par défaut !"); // TODO TODO 
     175                  WARNING("Dans le context actuel, une instance de type "+V::GetName()+" nommée \""+attributes["id"] 
     176                          +"\" existe déjà, le second fera référence au premier par défaut !"); // TODO TODO 
    161177               instance_ptr = (V*)(&createGroup(attributes["id"])); 
    162178               instance_ptr->parse(_node); 
     
    176192            {// Si l'identifiant est défini. 
    177193               if (V::HasObject(attributes["id"])) 
    178                   WARNING("Dans le context actuel, une instance de type "+V::GetName()+" nommée \""+attributes["id"]+"\" existe déjà, le second fera référence au premier par défaut !"); // TODO TODO 
     194                  WARNING("Dans le context actuel, une instance de type "+V::GetName()+" nommée \""+attributes["id"] 
     195                          +"\" existe déjà, le second fera référence au premier par défaut !"); // TODO TODO 
    179196               instance_ptr = (V*)(&createChild(attributes["id"])); 
    180197               instance_ptr->parse(_node); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp

    r125 r126  
    2727 
    2828            if (c.baseObject != NULL) 
    29                out <<  IncIndent << "<-- Reference resolved for the following "+ T::GetName() + 
    30                        " : \"" << c.baseObject->getId() << "\" -->" << DecEndl << std::endl; 
     29               out <<  IncIndent << "<-- Référence résolu sur l'instance de "<< T::GetName() 
     30                   <<   " nommée \"" << c.baseObject->getId() << "\" -->" << DecEndl << std::endl; 
     31 
     32            if (c.isDefinition()) 
     33            { 
     34               out << NIndent << std::endl; 
     35               out << NIndent << "<!-- Groupe de définition dans le contexte \"" << ObjectTemplate<T>::GetCurrentContextId() << "\" courant -->" << std::endl; 
     36            } 
    3137 
    3238            if (c.hasChild()) 
    3339            { 
    34                out << IncIndent  << "<" << c.getName()   << c.printId() << ar << ">" << std::endl; 
     40               out << IncIndent  << "<"  << c.getName()  << c.printId() << ar << ">" << std::endl; 
    3541               c.printChild(out); // << Ecriture des objets enfants ici. 
     42               if (c.hasId() && (c.getName().compare("context") == 0)) 
     43                  out << NIndent << std::endl; 
    3644               out << NIndent    << "</" << c.getName()  << ">" << DecEndl; 
    3745            } 
    38             else out << IncIndent << "<" << c.getName()  << c.printId() << ar << "/>" << DecEndl; 
     46            else 
     47               out << IncIndent << "<" << c.getName()  << c.printId() << ar << "/>" << DecEndl; 
    3948 
    4049            return (out); 
    4150         } 
    4251 
     52         bool isDefinition(void) const 
     53         { 
     54            if (!this->hasId()) return (false); 
     55            return (this->getName().compare(this->getId()) == 0); 
     56         } 
     57 
    4358         string getName(void) const 
    4459         { 
    45             if (hasId()) 
     60            if (this->hasId()) 
    4661               if (T::GetDefName().compare(getId()) == 0) 
    47                   return T::GetDefName(); 
     62                  return (T::GetDefName()); 
    4863            return (T::GetName()); 
    4964         } 
     
    5166         T* getBaseObject(void) const { return (baseObject); } 
    5267 
    53          virtual T* getReference(void) const { return (NULL); } 
    54  
    5568         const vector<T*>& getVectRefObject(void) const { return (refObject); } 
    5669 
    57          bool hasRefObject(void) { return (!refObject.empty()); } 
     70         bool hasRefObject(void) const { return (!refObject.empty()); } 
    5871 
    5972         const T* addRefObject(T* obj) 
    6073         { refObject.push_back (obj); return (obj); } 
    6174 
     75      public : /* virtual */ 
     76 
     77         virtual T* getReference(void) const { return (NULL); } 
    6278         virtual bool hasChild(void) const { return (false); } 
    63          virtual void printChild(ostream& out) const { out << NIndent << "<!-- No child -->" << std::endl; } 
    64  
    65          virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) { addAttributes(*_parent); } 
     79 
     80         virtual void printChild(ostream& out) const 
     81         { out << NIndent << "<!-- No child -->" << std::endl; } 
     82 
     83         virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) 
     84         { this->addAttributes(*_parent); } 
     85 
    6686         virtual void resolveRefInheritance (void) 
    6787         { 
     
    89109 
    90110            /// PARSING POUR GESION DES ENFANTS /// 
    91             // Rien à faire. 
    92          } 
     111            // Rien à faire ici. 
     112         } 
     113 
     114         virtual ~ObjectTemplate(void) 
     115         {/* Ne rien faire de plus */} 
    93116 
    94117      public : /* static */ 
     
    118141         static bool HasObject(const string& _id) 
    119142         { 
    120             if(ObjectTemplate<T>::AllListObj.find(CurrContext) == ObjectTemplate<T>::AllListObj.end()) return false; 
     143            if(ObjectTemplate<T>::AllListObj.find(CurrContext) == 
     144               ObjectTemplate<T>::AllListObj.end()) 
     145               return (false); 
    121146            return (ObjectTemplate<T>::AllListObj[CurrContext].hasMappedValue(_id)); 
    122147         } 
     
    125150         static Poco::HashMap<string, StrHashMap<T> >& GetAllListObject(void) { return (AllListObj); } 
    126151 
    127          static void SetContext(const string& id){ ObjectTemplate<T>::CurrContext = id; } 
    128  
    129          static string& GetCurrentContextId(void) { return (CurrContext); } 
    130  
    131          virtual ~ObjectTemplate(void) 
    132          {/* Ne rien faire de plus */} 
     152         static void SetContext(const string& id) { ObjectTemplate<T>::CurrContext = id; } 
     153 
     154         static string& GetCurrentContextId(void) { return (ObjectTemplate<T>::CurrContext); } 
    133155 
    134156      protected : 
    135157 
    136          ObjectTemplate(void) : AbstractObject(), baseObject(NULL), refObject() 
    137          {/* Ne rien faire de plus */} 
    138          ObjectTemplate(const string& _id) : AbstractObject(_id), baseObject(NULL), refObject() 
    139          {/* Ne rien faire de plus */} 
     158         ObjectTemplate(void) 
     159            : AttributRegistrar(), AbstractObject(), baseObject(NULL), refObject() 
     160         { /* Ne rien faire de plus */ } 
     161 
     162         ObjectTemplate(const string& _id) 
     163            : AttributRegistrar(), AbstractObject(_id), baseObject(NULL), refObject() 
     164         { /* Ne rien faire de plus */ } 
     165 
     166         ObjectTemplate(const ObjectTemplate<T>& _ot, bool _withAttrList = true, bool _withId = true) 
     167            : AttributRegistrar(), AbstractObject(), baseObject(_ot.baseObject), refObject(_ot.refObject) 
     168         { 
     169            // Si requis, ajout de l'identifiant lors de la copie. 
     170            if (_ot.hasId() && _withId) this->setId(_ot.getId()); 
     171            // Si requis, ajout des attributs lors de la copie. 
     172            if (_withAttrList) this->addAttributes(_ot); 
     173         } 
    140174 
    141175         XML::XMLNode getNodeIncludedFile(const string& path, const string& _rootName) 
    142176         { 
    143177            ifstream istr( path.c_str() , ifstream::in ); 
    144             return XML::XMLNode::CreateNode(istr, _rootName); 
     178            return (XML::XMLNode::CreateNode(istr, _rootName)); 
    145179         } 
    146180 
     
    151185            { 
    152186               if (V::HasObject(did)) 
    153                   WARNING("Le noeud nommé \""+ did +"\" existe déjà pour les instances de type "+V::GetName()+", le dernier défini complétera le premier dans le context actuel!"); 
     187                  WARNING("Le noeud nommé \""+ did +"\" existe déjà pour les instances de type "+ 
     188                           V::GetName()+", le dernier défini complétera le premier dans le context actuel!"); 
    154189               instance_ptr = (V*)V::CreateObject(did); 
    155190               instance_ptr->parse(_node, parseAttr); 
     
    159194 
    160195      private : 
     196 
    161197         T* baseObject; 
    162          vector<T*> refObject; 
     198         std::vector<T*> refObject; 
     199 
     200      private : /* static */ 
    163201 
    164202         static string CurrContext; 
     
    167205   };// class ObjectTemplate 
    168206 
     207   // Initialisation des variables statiques de la classe ObjectTemplate. 
    169208   template <class T> string ObjectTemplate<T>::CurrContext ; 
    170209   template <class T> Poco::HashMap<string, StrHashMap<T> > ObjectTemplate<T>::AllListObj; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp

    r120 r126  
    1212      { 
    1313         public : 
    14  
    15             static XMLNode CreateNode(std::istream& _istr, const std::string& _rootName) 
    16             { 
    17                XMLNode node(_rootName); 
    18  
    19                if (_istr.good()) 
    20                { // S'il est possible de lire le flux en entrée ... 
    21  
    22                   Poco::XML::InputSource src(_istr); 
    23                   Poco::XML::DOMParser parser; 
    24  
    25                   node.pDoc = parser.parse(&src); 
    26                   node.setCNode(node.pDoc->documentElement()); 
    27                   if (node.getElementName().compare(_rootName) != 0) // << A passer en avertissement. 
    28                      throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)"); 
    29                } 
    30                else 
    31                   throw XMLIOStreamException("Impossible de lire le flux en entrée pour le parsing XML !"); 
    32  
    33                return (node); 
    34             } 
    3514 
    3615            string getElementName(void) const 
     
    9776            } 
    9877 
     78            THashAttributes getAttributes(void) const // Idem que précédemment mais avec copie. 
     79            { THashAttributes __attributes; this->getAttributes(__attributes); return (__attributes); } 
     80 
    9981            ~XMLNode() 
    10082            { /* Ne rien faire de plus */ } 
     83 
     84         public : /* static */ 
     85 
     86            static XMLNode CreateNode(std::istream& _istr, const std::string& _rootName) 
     87            { 
     88               XMLNode node(_rootName); 
     89 
     90               if (_istr.good()) 
     91               { // S'il est possible de lire le flux en entrée ... 
     92 
     93                  Poco::XML::InputSource src(_istr); 
     94                  Poco::XML::DOMParser parser; 
     95 
     96                  node.pDoc = parser.parse(&src); 
     97                  node.setCNode(node.pDoc->documentElement()); 
     98                  if (node.getElementName().compare(_rootName) != 0) // << A passer en avertissement. 
     99                     throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)"); 
     100               } 
     101               else 
     102                  throw XMLIOStreamException("Impossible de lire le flux en entrée pour le parsing XML !"); 
     103 
     104               return (node); 
     105            } 
    101106 
    102107         protected : 
     
    104109            Poco::XML::Node * getCNode(void) const { return (this->cNode); } 
    105110            void setCNode(Poco::XML::Node * _otherNode) { this->cNode = _otherNode; } 
     111 
     112         protected : /* static */ 
    106113 
    107114            static bool IsPtrNull(const Poco::XML::Node * const _ptr) { return (_ptr == NULL); } 
     
    120127 
    121128            Poco::XML::AutoPtr<Poco::XML::Document> pDoc; 
    122             Poco::XML::Node*  cNode; 
     129            Poco::XML::Node* cNode; 
    123130 
    124131            string rootName; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio.hpp

    r125 r126  
    1212#include <stack> 
    1313 
    14 //Flux. 
     14// Flux. 
    1515#include <iostream> 
    1616#include <fstream> 
     
    8787#include "NetCDF4_data_output.hpp" 
    8888 
    89 // Traitement des données (abstract puis selon types de sortie) 
    90 #include "abstract_data_treatment.hpp" 
    91 #include "NetCDF4_data_treatment.hpp" 
    92  
    93  
     89// Traitement des données. 
     90#include "data_treatment.hpp" 
    9491 
    9592#endif // __XMLIO__ 
Note: See TracChangeset for help on using the changeset viewer.