Changeset 532 for XIOS/trunk/src/date


Ignore:
Timestamp:
12/10/14 14:27:09 (9 years ago)
Author:
rlacroix
Message:

Add a new attribute type for dates and use it for the context's start_date and time_origin.

The "xios_date" type should now be used to get/set date attributes through the Fortran interface. This avoids using strings to manipulate dates.

Location:
XIOS/trunk/src/date
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/date/allleap.cpp

    r501 r532  
    55      /// ////////////////////// Définitions ////////////////////// /// 
    66 
    7       CAllLeapCalendar::CAllLeapCalendar(const StdString & dateStr) 
    8          : CCalendar("AllLeap") 
    9       { initializeDate(dateStr); } 
     7      CAllLeapCalendar::CAllLeapCalendar(const CDate& startDate) 
     8         : CCalendar("AllLeap", startDate) 
     9      { 
     10         // This will check that the dates are conform with the calendar. 
     11         // We cannot call this from the parent constructor because we 
     12         // want the methods of this class to be used 
     13         initializeDate(); 
     14      } 
    1015 
    11       CAllLeapCalendar::CAllLeapCalendar(const StdString & dateStr,const StdString & timeOriginStr) 
    12          : CCalendar("AllLeap") 
    13       { initializeDate(dateStr, timeOriginStr); } 
     16      CAllLeapCalendar::CAllLeapCalendar(const CDate& startDate, const CDate& timeOrigin) 
     17         : CCalendar("AllLeap", startDate, timeOrigin) 
     18      { 
     19         // This will check that the dates are conform with the calendar. 
     20         // We cannot call this from the parent constructor because we 
     21         // want the methods of this class to be used 
     22         initializeDate(); 
     23      } 
    1424 
    1525      CAllLeapCalendar::CAllLeapCalendar(int yr, int mth, int d, 
  • XIOS/trunk/src/date/allleap.hpp

    r501 r532  
    1818            /// Constructeur /// 
    1919//            CAllLeapCalendar(void);                                   // Not implemented yet. 
    20             CAllLeapCalendar(const StdString & dateStr); 
    21             CAllLeapCalendar(const StdString & dateStr,const StdString & timeOriginStr); 
     20            CAllLeapCalendar(const CDate& startDate); 
     21            CAllLeapCalendar(const CDate& startDate, const CDate& timeOriginStr); 
    2222            CAllLeapCalendar(int yr = 0, int mth = 1, int d   = 1, 
    23                             int hr = 0, int min = 0, int sec = 0); 
    24             CAllLeapCalendar(const CAllLeapCalendar & calendar);       // Not implemented yet. 
    25             CAllLeapCalendar(const CAllLeapCalendar * calendar);       // Not implemented yet. 
     23                             int hr = 0, int min = 0, int sec = 0); 
     24            CAllLeapCalendar(const CAllLeapCalendar& calendar);       // Not implemented yet. 
     25            CAllLeapCalendar(const CAllLeapCalendar* calendar);       // Not implemented yet. 
    2626 
    2727            /// Accesseurs /// 
  • XIOS/trunk/src/date/d360.cpp

    r501 r532  
    55      /// ////////////////////// Définitions ////////////////////// /// 
    66 
    7       CD360Calendar::CD360Calendar(const StdString & dateStr) 
    8          : CCalendar("D360") 
    9       { initializeDate(dateStr); } 
     7      CD360Calendar::CD360Calendar(const CDate& startDate) 
     8         : CCalendar("D360", startDate) 
     9      { 
     10         // This will check that the dates are conform with the calendar. 
     11         // We cannot call this from the parent constructor because we 
     12         // want the methods of this class to be used 
     13         initializeDate(); 
     14      } 
    1015 
    11       CD360Calendar::CD360Calendar(const StdString & dateStr,const StdString & timeOriginStr) 
    12          : CCalendar("D360", dateStr) 
    13       { initializeDate(dateStr, timeOriginStr); } 
     16      CD360Calendar::CD360Calendar(const CDate& startDate, const CDate& timeOrigin) 
     17         : CCalendar("D360", startDate, timeOrigin) 
     18      { 
     19         // This will check that the dates are conform with the calendar. 
     20         // We cannot call this from the parent constructor because we 
     21         // want the methods of this class to be used 
     22         initializeDate(); 
     23      } 
    1424 
    1525      CD360Calendar::CD360Calendar(int yr, int mth, int d, 
  • XIOS/trunk/src/date/d360.hpp

    r501 r532  
    1818            /// Constructeur /// 
    1919            CD360Calendar(void);                                   // Not implemented yet. 
    20             CD360Calendar(const StdString & dateStr); 
    21             CD360Calendar(const StdString & dateStr,const StdString & timeOriginStr); 
     20            CD360Calendar(const CDate& startDate); 
     21            CD360Calendar(const CDate& startDate, const CDate& timeOrigin); 
    2222            CD360Calendar(int yr = 0, int mth = 1, int d   = 1, 
    2323                          int hr = 0, int min = 0, int sec = 0); 
    24             CD360Calendar(const CD360Calendar & calendar);       // Not implemented yet. 
    25             CD360Calendar(const CD360Calendar * calendar);       // Not implemented yet. 
     24            CD360Calendar(const CD360Calendar& calendar);       // Not implemented yet. 
     25            CD360Calendar(const CD360Calendar* calendar);       // Not implemented yet. 
    2626 
    2727            /// Accesseurs /// 
  • XIOS/trunk/src/date/gregorian.cpp

    r501 r532  
    55      /// ////////////////////// Définitions ////////////////////// /// 
    66 
    7       CGregorianCalendar::CGregorianCalendar(const StdString & dateStr) 
    8          : CCalendar("Gregorian") 
    9       { initializeDate(dateStr); } 
     7      CGregorianCalendar::CGregorianCalendar(const CDate& startDate) 
     8         : CCalendar("Gregorian", startDate) 
     9      { 
     10         // This will check that the dates are conform with the calendar. 
     11         // We cannot call this from the parent constructor because we 
     12         // want the methods of this class to be used 
     13         initializeDate(); 
     14      } 
    1015 
    11       CGregorianCalendar::CGregorianCalendar(const StdString & dateStr,const StdString & timeOriginStr) 
    12          : CCalendar("Gregorian") 
    13       { initializeDate(dateStr, timeOriginStr); } 
     16      CGregorianCalendar::CGregorianCalendar(const CDate& startDate, const CDate& timeOrigin) 
     17         : CCalendar("Gregorian", startDate, timeOrigin) 
     18      { 
     19         // This will check that the dates are conform with the calendar. 
     20         // We cannot call this from the parent constructor because we 
     21         // want the methods of this class to be used 
     22         initializeDate(); 
     23      } 
    1424 
    1525      CGregorianCalendar::CGregorianCalendar(int yr, int mth, int d, 
  • XIOS/trunk/src/date/gregorian.hpp

    r501 r532  
    1818            /// Constructeur /// 
    1919//            CGregorianCalendar(void);                                   // Not implemented yet. 
    20             CGregorianCalendar(const StdString & dateStr); 
    21             CGregorianCalendar(const StdString & dateStr,const StdString & timeOriginStr); 
     20            CGregorianCalendar(const CDate& startDate); 
     21            CGregorianCalendar(const CDate& startDate, const CDate& timeOrigin); 
    2222            CGregorianCalendar(int yr = 0, int mth = 1, int d   = 1, 
    2323                               int hr = 0, int min = 0, int sec = 0); 
    24             CGregorianCalendar(const CGregorianCalendar & calendar);       // Not implemented yet. 
    25             CGregorianCalendar(const CGregorianCalendar * calendar);       // Not implemented yet. 
     24            CGregorianCalendar(const CGregorianCalendar& calendar);       // Not implemented yet. 
     25            CGregorianCalendar(const CGregorianCalendar* calendar);       // Not implemented yet. 
    2626 
    2727            /// Accesseurs /// 
  • XIOS/trunk/src/date/julian.cpp

    r501 r532  
    55      /// ////////////////////// Définitions ////////////////////// /// 
    66 
    7       CJulianCalendar::CJulianCalendar(const StdString & dateStr) 
    8          : CCalendar("Julian") 
    9       { initializeDate(dateStr); } 
     7      CJulianCalendar::CJulianCalendar(const CDate& startDate) 
     8         : CCalendar("Julian", startDate) 
     9      { 
     10         // This will check that the dates are conform with the calendar. 
     11         // We cannot call this from the parent constructor because we 
     12         // want the methods of this class to be used 
     13         initializeDate(); 
     14      } 
    1015 
    11       CJulianCalendar::CJulianCalendar(const StdString & dateStr,const StdString & timeOriginStr) 
    12          : CCalendar("Julian") 
    13       { initializeDate(dateStr, timeOriginStr); } 
     16      CJulianCalendar::CJulianCalendar(const CDate& startDate, const CDate& timeOrigin) 
     17         : CCalendar("Julian", startDate, timeOrigin) 
     18      { 
     19         // This will check that the dates are conform with the calendar. 
     20         // We cannot call this from the parent constructor because we 
     21         // want the methods of this class to be used 
     22         initializeDate(); 
     23      } 
    1424 
    1525      CJulianCalendar::CJulianCalendar(int yr, int mth, int d, 
  • XIOS/trunk/src/date/julian.hpp

    r501 r532  
    1818            /// Constructeur /// 
    1919//            CJulianCalendar(void);                                   // Not implemented yet. 
    20             CJulianCalendar(const StdString & dateStr); 
    21             CJulianCalendar(const StdString & dateStr,const StdString & timeOriginStr); 
     20            CJulianCalendar(const CDate& startDate); 
     21            CJulianCalendar(const CDate& startDate, const CDate& timeOrigin); 
    2222            CJulianCalendar(int yr = 0, int mth = 1, int d   = 1, 
    2323                            int hr = 0, int min = 0, int sec = 0); 
    24             CJulianCalendar(const CJulianCalendar & calendar);       // Not implemented yet. 
    25             CJulianCalendar(const CJulianCalendar * calendar);       // Not implemented yet. 
     24            CJulianCalendar(const CJulianCalendar& calendar);       // Not implemented yet. 
     25            CJulianCalendar(const CJulianCalendar* calendar);       // Not implemented yet. 
    2626 
    2727            /// Accesseurs /// 
  • XIOS/trunk/src/date/noleap.cpp

    r501 r532  
    66      /// ////////////////////// Définitions ////////////////////// /// 
    77 
    8       CNoLeapCalendar::CNoLeapCalendar(const StdString & dateStr) 
    9          : CCalendar("NoLeap", dateStr) 
    10       { initializeDate(dateStr); } 
     8      CNoLeapCalendar::CNoLeapCalendar(const CDate& startDate) 
     9         : CCalendar("NoLeap", startDate) 
     10      { 
     11         // This will check that the dates are conform with the calendar. 
     12         // We cannot call this from the parent constructor because we 
     13         // want the methods of this class to be used 
     14         initializeDate(); 
     15      } 
    1116 
    12       CNoLeapCalendar::CNoLeapCalendar(const StdString & dateStr,const StdString & timeOriginStr) 
    13          : CCalendar("NoLeap", dateStr, timeOriginStr) 
    14       { initializeDate(dateStr, timeOriginStr); } 
     17      CNoLeapCalendar::CNoLeapCalendar(const CDate& startDate, const CDate& timeOrigin) 
     18         : CCalendar("NoLeap", startDate, timeOrigin) 
     19      { 
     20         // This will check that the dates are conform with the calendar. 
     21         // We cannot call this from the parent constructor because we 
     22         // want the methods of this class to be used 
     23         initializeDate(); 
     24      } 
    1525 
    1626      CNoLeapCalendar::CNoLeapCalendar(int yr, int mth, int d, 
  • XIOS/trunk/src/date/noleap.hpp

    r501 r532  
    1818            /// Constructeur /// 
    1919//            CNoLeapCalendar(void);                                   // Not implemented yet. 
    20             CNoLeapCalendar(const StdString & dateStr); 
    21             CNoLeapCalendar(const StdString & dateStr,const StdString & timeOriginStr); 
     20            CNoLeapCalendar(const CDate& startDate); 
     21            CNoLeapCalendar(const CDate& startDate, const CDate& timeOrigin); 
    2222            CNoLeapCalendar(int yr = 0, int mth = 1, int d   = 1, 
    2323                            int hr = 0, int min = 0, int sec = 0); 
    24             CNoLeapCalendar(const CNoLeapCalendar & calendar);       // Not implemented yet. 
    25             CNoLeapCalendar(const CNoLeapCalendar * calendar);       // Not implemented yet. 
     24            CNoLeapCalendar(const CNoLeapCalendar& calendar);       // Not implemented yet. 
     25            CNoLeapCalendar(const CNoLeapCalendar* calendar);       // Not implemented yet. 
    2626 
    2727            /// Accesseurs /// 
Note: See TracChangeset for help on using the changeset viewer.