Changeset 188


Ignore:
Timestamp:
05/03/11 15:50:52 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv/src/xmlio
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/calendar.hpp

    r152 r188  
    5858            /// Accesseurs /// 
    5959 
    60             const CDuration& getTimeStep(void) const; 
     60            const CDuration & getTimeStep(void) const; 
    6161 
    6262            const CDate & getInitDate(void) const; 
    6363            CDate & getCurrentDate(void); 
    64  
     64             
     65         public : 
     66          
    6567            //------------------------------------------------------------ 
    6668            virtual int getMonthLength(const CDate & date) const; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp

    r152 r188  
    3535 
    3636      void CDataTreatment::doTreatment(void) 
    37       { 
     37      {          
     38         // Résolution du calendrier 
     39         this->currentContext->solveCalendar();          
     40          
    3841         // Résolution des héritages pour le context actuel. 
    3942         //std::cout << "(Message temporaire) Résolution des héritages ..." << std::endl; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/date.cpp

    r152 r188  
    143143      //---------------------------------------------------------------- 
    144144 
    145       CDate FromString(const StdString & str, const CCalendar & calendar) 
     145      CDate CDate::FromString(const StdString & str, const CCalendar & calendar) 
    146146      { 
    147147         CDate dt(calendar); 
     
    150150         return dt; 
    151151      } 
     152       
     153      //---------------------------------------------------------------- 
     154       
     155       StdString CDate::toString(void) const 
     156      {  
     157         StdOStringStream oss; 
     158         oss << (*this); 
     159         return (oss.str());  
     160      } 
    152161 
    153162      ///--------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/src/xmlio/date/d360.hpp

    r152 r188  
    2222            CD360Calendar(const StdString & dateStr); 
    2323            CD360Calendar(int yr = 0, int mth = 1, int d   = 1, 
    24                             int hr = 0, int min = 0, int sec = 0); 
     24                          int hr = 0, int min = 0, int sec = 0); 
    2525            CD360Calendar(const CD360Calendar & calendar);       // Not implemented yet. 
    2626            CD360Calendar(const CD360Calendar * calendar);       // Not implemented yet. 
  • XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in

    r179 r188  
    66INCLUDE "object_template_impl.hpp" 
    77INCLUDE "group_template_impl.hpp" 
     8 
     9INCLUDE "calendar_type.hpp" 
    810 
    911#ifdef __cplusplus 
     
    163165      boost::shared_ptr<CContext> context = CTreeManager::CreateContext(__ctxt_id); 
    164166      *_ctxt = context.get(); 
     167      switch(_calType) 
     168      { 
     169         case (D360)     :  
     170            context->setCalendar(boost::shared_ptr<date::CCalendar> 
     171               (new date::CD360Calendar(yr, mth, dd, hr, min, sec))); 
     172            break; 
     173         case (ALLLEAP)  :  
     174            context->setCalendar(boost::shared_ptr<date::CCalendar> 
     175               (new date::CAllLeapCalendar(yr, mth, dd, hr, min, sec))); 
     176            break; 
     177         case (NOLEAP)   :  
     178            context->setCalendar(boost::shared_ptr<date::CCalendar> 
     179               (new date::CNoLeapCalendar(yr, mth, dd, hr, min, sec))); 
     180            break; 
     181         case (JULIAN)   : 
     182            context->setCalendar(boost::shared_ptr<date::CCalendar> 
     183               (new date::CJulianCalendar(yr, mth, dd, hr, min, sec))); 
     184            break; 
     185         case (GREGORIAN):  
     186            context->setCalendar(boost::shared_ptr<date::CCalendar> 
     187               (new date::CGregorianCalendar(yr, mth, dd, hr, min, sec))); 
     188             break; 
     189         default: 
     190            std::cerr << "Le calendrier n'est pas identifié" << std::endl; 
     191            exit (EXIT_FAILURE); 
     192      }     
    165193   } 
    166194   catch (CException & exc) 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/context.cpp

    r173 r188  
    77#include "group_template_impl.hpp" 
    88 
     9#include "calendar_type.hpp" 
     10 
    911namespace xmlioserver { 
    1012namespace tree { 
     
    1416   CContext::CContext(void) 
    1517      : CObjectTemplate<CContext>(), CContextAttributes() 
     18      , calendar() 
    1619   { /* Ne rien faire de plus */ } 
    1720 
    1821   CContext::CContext(const StdString & id) 
    1922      : CObjectTemplate<CContext>(id), CContextAttributes() 
     23      , calendar() 
    2024   { /* Ne rien faire de plus */ } 
    2125 
     
    3741      return (group_context);  
    3842   } 
    39  
     43    
     44   //---------------------------------------------------------------- 
     45    
     46   boost::shared_ptr<date::CCalendar> CContext::getCalendar(void) const 
     47   { 
     48      return (this->calendar); 
     49   } 
     50    
     51   //---------------------------------------------------------------- 
     52    
     53   void CContext::setCalendar(boost::shared_ptr<date::CCalendar> newCalendar) 
     54   { 
     55      this->calendar = newCalendar; 
     56      calendar_type.setValue(this->calendar->getId()); 
     57      start_date.setValue(this->calendar->getInitDate().toString()); 
     58   } 
     59    
     60   //---------------------------------------------------------------- 
     61 
     62   void CContext::solveCalendar(void) 
     63   { 
     64      if (this->calendar.get() != NULL) return; 
     65      if (calendar_type.isEmpty() || start_date.isEmpty()) 
     66         ERROR(" CContext::solveCalendar(void)", 
     67               << "[ context id = " << this->getId() << " ] " 
     68               << "Impossible de définir un calendrier (un attribut est manquant)."); 
     69 
     70#define DECLARE_CALENDAR(MType  , mtype)                        \ 
     71   if (calendar_type.getValue().compare(#mtype) == 0)           \ 
     72   {                                                            \ 
     73      this->calendar =  boost::shared_ptr<date::CCalendar>      \ 
     74         (new date::C##MType##Calendar(start_date.getValue())); \ 
     75      return;                                                   \ 
     76   } 
     77#include "calendar_type.conf" 
     78 
     79      ERROR("CContext::solveCalendar(void)", 
     80            << "[ calendar_type = " << calendar_type.getValue() << " ] " 
     81            << "Le calendrier n'est pas définie dans le code !"); 
     82   } 
     83    
    4084   //---------------------------------------------------------------- 
    4185 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/context.hpp

    r173 r188  
    55#include "xmlioserver_spl.hpp" 
    66#include "node_type.hpp" 
     7#include "calendar.hpp" 
    78 
    89#include "declare_group.hpp" 
     
    4041         //--------------------------------------------------------- 
    4142 
     43      public : 
     44 
    4245         /// Constructeurs /// 
    4346         CContext(void); 
     
    5154         //--------------------------------------------------------- 
    5255 
     56      public : 
     57       
     58         /// Mutateurs /// 
     59         void setCalendar(boost::shared_ptr<date::CCalendar> newCalendar); 
     60       
     61         /// Accesseurs /// 
     62         boost::shared_ptr<date::CCalendar> getCalendar(void) const; 
     63 
    5364         /// Accesseurs statiques /// 
    5465         static StdString GetName(void); 
    55          static StdString GetDefName(void); 
    56           
    57          static ENodeType GetType(void); 
     66         static StdString GetDefName(void);          
     67         static ENodeType GetType(void);          
    5868 
    5969         static boost::shared_ptr<CContextGroup> GetContextGroup(void); 
     70 
     71      public : 
    6072 
    6173         /// Traitements /// 
    6274         virtual void solveDescInheritance(const CAttributeMap * const parent = 0); 
    6375         void solveFieldRefInheritance(void); 
     76         void solveCalendar(void); 
    6477 
    6578         /// Autres méthodes statiques /// 
     
    6881         /// Test /// 
    6982         virtual bool hasChild(void) const; 
    70  
     83          
     84      public : 
     85       
    7186         /// Autres /// 
    7287         virtual void parse(xml::CXMLNode & node); 
     
    7590         virtual void toBinary  (StdOStream & os) const; 
    7691         virtual void fromBinary(StdIStream & is); 
     92          
     93      private : 
     94       
     95         boost::shared_ptr<date::CCalendar> calendar; 
    7796 
    7897   }; // class CContext 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp

    r187 r188  
    102102      return (this->getBaseFieldReference()->getId()); 
    103103   } 
     104    
     105   //---------------------------------------------------------------- 
     106    
     107   const date::CDuration & CField::getFreqOperation(void) const 
     108   { 
     109      return (this->freq_operation); 
     110   } 
     111    
     112   //---------------------------------------------------------------- 
     113   const date::CDuration & CField::getFreqWrite(void) const 
     114   { 
     115      return (this->freq_write); 
     116   } 
     117    
     118   //---------------------------------------------------------------- 
     119          
     120   boost::shared_ptr<func::CFunctor> CField::getFieldOperation(void) const 
     121   { 
     122      return (this->foperation); 
     123   } 
    104124 
    105125   //---------------------------------------------------------------- 
     
    166186          
    167187#define DECLARE_FUNCTOR(MType, mtype) \ 
    168    if  (operation.getValue().compare(#mtype) == 0){} 
     188   if  (operation.getValue().compare(#mtype) == 0) \ 
     189   { return; } 
    169190      //this->foperation = boost::shared_ptr<func::CFunctor>(new C##MType()); 
    170191    
    171192#include "functor_type.conf" 
     193          
     194         ERROR("CField::solveOperation(void)", 
     195               << "[ operation = " << operation.getValue() << "]" 
     196               << "L'opération n'est pas définie dans le code !"); 
    172197      } 
    173198   } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp

    r187 r188  
    5959         boost::shared_ptr<CGrid> getRelGrid(void) const ; 
    6060         boost::shared_ptr<CFile> getRelFile(void) const ; 
     61          
     62         const date::CDuration & getFreqOperation(void) const; 
     63         const date::CDuration & getFreqWrite(void) const; 
     64          
     65         boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; 
     66          
     67         ARRAY(double, 1) getData(void) const; 
    6168 
    6269         const StdString & getBaseFieldId(void) const; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/file.cpp

    r174 r188  
    9494   { this->vFieldGroup = newVFieldGroup; } 
    9595 
     96   //---------------------------------------------------------------- 
     97 
    9698   void CFile::setVirtualFieldGroup(const StdString & newVFieldGroupId) 
    9799   { 
     
    99101         (CObjectFactory::CreateObject<CFieldGroup>(newVFieldGroupId)); 
    100102   } 
     103 
     104   //---------------------------------------------------------------- 
    101105 
    102106   void CFile::initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout) 
     
    121125      this->data_out->definition_end(); 
    122126   } 
     127 
     128   //---------------------------------------------------------------- 
    123129 
    124130   void CFile::parse(xml::CXMLNode & node) 
     
    148154   } 
    149155 
    150  
     156   //---------------------------------------------------------------- 
     157    
    151158   void CFile::solveDescInheritance(const CAttributeMap * const parent) 
    152159   { 
     
    154161      this->getVirtualFieldGroup()->solveDescInheritance(NULL); 
    155162   } 
     163 
     164   //---------------------------------------------------------------- 
    156165 
    157166   void CFile::solveFieldRefInheritance(void) 
     
    163172   } 
    164173 
     174   //---------------------------------------------------------------- 
     175 
    165176   void CFile::solveEFGridRef(void) 
    166177   { 
     
    168179         this->enabledFields[i]->solveGridReference(); 
    169180   } 
     181 
     182   //---------------------------------------------------------------- 
    170183 
    171184   void CFile::solveEFOperation(void) 
     
    190203   } 
    191204    
     205   //---------------------------------------------------------------- 
     206    
    192207   void CFile::fromBinary(StdIStream & is) 
    193208   { 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.hpp

    r180 r188  
    4848            virtual void writeFile_  (const boost::shared_ptr<tree::CFile>   file); 
    4949 
     50 
     51         protected : 
     52          
    5053            void writeLocalAttributes(int ibegin, int iend, int jbegin, int jend, StdString domid); 
    5154 
Note: See TracChangeset for help on using the changeset viewer.