Changeset 561


Ignore:
Timestamp:
02/18/15 10:13:41 (9 years ago)
Author:
rlacroix
Message:

CCalendar: Make getCurrentDate and update methods return a const reference.

The current date should only be modified by the update method.

Location:
XIOS/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/calendar.cpp

    r550 r561  
    115115      } 
    116116 
    117       CDate& CCalendar::update(int step) 
     117      const CDate& CCalendar::update(int step) 
    118118      { 
    119119        info(20) << "update step : " << step << " timestep " << this->timestep << std::endl; 
    120         return (this->getCurrentDate() = this->getInitDate() + step * this->timestep); 
     120        return (this->currentDate = this->getInitDate() + step * this->timestep); 
    121121      } 
    122122 
     
    144144      const CDate& CCalendar::getInitDate(void) const     { return this->initDate; } 
    145145      const CDate& CCalendar::getTimeOrigin(void) const   { return this->timeOrigin; } 
    146       CDate& CCalendar::getCurrentDate(void)              { return this->currentDate; } 
     146      const CDate& CCalendar::getCurrentDate(void) const  { return this->currentDate; } 
    147147 
    148148      //----------------------------------------------------------------- 
  • XIOS/trunk/src/calendar.hpp

    r550 r561  
    5757 
    5858            /// Traitemants /// 
    59             CDate& update(int step); 
     59            const CDate& update(int step); 
    6060 
    6161            /// Accesseurs /// 
     
    6363            const CDate& getInitDate(void) const; 
    6464            const CDate& getTimeOrigin(void) const; 
    65             CDate& getCurrentDate(void); 
     65            const CDate& getCurrentDate(void) const; 
    6666 
    6767         public : 
  • XIOS/trunk/src/node/file.cpp

    r538 r561  
    188188   { 
    189189     CContext* context = CContext::getCurrent() ; 
    190      CDate& currentDate=context->calendar->getCurrentDate() ; 
     190     const CDate& currentDate = context->calendar->getCurrentDate() ; 
    191191     if (!sync_freq.isEmpty()) 
    192192     { 
     
    204204   { 
    205205      CContext* context = CContext::getCurrent() ; 
    206       CDate& currentDate=context->calendar->getCurrentDate() ; 
     206      const CDate& currentDate = context->calendar->getCurrentDate() ; 
    207207      CContextServer* server=context->server ; 
    208208 
     
    249249   { 
    250250     CContext* context = CContext::getCurrent() ; 
    251      CDate& currentDate=context->calendar->getCurrentDate() ; 
     251     const CDate& currentDate = context->calendar->getCurrentDate() ; 
    252252     if (!sync_freq.isEmpty()) 
    253253     { 
     
    271271    { 
    272272      CContext* context = CContext::getCurrent() ; 
    273       CDate& currentDate=context->calendar->getCurrentDate() ; 
     273      const CDate& currentDate = context->calendar->getCurrentDate() ; 
    274274      if (!split_freq.isEmpty()) 
    275275      { 
Note: See TracChangeset for help on using the changeset viewer.