Changeset 120 for XMLIO_V2/dev/dev_rv


Ignore:
Timestamp:
09/08/10 15:02:31 (14 years ago)
Author:
hozdoba
Message:

Mise à jour intermédiaire ...
A venir : commit d'une version stable intégrant l'écriture de fichiers NetCDF4.
(en cours de finalisation actuellement)

Location:
XMLIO_V2/dev/dev_rv/src/XMLIO
Files:
5 added
23 edited

Legend:

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

    r119 r120  
    3131            for(_d0.setMonth(1); _d0.getMonth() < d.getMonth(); _d0.setMonth(_d0.getMonth()+1)) 
    3232               nbday += getMonthLength(_d0); 
    33             //std::cout << "nombre de jours : " << nbday << std::endl; 
    3433            return ((((nbday + d.getDay()) * getDayLength() + d.getHour()) 
    3534                     * getHourLength() + d.getMinute()) * getMinuteLength() + d.getSecond()); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_object.hpp

    r112 r120  
    11#ifndef __XMLIO_OBJECT__ 
    2 #define __XMLIO_OBJECT__  
    3  
    4 // Classes utilisées issues de la STL 
    5 using std::pair; 
    6 using std::string; 
    7 using std::ostream; 
    8 using std::ostringstream; 
    9  
    10 // Classes XMLIOSERVER 
    11 using XMLIOSERVER::XMLIOException; 
    12 using XMLIOSERVER::XMLIOUndefinedValueException; 
     2#define __XMLIO_OBJECT__ 
    133 
    144namespace XMLIOSERVER 
    155{ 
    16    class AbstractObject  
     6   class AbstractObject 
    177   { 
    188      public : 
    19        
     9 
     10         const std::string& getId(void) const throw (XMLIOUndefinedValueException) 
     11         { 
     12            if (!hasId()) // Si l'identifiant de l'objet n'est pas défini. 
     13               throw XMLIOSERVER::XMLIOUndefinedValueException("Appel de la méthode AbstractObject::getId invalide."); 
     14            return (id); 
     15         } 
     16 
     17         bool hasId(void) const { return(IdDefined); } 
     18         void resetId(void) { IdDefined = false ;} 
     19         void setId(const std::string& _id) { id = _id ; IdDefined = true ;} 
     20 
     21         bool operator==(const AbstractObject& other) const 
     22         { 
     23            // Si l'un ou l'autre des objets n'a pas d'identifiant, les objets ne sont pas "égaux". 
     24            if(!this->hasId() || !other.hasId()) return false; 
     25            return (id.compare(other.id) == 0); 
     26         } 
     27 
     28         std::string printId(void) const 
     29         { if(hasId()) return (" id=\""+getId()+"\""); return (""); } 
     30 
     31         virtual ~AbstractObject(void) 
     32         {/* Ne rien faire de plus */} 
     33 
     34      protected : 
     35 
    2036         AbstractObject(void) : IdDefined(false) 
    2137         {/* Ne rien faire de plus */} 
    22           
    23          AbstractObject(const string& _id) : id(_id), IdDefined(true) 
    24          {/* Ne rien faire de plus */}       
    25     
    26          const string& getId(void) const throw (XMLIOUndefinedValueException) 
    27          { if (!IdDefined) throw XMLIOUndefinedValueException("Appel de la méthode AbstractObject::getId invalide."); return (id); }    
    28           
    29          bool hasId(void) const { return(IdDefined); } 
    30          void resetId(void) { IdDefined = false ;} 
    31          void setId(const string& _id) { id = _id ; IdDefined = true ;} 
    32           
    33          bool operator==(const AbstractObject& other) 
    34          { 
    35             // Si l'un ou l'autre des objets n'a pas d'identifiant, les objets ne sont pas "égaux". 
    36             if(!this->hasId() or !other.hasId()) return false; 
    37             return (id.compare(other.id) == 0); 
    38          } 
    39           
    40          string printId(void) const 
    41          { if(hasId()) return (" id=\""+getId()+"\""); return (""); } 
    42           
    43          virtual ~AbstractObject(void) 
     38 
     39         AbstractObject(const std::string& _id) : id(_id), IdDefined(true) 
    4440         {/* Ne rien faire de plus */} 
    45        
    46       protected : 
    4741 
    48              
    4942      private : 
    50        
    51          string id ; 
     43 
     44         std::string id ; 
    5245         bool IdDefined ; 
    53        
     46 
    5447   };// class AbstractObject 
    55     
     48 
    5649}// namespace XMLIOSERVER 
    5750 
    58 #endif // __XMLIO_OBJECT__    
     51#endif // __XMLIO_OBJECT__ 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp

    r119 r120  
    77using XMLIOSERVER::XMLIOUndefinedValueException; 
    88using std::ostringstream; 
     9using namespace blitz ; 
    910 
    1011namespace XMLIOSERVER 
    1112{ 
    12    class IStringStream_alt 
    13    { 
    14       public : 
    15          IStringStream_alt(const std::string& str) : iss(str) 
    16          { /* Ne rien faire de plus */} 
    17  
    18          istream& operator>> (std::string& s) 
    19          {s.assign(this->iss.str()); return (this->iss);} 
    20          istream& operator>> (int& s) { return (iss>>s); } 
    21          istream& operator>> (bool& s) 
    22          { 
    23             if(!this->iss.str().compare(string(".TRUE."))) s =  true; 
    24             else s = false; 
    25             return (this->iss); 
    26          } 
    27  
    28       private : 
    29          istringstream iss; 
    30  
    31    }; // class IStringStream_alt 
    32  
    33  
    3413   template <class Ctype> 
    3514      class Attribut : public BaseAttribut 
    3615   { 
    3716      public : 
    38  
    3917         operator Ctype() const 
    4018         { 
    41             if (!hasValue) throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !"); 
     19            if (!_hasValue) throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !"); 
    4220            return (value) ; 
    4321         } 
    4422 
    45          virtual bool _hasValue() const { return (hasValue); } 
     23         Ctype* operator ->() { return (&value) ; } 
     24         Ctype& operator *() { return (value) ; } 
    4625 
    47       protected : 
     26         virtual bool hasValue() const { return (_hasValue); } 
     27         virtual const char * getType(void) const = 0; 
    4828 
    49          Attribut(void) : hasValue(false) {} ; 
    50          Attribut(const Ctype& value_) : hasValue(true), value(value_) {} ; 
     29         Attribut(void) : _hasValue(false) {} ; 
     30         Attribut(const Ctype& value_) : _hasValue(true), value(value_) {} ; 
    5131 
    52          Attribut(const Attribut& attr) : hasValue(attr.hasValue) 
    53          {  if (hasValue) value=attr.value ; } 
     32         Attribut(const Attribut& attr) : _hasValue(attr._hasValue) 
     33         {  if (_hasValue) value = attr.value ; } 
    5434 
    5535         Attribut& operator = (const Attribut & attr) 
    5636         { 
    57             hasValue=attr.hasValue ; 
    58             if (hasValue) value=attr.value ; 
    59             return *this ; 
     37            _hasValue = attr._hasValue ; 
     38            if (_hasValue) setValue(attr.value) ; 
     39            return (*this) ; 
    6040         } 
    6141 
    62          virtual const char * getType(void) const = 0; 
    63  
    64          virtual void setFromString(const std::string str) 
     42         virtual void setFromString(const std::string& str) 
    6543         { 
    66             IStringStream_alt iss(str); Ctype val; 
     44            istringstream iss(str); Ctype val; 
    6745            iss >> val; 
    6846            this->setValue(val); 
     
    7048 
    7149         virtual void assignValue(const BaseAttribut* _ba) 
    72          { value = ((Attribut*)_ba) -> value; hasValue = true; } 
     50         { value = ((Attribut*)_ba) -> value; _hasValue = true; } 
    7351 
    7452         virtual ostream& print(ostream & o) const 
    75          { if (hasValue) o << " " << getName() << "=\"" << boolalpha << value << "\"" ; return o ; } 
     53         { if (_hasValue) o << " " << getName() << "=\"" << boolalpha << value << "\"" ; return o ; } 
    7654 
    7755         virtual void setValue(const Ctype & value_) 
    78          { hasValue=true ; value=value_ ; } 
     56         { _hasValue = true ; value = value_ ;} 
    7957 
    8058         virtual void getValue(Ctype & value_) const 
    8159         { 
    82             if (!hasValue) throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !"); 
    83             value_=value ; 
     60            if (!_hasValue) throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !"); 
     61            value_ = value ; 
    8462         } 
    8563 
    8664      private : 
    8765 
    88          bool hasValue ; 
     66         bool _hasValue ; 
    8967         Ctype value ; 
    9068 
    9169   }; // class Attribut 
     70 
     71#define SET_ARRAY_DIM(type,dim)                                              \ 
     72   template<>                                                                \ 
     73      void Attribut<Array<type,dim> >::setValue (const Array<type,dim>& val) \ 
     74   { _hasValue = true ; value.resize(val.shape()); value = val ; } 
     75 
     76#define SET_ARRAY_TYPE(type) \ 
     77   SET_ARRAY_DIM(type,1)     \ 
     78   SET_ARRAY_DIM(type,2)     \ 
     79   SET_ARRAY_DIM(type,3)     \ 
     80   SET_ARRAY_DIM(type,4) 
     81 
     82   SET_ARRAY_TYPE(double) 
     83   SET_ARRAY_TYPE(int) 
     84   SET_ARRAY_TYPE(bool) 
     85 
     86   template <> 
     87      void Attribut<bool>::setFromString(const std::string& str) 
     88   { 
     89      istringstream iss(str) ; 
     90      bool val = (! iss.str().compare(string(".TRUE."))) ? true : false; 
     91      this->setValue(val); 
     92   } 
     93 
     94   template <> 
     95      void Attribut<string>::setFromString(const std::string& str) 
     96   { this->setValue(str); } 
     97 
    9298} // namespace XMLIOSERVER 
    9399 
    94100#endif //__ATTRIBUT__ 
    95  
    96  
  • XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp

    r114 r120  
    4545            for(unsigned int i = 0; i < _lattr.getVectorSize(); i++) 
    4646            { 
    47                if(_lattr.getVector()[i]->_hasValue() or !_pattr.getVector()[i]->_hasValue()) continue; 
     47               if(_lattr.getVector()[i]->hasValue() or !_pattr.getVector()[i]->hasValue()) continue; 
    4848               _lattr.getVector()[i]->assignValue(_pattr.getVector()[i]); 
    4949            } 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/axis_attribut.hpp

    r110 r120  
    11#ifndef __AXIS_ATTRIBUT__ 
    22#define __AXIS_ATTRIBUT__ 
     3 
     4using namespace blitz ; 
    35 
    46namespace XMLIOSERVER 
     
    1113         DECLARE_ATTR(description, string) ; 
    1214         DECLARE_ATTR(unit, string) ; 
    13          DECLARE_ATTR(size_axis, int) ; 
     15         DECLARE_ATTR(size, int) ; 
     16         DECLARE_ATTR(value, Array(double,1)) ; 
    1417 
    1518         AxisAttribut(void) : AttributRegistrar() 
     
    2326            RegisterAttribut(&description) ; 
    2427            RegisterAttribut(&unit) ; 
    25             RegisterAttribut(&size_axis) ; 
     28            RegisterAttribut(&size) ; 
     29            RegisterAttribut(&value) ; 
    2630         } 
    2731 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/base_attribut.hpp

    r114 r120  
    2424 
    2525         virtual void assignValue(const BaseAttribut*) = 0; 
    26          virtual void setFromString(const std::string str) = 0; 
    27          virtual bool _hasValue() const = 0; 
     26         virtual void setFromString(const std::string&) = 0; 
     27         virtual bool hasValue() const = 0; 
    2828 
    2929#define  SETTER_AND_GETTER(TYPE) \ 
     
    3232         virtual void setValue(const Array<TYPE,2>& value)  { error_set() ; }\ 
    3333         virtual void setValue(const Array<TYPE,3>& value)  { error_set() ; }\ 
     34         virtual void setValue(const Array<TYPE,4>& value)  { error_set() ; }\ 
    3435         virtual void getValue(TYPE & value)         const  { error_get() ; }\ 
    3536         virtual void getValue(Array<TYPE,1>& value) const  { error_get() ; }\ 
    3637         virtual void getValue(Array<TYPE,2>& value) const  { error_get() ; }\ 
    37          virtual void getValue(Array<TYPE,3>& 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() ; } 
    3840 
    3941         SETTER_AND_GETTER(int) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp

    r119 r120  
    1212   try 
    1313   { 
    14       /*string file("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_test.xml"); 
     14      string file("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_test.xml"); 
    1515      //string file("/local/XMLIOSERVER_DEV/dev_rv/iodef_test.xml"); 
    1616 
     
    2323 
    2424      // On résoud les héritages descendants ainsi que les héritages par référence. 
    25       Context::ResolveInheritance();*/ 
     25      //Context::ResolveInheritance(); // Plus nécessaire!! 
    2626 
     27      // On se place dans le contexte 'context1'. 
     28      Context::SetCurrentContext("context1") ; 
     29 
     30      // On crée une instance de traitement de données dans le format NetCDF4. 
     31      AbstractDataTreatment *dtreat = new NetCDF4DataTreatment(Context::GetObject("context1")); 
     32 
     33      // Affichage de la liste des fichiers à sortir (par id). 
     34      dtreat->printEnabledFilesId(); 
     35 
     36      // On écrit l'arborescence résultante du traitement sur la sortie. 
     37      //Context::ShowTree(std::clog); 
     38 
     39      delete dtreat; 
     40 
     41   } 
     42   catch(const Exception &exc) 
     43   {  // Pour tout type d'exceptions, on note les informations sur la sortie paramétrée. 
     44      ERROR(exc.displayText()); 
     45      // On retourne le code d'erreur en fin d'application pour traitements éventuels. 
     46      // return (exc.code()); 
     47   } 
     48 
     49// return (0); 
     50} 
     51 
     52 
     53      /* CODE TEST POUR CALENDRIER 
    2754      AbstractCalendar* calendar = new GregorianCalendar(); 
     55 
    2856      Date dd (*calendar, 2000, 05, 03, 00, 00, 00) ; 
    2957      Date ddd(*calendar, 2030, 11, 02, 10, 33, 40) ; 
     
    6189 
    6290      delete calendar; 
     91      */ 
    6392 
    64       //On écrit l'arborescence résultante du traitement sur la sortie. 
    65       //Context::ShowTree(std::clog); 
    66  
    67    } 
    68    catch(const Exception &exc) 
    69    {  // Pour tout type d'exceptions, on note les informations sur la sortie paramétrée. 
    70       ERROR(exc.displayText()); 
    71       // On retourne le code d'erreur en fin d'application pour traitements éventuels. 
    72       // return (exc.code()); 
    73    } 
    74  
    75 // return (0); 
    76 } 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/calendar.hpp

    r119 r120  
    99         JulianCalendar() : AbstractCalendar("Julian") 
    1010         {/* Ne rien faire de plus */} 
    11          JulianCalendar(const string& dateStr) : AbstractCalendar("Julian", dateStr) 
     11         JulianCalendar(const string& _dateStr) : AbstractCalendar("Julian", _dateStr) 
    1212         {/* Ne rien faire de plus */} 
    1313 
    14          virtual int getYearTotalLength(const Date& d) const 
     14         virtual int getYearTotalLength(const Date& _d) const 
    1515         { // Retourne la durée d'une année en seconde. 
    16             if (d.getYear()%4 == 0) return (366 * 86400); 
     16            if (_d.getYear()%4 == 0) return (366 * 86400); 
    1717            return (365 * 86400); 
    1818         } 
    1919 
    20          virtual int getMonthLength(const Date& d) const 
     20         virtual int getMonthLength(const Date& _d) const 
    2121         { // Retourne la durée du mois en jour. 
    22             if (d.getMonth() == 2) 
    23             { if (d.getYear()%4 == 0) return 29; return 28; } 
    24             return AbstractCalendar::getMonthLength(d); 
     22            if (_d.getMonth() == 2) 
     23            { if (_d.getYear()%4 == 0) return 29; return 28; } 
     24            return (AbstractCalendar::getMonthLength(_d)); 
    2525         } 
    2626 
     
    4949            { // Traitement du cas particulier en Février. 
    5050               if ((d.getYear() % 4 == 0) && (d.getYear() % 100 != 0 || d.getYear() % 400 == 0)) 
    51                   return 29; 
    52                return 28; 
     51                  return (29); 
     52               return (28); 
    5353            } 
    54             return AbstractCalendar::getMonthLength(d); 
     54            return (AbstractCalendar::getMonthLength(d)); 
    5555         } 
    5656 
     
    8282 
    8383         virtual int getMonthLength(const Date& d) const 
    84          { if (d.getMonth() == 2) return (29); return AbstractCalendar::getMonthLength(d); } 
     84         { if (d.getMonth() == 2) return (29); return (AbstractCalendar::getMonthLength(d)); } 
    8585 
    8686         virtual int getYearTotalLength(const Date& d) const { return (366 * 86400); } 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp

    r114 r120  
    11#ifndef __XMLIO_CONTAINER__ 
    22#define __XMLIO_CONTAINER__ 
    3  
    4 // Classes utilisées issues de Poco 
    5 using Poco::HashMap; 
    6 using Poco::Hash; 
    73 
    84// Classes utilisées issues de la STL 
     
    128using std::ostream; 
    139 
    14 // Classes XMLIOSERVER 
    15 using XMLIOSERVER::XMLIOUndefinedValueException; 
    16  
    1710namespace XMLIOSERVER 
    1811{ 
    19    template<class Key, class Mapped, class HashFunc = Hash<Key> > 
     12   template<class Key, class Mapped, class HashFunc = Poco::Hash<Key> > 
    2013      class ExHashMap 
    21          : private HashMap<Key, Mapped*, Hash<Key> > 
     14         : private Poco::HashMap<Key, Mapped*, Poco::Hash<Key> > 
    2215   { 
    2316      public : 
    24  
    25          ExHashMap() :  HashMap<Key, Mapped*, Hash<Key> >(), _elemList() 
    26          {/* Ne rien faire de plus */} 
    2717 
    2818         Mapped* operator[] (const Key& kval) throw (XMLIOUndefinedValueException) 
    2919         { 
    3020            if(!hasMappedValue(kval)) 
    31                throw XMLIOUndefinedValueException("Appel de la méthode ExHashMap::operator["+kval+"] invalide."); 
     21               throw XMLIOSERVER::XMLIOUndefinedValueException("Appel de la méthode ExHashMap::operator["+kval+"] invalide."); 
    3222            return (find(kval)->second); 
    3323         } 
     
    4434 
    4535      protected : 
     36 
     37         ExHashMap() :  Poco::HashMap<Key, Mapped*, Poco::Hash<Key> >(), _elemList() 
     38         {/* Ne rien faire de plus */} 
    4639 
    4740         bool addValue(const Key& kval, Mapped* element) 
     
    7770   template<class Mapped> 
    7871      class StrHashMap 
    79          : public ExHashMap<string, Mapped, Hash<string> > 
     72         : public ExHashMap<string, Mapped, Poco::Hash<string> > 
    8073   { 
    8174      public : 
    8275 
    83          StrHashMap() :  ExHashMap<string, Mapped, Hash<string> >() 
     76         StrHashMap() :  ExHashMap<string, Mapped, Poco::Hash<string> >() 
    8477         {/* Ne rien faire de plus */} 
    8578 
    8679         bool addObject(Mapped* element) 
    87          { if(element->hasId()) return(addValue(element->getId(), element));   return(addValue(element)); } 
     80         { if(element->hasId()) return(addValue(element->getId(), element)); return(addValue(element)); } 
    8881 
    8982         bool removeObject(const string& kval) 
    9083         { 
    91             if(!ExHashMap<string, Mapped, Hash<string> >::hasMappedValue(kval)) return (false); 
    92             ExHashMap<string, Mapped, Hash<string> >::removeValue(kval); return (true); 
     84            if(!ExHashMap<string, Mapped, Poco::Hash<string> >::hasMappedValue(kval)) return (false); 
     85            ExHashMap<string, Mapped, Poco::Hash<string> >::removeValue(kval); return (true); 
    9386         } 
    9487 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp

    r119 r120  
    2222            os << NIndent << "<"<< Context::GetRootName() << ">" << std::endl; 
    2323 
    24             HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    25             for (HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     24            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
     25            for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
    2626               // On sort chacun des contextes successivement. 
    2727            { Context::SetCurrentContext((*it).first); os << *((*it).second)[(*it).first] << std::endl; } 
     
    3232         static void FreeMemory(void) 
    3333         { 
    34             HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    35             for (HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     34            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
     35            for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
    3636            { Context::SetCurrentContext((*it).first); delete ((*it).second)[(*it).first]; } 
    3737         } 
    3838 
     39         // Ne plus utiliser, disponible dans les classe treatment. 
    3940         static void ResolveInheritance(void) 
    4041         { 
    41             HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    42             for (HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
     42            Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
     43            for (Poco::HashMap<string, StrHashMap<Context> >::Iterator it = AllListContext.begin(); it != AllListContext.end(); it++) 
    4344            { 
    4445               // Résolution des héritages descendants (càd des héritages de groupes) pour chacun des contextes. 
     
    5859 
    5960            // Changement de context pour les champs et groupes de champs. 
    60             FieldGroup::SetContext(id); 
    61             CField::SetContext(id); 
     61            FieldGroup::SetContext(id); CField::SetContext(id); 
    6262 
    6363            // Changement de context pour les fichiers et groupes de fichiers. 
    64             FileGroup::SetContext(id); 
    65             CFile::SetContext(id); 
     64            FileGroup::SetContext(id);  CFile::SetContext(id); 
    6665 
    6766            // Changement de context pour les grilles et groupes de grilles. 
    68             GridGroup::SetContext(id); 
    69             CGrid::SetContext(id); 
     67            GridGroup::SetContext(id);  CGrid::SetContext(id); 
    7068 
    7169            // Changement de context pour les axes et groupes d'axes. 
    72             AxisGroup::SetContext(id); 
    73             CAxis::SetContext(id); 
     70            AxisGroup::SetContext(id);  CAxis::SetContext(id); 
    7471         } 
    7572 
     
    107104                  { gridDef  = CreateInstanceAndParse<GridDefinition >(_node, GridDefinition ::GetDefName().c_str()); continue; } 
    108105 
    109                   WARNING("La définition est invalide, seules les champs, grilles, axes et fichiers peuvent être définis !"); 
     106                  WARNING("La définition est invalide, seuls les champs, grilles, axes et fichiers peuvent être définis !"); 
    110107 
    111108               } while (_node.goToNextElement()); 
     
    115112         } 
    116113 
    117          static string GetName(void) {return ("context"); } 
    118          static string GetRootName(void) {return ("simulation"); } 
     114         static string GetName(void)     { return ("context"); } 
     115         static string GetRootName(void) { return ("simulation"); } 
    119116 
    120117         virtual bool hasChild(void) const 
     
    129126         } 
    130127 
    131          virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) 
     128         virtual void resolveDescInheritance(const AttributRegistrar* const _parent = 0) 
    132129         { 
    133130            if (_parent != 0) return; 
     
    145142 
    146143         AbstractCalendar * getCalendar(void) const { return (this->ccalendar ); } 
    147          AbstractCalendar * setCalendar(const string& _calName, const string& dateStr) 
     144         AbstractCalendar * setCalendar(const string& _calName, const string& _dateStr) 
    148145         { 
    149146            if (_calName.compare("D360")      == 0) 
    150                return (ccalendar = new D360Calendar(dateStr)); 
     147               return (ccalendar = new D360Calendar(_dateStr)); 
    151148            if (_calName.compare("AllLeap")   == 0) 
    152                return (ccalendar = new AllLeapCalendar(dateStr)); 
     149               return (ccalendar = new AllLeapCalendar(_dateStr)); 
    153150            if (_calName.compare("NoLeap")    == 0) 
    154                return (ccalendar = new NoLeapCalendar(dateStr)); 
     151               return (ccalendar = new NoLeapCalendar(_dateStr)); 
    155152            if (_calName.compare("Julian")    == 0) 
    156                return (ccalendar = new JulianCalendar(dateStr)); 
     153               return (ccalendar = new JulianCalendar(_dateStr)); 
    157154            if (_calName.compare("Gregorian") == 0) 
    158                return (ccalendar = new GregorianCalendar(dateStr)); 
     155               return (ccalendar = new GregorianCalendar(_dateStr)); 
    159156 
    160157            WARNING("L'identifiant "+_calName+" est inconnu, le calendrier grégorien sera choisi par défault pour le contexte "+getId()); 
    161158 
    162             return (ccalendar = new GregorianCalendar(dateStr)); 
     159            return (ccalendar = new GregorianCalendar(_dateStr)); 
    163160         } 
    164161 
     
    166163         { 
    167164            // Désallocation dynamique de mémoire pour chacun des groupes de définition si nécessaire. 
    168             if(fieldDef != NULL) delete fieldDef; 
    169             if(fileDef  != NULL) delete fileDef; 
    170             if(axisDef  != NULL) delete axisDef; 
    171             if(gridDef  != NULL) delete gridDef; 
     165            if(fieldDef != NULL) delete fieldDef; if(fileDef  != NULL) delete fileDef ; 
     166            if(axisDef  != NULL) delete axisDef ; if(gridDef  != NULL) delete gridDef ; 
     167 
    172168            // Désallocation dynamique de mémoire pour le calendrier associé au contexte courant si nécessaire. 
    173169            if(ccalendar !=  NULL) delete ccalendar; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/date.hpp

    r119 r120  
    2727         friend std::ostream& operator<<(std::ostream& out, const Date& d) 
    2828         { 
    29             out << d.day  << "/" << d.month  << "/" << d.year   << "-" 
    30                 << d.hour << ":" << d.minute << ":" << d.second; 
     29            out << d.day  << '/' << d.month  << '/' << d.year   << '-' 
     30                << d.hour << ':' << d.minute << ':' << d.second; 
    3131            return (out); 
    3232         } 
     
    6060            if (month == 0 ) { year--; month = 12; } 
    6161         } 
     62 
    6263         void setYear  (int newyear)  { year  = newyear; } 
    6364 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp

    r108 r120  
    33 
    44#include "attribut.hpp" 
     5 
     6#define Array(x,y) Array<x,y> 
    57 
    68#define DECLARE_ATTR(att_name,att_type)               \ 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field.hpp

    r114 r120  
    77namespace XMLIOSERVER 
    88{ 
     9   class CGrid; // CGRID = CDOMAINE + CAXIS 
     10 
    911   class CField : public ObjectTemplate<CField>, public FieldAttribut 
    1012   { 
    1113      public: 
    1214 
    13          CField(void) : ObjectTemplate<CField>(), FieldAttribut() 
     15         CField(void) : ObjectTemplate<CField>(), FieldAttribut(), grid(NULL) 
    1416         {/* Ne rien faire de plus */} 
    15          CField(const string& _id) : ObjectTemplate<CField>(_id), FieldAttribut() 
     17         CField(const string& _id) : ObjectTemplate<CField>(_id), FieldAttribut(), grid(NULL) 
    1618         {/* Ne rien faire de plus */} 
    1719 
    1820         static string GetName(void) {return ("field"); } 
    1921 
     22         inline void SolveGridRef(void) ; 
     23 
     24         CGrid* getGrid(void) const { return (grid); } 
     25 
    2026         virtual CField* getReference(void) const 
    2127         { 
    22             if(!field_ref._hasValue()) return (NULL); 
     28            if(!field_ref.hasValue()) return (NULL); 
    2329            if (!CField::HasObject(field_ref)) 
    2430            { WARNING("Référence invalide sur l'objet "+GetName()+" nommé \""+((string)field_ref)+"\""); return (NULL);} 
    2531 
    26             return (&CField::GetObject(field_ref)); 
     32            return (CField::GetObject(field_ref)); 
    2733         } 
    2834 
    2935         virtual ~CField(void) 
    3036         { /* Ne rien faire de plus */ } 
     37 
     38      private : 
     39 
     40         CGrid* grid ; 
    3141 
    3242   }; // class CField 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field_attribut.hpp

    r107 r120  
    1919         DECLARE_ATTR(enabled, bool); 
    2020 
     21         DECLARE_ATTR(domain_ref, string); 
    2122         DECLARE_ATTR(axis_ref, string); 
    22          DECLARE_ATTR(grid_ref, string); 
     23         DECLARE_ATTR(grid_ref, string) ; 
    2324         DECLARE_ATTR(zoom_ref, string); 
    2425         DECLARE_ATTR(field_ref, string); 
     
    4142            RegisterAttribut(&enabled); 
    4243 
     44            RegisterAttribut(&domain_ref); 
    4345            RegisterAttribut(&axis_ref); 
    4446            RegisterAttribut(&grid_ref); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp

    r114 r120  
    1111      public: 
    1212 
    13          CFile(void) : ObjectTemplate<CFile>(), FileAttribut(), vfieldGroup(NULL) 
     13         CFile(void) : ObjectTemplate<CFile>(), FileAttribut(), vfieldGroup(NULL), enabledFields() 
    1414         {/* Ne rien faire de plus */} 
    15          CFile(const string& _id) : ObjectTemplate<CFile>(_id), FileAttribut(), vfieldGroup(NULL) 
     15         CFile(const string& _id) : ObjectTemplate<CFile>(_id), FileAttribut(), vfieldGroup(NULL), enabledFields() 
    1616         {/* Ne rien faire de plus */} 
    1717 
     
    3737 
    3838         void getAllFields(std::vector<CField*>& _allF) const {  if (vfieldGroup!=NULL) vfieldGroup->getAllChildren(_allF); } 
     39 
    3940         virtual bool hasChild(void) const { return (vfieldGroup != NULL); } 
     41 
    4042         virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } 
    4143         /*{ // Sortie sans affichage des groupes. 
     
    4446               out << *(allF[i]) << std::endl; 
    4547         }*/ 
     48 
    4649         virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) 
    4750         { addAttributes(*_parent); if(vfieldGroup != NULL) vfieldGroup->resolveDescInheritance(); } 
     
    5558         FieldGroup* getVirtualFieldGroup(void) { return (vfieldGroup); } 
    5659 
     60         void findEnabledFields(int default_outputlevel = 5, int default_level = 1, bool default_enabled = true ) 
     61         { 
     62            const int _outputlevel = (output_level.hasValue()) ? (int)output_level : default_outputlevel; 
     63            std::vector<CField*>::iterator it; 
     64 
     65            getAllFields(enabledFields); 
     66 
     67            for ( it = enabledFields.begin() ; it < enabledFields.end(); it++ ) 
     68            { 
     69               if ((*it)->enabled.hasValue()) // Si l'attribut 'enabled' est défini ... 
     70               { 
     71                  if (! ((*it)->enabled)) 
     72                  { enabledFields.erase(it); continue; } 
     73               } 
     74               else // Si l'attribut 'enabled' n'est pas défini ... 
     75               { 
     76                  if (!default_enabled) 
     77                  { enabledFields.erase(it); continue; } 
     78               } 
     79 
     80               if ((*it)->level.hasValue()) // Si l'attribut 'level' est défini ... 
     81               { 
     82                  if ((*it)->level > _outputlevel) 
     83                  { enabledFields.erase(it); continue; } 
     84               } 
     85               else // Si l'attribut 'level' n'est pas défini ... 
     86               { 
     87                  if (default_level > _outputlevel) 
     88                  { enabledFields.erase(it); continue; } 
     89               } 
     90 
     91            } 
     92         } 
     93 
    5794         virtual  ~CFile(void) 
    5895         { if(vfieldGroup != NULL) delete vfieldGroup; } 
     
    6198 
    6299         FieldGroup* vfieldGroup; // FieldGroup "virtuel" 
     100         std::vector<CField*> enabledFields; 
    63101 
    64102   }; // class CFile 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp

    r114 r120  
    77namespace XMLIOSERVER 
    88{ 
    9    class CGrid: public ObjectTemplate<CGrid>, public GridAttribut 
     9   class CGrid : public ObjectTemplate<CGrid>, public GridAttribut 
    1010   { 
    1111      public: 
    1212 
    13          CGrid(void) : ObjectTemplate<CGrid>(), GridAttribut() 
    14          {/* Ne rien faire de plus */} 
    15          CGrid(const string& _id) : ObjectTemplate<CGrid>(_id), GridAttribut() 
    16          {/* Ne rien faire de plus */} 
     13         CGrid(void) : ObjectTemplate<CGrid>(), GridAttribut(), hasAxis(false), axis(NULL), domain(NULL) 
     14         { /* Ne rien faire de plus */ } 
     15         CGrid(const string& _id) : ObjectTemplate<CGrid>(_id), GridAttribut(), hasAxis(false), axis(NULL), domain(NULL) 
     16         { /* Ne rien faire de plus */ } 
    1717 
    1818         static string GetName(void) { return ("grid"); } 
     19 
     20         inline void solveReference(void) ; 
     21         inline void solveDomainRef(void) ; 
     22         inline void solveAxisRef(void) ; 
     23 
     24         inline void computeIndex(void); 
     25 
     26         inline void storeField(const Array<double,1>& field, Array<double,1>& stored); 
     27         inline void storeField(const Array<double,2>& field, Array<double,1>& stored); 
     28         inline void storeField(const Array<double,3>& field, Array<double,1>& stored); 
     29         inline void storeField(const double* const data, Array<double,1>& stored); 
     30 
     31         inline void outputField(const Array<double,1>& stored, Array<double,2>& outField); 
     32         inline void outputField(const Array<double,1>& stored, Array<double,3>& outField); 
     33 
     34         inline static CGrid* CreateObject(const CDomain* const a_domain, const CAxis* const a_axis); 
     35         inline static CGrid* CreateObject(const CDomain* const a_domain); 
    1936 
    2037         virtual ~CGrid(void) 
    2138         { /* Ne rien faire de plus */ } 
    2239 
     40 
     41      private: 
     42 
     43         bool hasAxis ; 
     44 
     45         CAxis* axis ; 
     46         CDomain* domain ; 
     47 
     48         Array<int,1> storeIndex ; 
     49         Array<int,1> out_i_index ; 
     50         Array<int,1> out_j_index ; 
     51         Array<int,1> out_l_index ; 
     52 
    2353   }; // class CGrid 
    2454 
     55 
     56   CGrid* CGrid::CreateObject(const CDomain* const a_domain, const CAxis* const a_axis) 
     57   { 
     58      string new_id = string("___") + a_domain->getId() + string("_") + a_axis->getId() + string("__") ; 
     59      CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 
     60 
     61      grid->domain_ref = a_domain->getId() ; 
     62      grid->axis_ref = a_axis->getId() ; 
     63 
     64      return (grid); 
     65   } 
     66 
     67   CGrid* CGrid::CreateObject(const CDomain* const a_domain) 
     68   { 
     69      string new_id = string("___") + a_domain->getId() + string("__") ; 
     70      CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 
     71 
     72      grid->domain_ref = a_domain->getId() ; 
     73 
     74      return (grid); 
     75   } 
     76 
     77   void CGrid::solveReference(void) 
     78   { 
     79      static bool isReferenceSolved = false; 
     80      if (isReferenceSolved) return; 
     81 
     82      // Résolution de chacune des références et indexation. 
     83      solveDomainRef() ; 
     84      solveAxisRef() ; 
     85      computeIndex() ; 
     86 
     87      isReferenceSolved = true ; 
     88   } 
     89 
     90   void CGrid::solveDomainRef(void) 
     91   { 
     92      if (domain_ref.hasValue()) 
     93      { 
     94         if (CDomain::HasObject(domain_ref)) 
     95         { 
     96           domain=CDomain::GetObject(domain_ref) ; 
     97           domain->check() ; 
     98         } 
     99         else ERROR("Référence au domaine incorrecte") ; 
     100      } 
     101      else ERROR("Domaine non défini") ; 
     102   } 
     103 
     104   void CGrid::solveAxisRef(void) 
     105   { 
     106      if (axis_ref.hasValue()) 
     107      { 
     108         hasAxis = true ; 
     109         if (CAxis::HasObject(axis_ref)) axis = CAxis::GetObject(axis_ref) ; 
     110         else ERROR("Référence a l'axe incorrecte") ; 
     111      } 
     112      else hasAxis = false ; // hasAxis est normalement déjà à false(?). 
     113   } 
     114 
     115   void CGrid::computeIndex(void) 
     116   { 
     117      int ni = domain->ni ; 
     118      int nj = domain->nj ; 
     119      int size = (hasAxis) ? (int)axis->size : 1 ; 
     120      int data_dim = domain->data_dim ; 
     121      int data_n_index = domain->data_n_index ; 
     122      int data_ibegin  = domain->data_ibegin ; 
     123      int data_jbegin  = (data_dim == 2) ? (int)domain->data_jbegin : -1; 
     124 
     125      Array<int,1>& data_i_index =* domain->data_i_index ; 
     126      Array<int,1>& data_j_index =* domain->data_j_index ; 
     127      Array<bool,2>& mask =* domain->mask ; 
     128      int i, j, l, n ; 
     129      int count, indexCount ; 
     130 
     131      for(indexCount=0, l=0; l<size ; l++) 
     132      { 
     133         for(n=0, indexCount=0; n<data_n_index; n++) 
     134         { 
     135            if (data_dim == 1) 
     136            { 
     137               i = (data_i_index(n) + data_ibegin) % ni ; 
     138               j = (data_i_index(n) + data_ibegin) / ni ; 
     139               cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ; 
     140            } 
     141            else 
     142            { 
     143               i = data_i_index(n) + data_ibegin ; 
     144               j = data_j_index(n) + data_jbegin ; 
     145               cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ; 
     146            } 
     147 
     148            if (i>=0 && i<ni && j>=0 && j<nj && mask(i,j) ) indexCount++ ; 
     149         } 
     150      } 
     151 
     152      storeIndex.resize(indexCount) ; 
     153      out_l_index.resize(indexCount) ; 
     154      out_i_index.resize(indexCount) ; 
     155      out_j_index.resize(indexCount) ; 
     156 
     157      for(count=0, indexCount=0, l=0; l<size; l++) 
     158      { 
     159         for(n=0; n<data_n_index; n++) 
     160         { 
     161            if (data_dim == 1) 
     162            { 
     163               i = (data_i_index(n) + data_ibegin) % ni ; 
     164               j = (data_i_index(n) + data_ibegin) / ni ; 
     165            } 
     166            else 
     167            { 
     168               i = data_i_index(n) + data_ibegin ; 
     169               j = data_j_index(n) + data_jbegin ; 
     170            } 
     171 
     172            if (i>=0 && i<ni && j>=0 && j<nj && mask(i,j)) 
     173            { 
     174               storeIndex(indexCount) = n ; 
     175               out_l_index(indexCount) = l ; 
     176               out_i_index(indexCount) = i ; 
     177               out_j_index(indexCount) = j ; 
     178               indexCount++ ; 
     179            } 
     180            count++ ; 
     181         } 
     182      } 
     183 
     184      cout << "Out of CGrid::ComputeIndex" << endl ; 
     185      cout << storeIndex << endl ; 
     186      cout << out_i_index << endl ; 
     187      cout << out_j_index << endl ; 
     188      cout << out_l_index << endl ; 
     189   } 
     190 
     191   void CGrid::storeField(const Array<double, 1>& field, Array<double, 1>& stored) 
     192   { 
     193      storeField(field.dataFirst(), stored) ; 
     194      //cout<<"Stored 1"<<stored<<endl ; 
     195   } 
     196 
     197   void CGrid::storeField(const Array<double, 2>& field, Array<double, 1>& stored) 
     198   { 
     199      storeField(field.dataFirst(), stored) ; 
     200      //cout<<"Stored 2"<<stored<<endl ; 
     201   } 
     202 
     203   void CGrid::storeField(const Array<double, 3>& field, Array<double, 1>& stored) 
     204   { 
     205      storeField(field.dataFirst(), stored) ; 
     206      //cout<<"Stored 3"<<stored<<endl ; 
     207   } 
     208 
     209   void CGrid::storeField(const double* const data, Array<double, 1>& stored) 
     210   { 
     211      int size = storeIndex.size() ; 
     212      //cout << "size " << size << endl ; 
     213 
     214      stored.resize(shape(size)) ; 
     215      //cout << "Stored " << stored << endl ; 
     216 
     217      for(int i = 0; i < size; i++) stored(i) = data[storeIndex(i)] ; 
     218      //cout << "Stored " << stored << endl ; 
     219   } 
     220 
     221   void CGrid::outputField(const Array<double, 1>& stored, Array<double, 2>& outField) 
     222   { 
     223      for(int n = 0; n < storeIndex.size(); n++) 
     224         outField(out_i_index(n), out_j_index(n)) = stored(n) ; 
     225   } 
     226 
     227   void CGrid::outputField(const Array<double, 1>& stored, Array<double, 3>& outField) 
     228   { 
     229      for(int n = 0; n < storeIndex.size(); n++) 
     230         outField(out_i_index(n), out_j_index(n), out_l_index(n)) = stored(n) ; 
     231   } 
    25232} // namespace XMLIOSERVER 
    26233 
     234 
    27235DECLARE_GROUP(Grid) 
    28236 
     237 
     238 
    29239#endif // __GRID__ 
    30240 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/grid_attribut.hpp

    r110 r120  
    1010         DECLARE_ATTR(name, string) ; 
    1111         DECLARE_ATTR(description, string) ; 
     12         DECLARE_ATTR(domain_ref, string) ; 
     13         DECLARE_ATTR(axis_ref, string) ;  
    1214 
    1315         GridAttribut(void) : AttributRegistrar() 
     
    2022            RegisterAttribut(&name) ; 
    2123            RegisterAttribut(&description) ; 
     24            RegisterAttribut(&domain_ref) ; 
     25            RegisterAttribut(&axis_ref) ; 
    2226         } 
    2327 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp

    r115 r120  
    4141            // on complÚte les attributs des enfants. 
    4242               childvect[i] -> resolveDescInheritance(this); 
     43 
    4344            for(unsigned int i = 0; i < groupvect.size() ; i++) 
    4445            // on complÚte les attributs des groupes enfants. 
     
    4849         GroupTemplate<T, U>& createGroup(const string& _id) throw (XMLIOUndefinedValueException) 
    4950         { 
    50             GroupTemplate<T, U> &obj = GroupTemplate<T, U>::CreateObject(_id); 
     51            GroupTemplate<T, U> &obj = *GroupTemplate<T, U>::CreateObject(_id); 
    5152            groupList.addObject(&obj); 
    5253 
     
    5657         GroupTemplate<T, U>& createGroup(void) 
    5758         { 
    58             GroupTemplate<T, U>& obj = GroupTemplate<T, U>::CreateObject(); 
     59            GroupTemplate<T, U>& obj = *(GroupTemplate<T, U>::CreateObject()); 
    5960            groupList.addObject(&obj); 
    6061 
     
    7374         T& createChild(const string& _id) throw (XMLIOUndefinedValueException) 
    7475         { 
    75             T& obj = ObjectTemplate<T>::CreateObject(_id); 
     76            T& obj = *ObjectTemplate<T>::CreateObject(_id); 
    7677            childList.addObject(&obj); 
    7778            return (obj); 
     
    8081         T& createChild(void) 
    8182         { 
    82             T& obj = ObjectTemplate<T>::CreateObject(); 
     83            T& obj = *ObjectTemplate<T>::CreateObject(); 
    8384            childList.addObject(&obj); 
    8485            return (obj); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/logger.hpp

    r115 r120  
    4848         } 
    4949 
    50  
    5150         static void ShowBTrace(std::ostream& out = std::clog) 
    5251         { 
     
    9493 
    9594   // Initialisation de la classe de Logging 
    96    static ILogger LOGGER; 
     95   ILogger LOGGER; 
    9796 
    9897   ///////////////////////////////////////////////////////////////////// 
    99    static unsigned int Indent = 0; 
    100    static const char*  Increm = "   "; 
     98   unsigned int Indent = 0; 
     99   const char*  Increm = "   "; 
    101100 
    102101   std::ostream& NIndent(std::ostream& out) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp

    r115 r120  
    2727 
    2828            if (c.baseObject != NULL) 
    29                out <<  IncIndent << "<-- Reference resolved for the following "+ T::GetName() +" : \"" << c.baseObject->getId() << "\" -->" << DecEndl << std::endl; 
     29               out <<  IncIndent << "<-- Reference resolved for the following "+ T::GetName() + 
     30                       " : \"" << c.baseObject->getId() << "\" -->" << DecEndl << std::endl; 
    3031 
    3132            if (c.hasChild()) 
     
    4849 
    4950         virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) { addAttributes(*_parent); } 
    50          virtual void resolveRefInheritance(void) 
     51         virtual void resolveRefInheritance (void) 
    5152         { 
    5253            std::set<T*> sset; 
     
    7677         } 
    7778 
    78          static T& CreateObject(const string& _id) throw (XMLIOUndefinedValueException) 
     79         static T* CreateObject(const string& _id) throw (XMLIOUndefinedValueException) 
    7980         { 
    8081            // Si l'identifiant est répertorié, on retourne l'élément existant. 
     
    8889         } 
    8990 
    90          static T& CreateObject(void) 
     91         static T* CreateObject(void) 
    9192         { 
    9293            T* value = new T; 
    9394            ObjectTemplate<T>::AllListObj[CurrContext].addObject(value); 
    94             return (*value); 
     95            return (value); 
    9596         } 
    9697 
    97          static T& GetObject(const string& _id) throw (XMLIOUndefinedValueException) 
    98          { return (*ObjectTemplate<T>::AllListObj[CurrContext][_id]); } 
     98         static T* GetObject(const string& _id) throw (XMLIOUndefinedValueException) 
     99         { return (ObjectTemplate<T>::AllListObj[CurrContext][_id]); } 
    99100 
    100101         static bool HasObject(const string& _id) 
     
    105106 
    106107         static const StrHashMap<T>& GetCurrentListObject(void) { return (AllListObj[CurrContext]); } 
    107          static HashMap<string, StrHashMap<T> >& GetAllListObject(void) { return (AllListObj); } 
     108         static Poco::HashMap<string, StrHashMap<T> >& GetAllListObject(void) { return (AllListObj); } 
    108109 
    109110         static void SetContext(const string& id){ ObjectTemplate<T>::CurrContext = id; } 
     
    134135               if (V::HasObject(did)) 
    135136                  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!"); 
    136                instance_ptr = (V*)&V::CreateObject(did); 
     137               instance_ptr = (V*)V::CreateObject(did); 
    137138               instance_ptr->parse(_node, parseAttr); 
    138139            } 
     
    144145 
    145146         static string CurrContext; 
    146          static HashMap<string, StrHashMap<T> > AllListObj; 
     147         static Poco::HashMap<string, StrHashMap<T> > AllListObj; 
    147148 
    148149   };// class ObjectTemplate 
    149150 
    150151   template <class T> string ObjectTemplate<T>::CurrContext ; 
    151    template <class T> HashMap<string, StrHashMap<T> > ObjectTemplate<T>::AllListObj; 
     152   template <class T> Poco::HashMap<string, StrHashMap<T> > ObjectTemplate<T>::AllListObj; 
    152153 
    153154}// namespace XMLIOSERVER 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp

    r117 r120  
    22#define __XMLIO_XML_NODE__ 
    33 
    4 // Entêtes Poco DOM 
    5 #include <Poco/DOM/DOMParser.h> 
    6 #include <Poco/DOM/Document.h> 
    7 #include <Poco/DOM/Element.h> 
    8  
    9 #include <Poco/DOM/NamedNodeMap.h> 
    10  
    11 #include <Poco/DOM/AutoPtr.h> 
    12  
    13 // Entêtes Poco SAX. 
    14 #include <Poco/SAX/InputSource.h> 
    15  
    16 // Utilisation de la STL. 
    17 using std::string; 
    18  
    19 using std::pair; 
    20 using std::vector; 
    21  
    22 using std::istream; 
    23 using std::ostream; 
    24 using std::ostringstream; 
    25 using std::ifstream; 
    26  
    27 // Utilisation de la biliothÚque POCO. 
    28 using Poco::XML::DOMParser; 
    29 using Poco::XML::InputSource; 
    30  
    31 using Poco::XML::Document; 
    32 using Poco::XML::Node; 
    33 using Poco::XML::Element; 
    34  
    35 using Poco::XML::NamedNodeMap; 
    36  
    37 using Poco::HashMap; 
    38  
    39 using Poco::XML::AutoPtr; 
    404 
    415namespace XMLIOSERVER 
     
    437   namespace XML 
    448   { 
    45  
    46       typedef HashMap<string, string> THashAttributes; 
     9      typedef Poco::HashMap<std::string, std::string> THashAttributes; 
    4710 
    4811      class XMLNode 
     
    5013         public : 
    5114 
    52             XMLNode(const string& _rootName) : rootName(_rootName) 
    53             { /* Ne rien faire de plus */} 
    54  
    55             static XMLNode CreateNode(istream& _istr, const string& _rootName) 
     15            static XMLNode CreateNode(std::istream& _istr, const std::string& _rootName) 
    5616            { 
    5717               XMLNode node(_rootName); 
     18 
    5819               if (_istr.good()) 
    5920               { // S'il est possible de lire le flux en entrée ... 
    60                   InputSource src(_istr); 
    61                   DOMParser parser; 
     21 
     22                  Poco::XML::InputSource src(_istr); 
     23                  Poco::XML::DOMParser parser; 
    6224 
    6325                  node.pDoc = parser.parse(&src); 
    6426                  node.setCNode(node.pDoc->documentElement()); 
    65                   if (node.getElementName().compare(_rootName) != 0) 
     27                  if (node.getElementName().compare(_rootName) != 0) // << A passer en avertissement. 
    6628                     throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)"); 
    6729               } 
     
    7335 
    7436            string getElementName(void) const 
    75             { string _str(this->getCNode()->nodeName()); return (_toLower(_str)); } 
     37            { 
     38               std::string _str(this->getCNode()->nodeName()); 
     39               return (_toLower(_str)); 
     40            } 
    7641 
    7742            bool goToNextElement(void) 
    7843            { 
    79                Node* nextElement = this->getCNode()->nextSibling(); 
     44               Poco::XML::Node* nextElement = this->getCNode()->nextSibling(); 
    8045 
    8146               // On parcourt la liste des "siblings" jusqu'à trouver un élément quelconque. 
     
    9257            bool goToChildElement(void) 
    9358            { 
    94                Node* nextElement = this->getCNode()->firstChild(); 
     59               Poco::XML::Node* nextElement = this->getCNode()->firstChild(); 
    9560 
    9661               // On parcourt la liste des enfants jusqu'à trouver un élément quelconque. 
     
    9863               { 
    9964                  for(; ; nextElement = nextElement->nextSibling()) 
    100                      if (IsPtrNull(nextElement)) break; 
     65                     if (IsPtrNull(nextElement)) return (false); 
    10166                     else if (nextElement->nodeType() == 1) 
    10267                     {// Si l'un des noeuds est un élément... 
     
    10469                        return (true); 
    10570                     } 
    106                   return (false); 
    10771               } 
    108  
    10972               return (false); 
    11073            } 
     
    11881            } 
    11982 
    120             bool getAttributes(THashAttributes& attributes) const 
     83            bool getAttributes(THashAttributes& _attributes) const 
    12184            { 
    12285               if(!this->getCNode()->hasAttributes()) return (false); 
    123                AutoPtr<NamedNodeMap> map = this->getCNode()->attributes(); 
     86               Poco::XML::AutoPtr<Poco::XML::NamedNodeMap> map = this->getCNode()->attributes(); 
    12487 
    12588               for(unsigned int i = 0; i< map->length(); i++) 
    12689               { // Suppression des espaces en début et fin de valeur d'attribut xml. 
    127                   string _str(map->item(i)->nodeName()); 
     90                  std::string _str(map->item(i)->nodeName()); 
    12891                  size_t d = map->item(i)->nodeValue().find_first_not_of(' '); 
    12992                  size_t f = map->item(i)->nodeValue().find_last_not_of (' '); 
    130                   attributes[_toLower(_str)] = map->item(i)->nodeValue().substr(d,f-d+1); 
     93 
     94                  _attributes[_toLower(_str)] = map->item(i)->nodeValue().substr(d,f-d+1); 
    13195               } 
    13296               return (true); 
     
    138102         protected : 
    139103 
    140             Node* getCNode(void) const { return (this->cNode); } 
    141             void setCNode(Node* other) { this->cNode = other; } 
     104            Poco::XML::Node * getCNode(void) const { return (this->cNode); } 
     105            void setCNode(Poco::XML::Node * _otherNode) { this->cNode = _otherNode; } 
    142106 
    143             static bool IsPtrNull(Node* ptr) { return (ptr==NULL); } 
     107            static bool IsPtrNull(const Poco::XML::Node * const _ptr) { return (_ptr == NULL); } 
    144108 
    145109         private : 
    146110 
    147             const string& _toLower(string& _str) const 
     111            XMLNode(const std::string& _rootName) : rootName(_rootName) 
     112            { /* Ne rien faire de plus */} 
     113 
     114            const string& _toLower(std::string& _str) const 
    148115            { 
    149116               for (unsigned int i = 0; i < _str.size(); i++) 
     
    152119            } 
    153120 
    154             AutoPtr<Document> pDoc; 
    155             Node*  cNode; 
     121            Poco::XML::AutoPtr<Poco::XML::Document> pDoc; 
     122            Poco::XML::Node*  cNode; 
    156123 
    157124            string rootName; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xml_parser.hpp

    r114 r120  
    3535 
    3636                  Context::SetCurrentContext(attributes["id"]); 
    37                   Context& context = Context::CreateObject(attributes["id"]); 
     37                  Context& context = *Context::CreateObject(attributes["id"]); 
    3838 
    3939                  context.parse(_node); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio.hpp

    r118 r120  
    1717#include <Poco/HashMap.h> 
    1818#include <Poco/Hash.h> 
     19 
     20// Entêtes Poco DOM 
     21#include <Poco/DOM/DOMParser.h> 
     22#include <Poco/DOM/Document.h> 
     23#include <Poco/DOM/Element.h> 
     24 
     25#include <Poco/DOM/NamedNodeMap.h> 
     26 
     27#include <Poco/DOM/AutoPtr.h> 
     28 
     29// Entêtes Poco SAX. 
     30#include <Poco/SAX/InputSource.h> 
    1931 
    2032/// Entête Blitz array /// 
     
    4052#include "grid_attribut.hpp" 
    4153#include "axis_attribut.hpp" 
     54#include "domain_attribut.hpp" 
    4255#include "field_attribut.hpp" 
    4356#include "file_attribut.hpp" 
     
    4659#include "declare_group.hpp" 
    4760 
    48 // Prise en charge des champs... 
     61// Prise en charge des champs, fichiers, axes, domaines, grilles ... 
    4962#include "field.hpp" 
    50 // Prise en charge des fichiers ... 
    5163#include "file.hpp" 
    52 // Prise en charge des axes ... 
    5364#include "axis.hpp" 
    54 // Prise en charge des grilles ... 
     65#include "domain.hpp" 
    5566#include "grid.hpp" 
     67 
     68#include "field_gridrefsolver.hpp" 
    5669 
    5770#include "context.hpp" 
    5871#include "xml_parser.hpp" 
    5972 
     73#include "abstract_data_treatment.hpp" 
     74#include "NetCDF4_data_treatment.hpp" 
     75 
    6076#endif // __XMLIO__ 
Note: See TracChangeset for help on using the changeset viewer.