Ignore:
Timestamp:
05/30/11 15:17:48 (13 years ago)
Author:
hozdoba
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp

    r205 r206  
    66 
    77#include "node_type.hpp" 
    8  
     8#include "calendar_util.hpp" 
    99#include "xios_manager.hpp" 
    1010 
     
    1919      , grid(), file() 
    2020      , freq_operation(), freq_write() 
     21      , last_Write(), last_operation() 
    2122      , foperation() 
    2223      , data() 
     
    2829      , grid(), file() 
    2930      , freq_operation(), freq_write() 
     31      , last_Write(), last_operation() 
    3032      , foperation() 
    3133      , data() 
     
    4244   //---------------------------------------------------------------- 
    4345 
     46   bool CField::updateDataServer 
     47      (const date::CDate & currDate, const std::deque<ARRAY(double, 1)> storedClient) 
     48   { 
     49      if ((*last_operation + freq_operation) >= currDate) 
     50      { 
     51         ARRAY_CREATE(input, double, 1, [0]); 
     52         this->grid->inputFieldServer(storedClient, input); 
     53         (*this->foperation)(input); 
     54         *last_operation = currDate; 
     55      } 
     56 
     57      if ((*last_Write + freq_write) >= currDate) 
     58      { 
     59         *last_Write = currDate; 
     60         return (true); 
     61      } 
     62      return (false); 
     63   } 
     64 
     65   //---------------------------------------------------------------- 
     66 
    4467   void CField::setRelFile(const boost::shared_ptr<CFile> _file) 
    4568   {  
     
    132155   //---------------------------------------------------------------- 
    133156    
    134    ARRAY(double, 1)  CField::getData(void) const 
     157   ARRAY(double, 1) CField::getData(void) const 
    135158   { 
    136159      return(this->data); 
     160   } 
     161 
     162   //---------------------------------------------------------------- 
     163 
     164   boost::shared_ptr<date::CDate> CField::getLastWriteDate(void) const 
     165   { 
     166      return(this->last_Write); 
     167   } 
     168 
     169   //---------------------------------------------------------------- 
     170 
     171   boost::shared_ptr<date::CDate> CField::getLastOperationDate(void) const 
     172   { 
     173      return(this->last_operation); 
    137174   } 
    138175 
     
    173210      using namespace date; 
    174211        
    175       StdString id = this->getBaseFieldReference()->getId();       
     212      StdString id = this->getBaseFieldReference()->getId(); 
     213      boost::shared_ptr<CContext> _context = 
     214         CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     215 
    176216      if (operation.isEmpty() || freq_op.isEmpty() || this->file->output_freq.isEmpty()) 
    177217      { 
     
    187227         this->freq_write     = 
    188228             CDuration::FromString(this->file->output_freq.getValue()); 
     229         this->last_Write     = boost::shared_ptr<xmlioserver::date::CDate> 
     230                        (new date::CDate(_context->getCalendar()->getInitDate())); 
     231         this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 
     232                        (new date::CDate(_context->getCalendar()->getInitDate())); 
    189233         this->foperation     = 
    190234             boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); 
     
    194238         this->freq_operation = CDuration::FromString(freq_op.getValue()); 
    195239         this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
     240         this->last_Write     = boost::shared_ptr<xmlioserver::date::CDate> 
     241                        (new date::CDate(_context->getCalendar()->getInitDate())); 
     242         this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 
     243                        (new date::CDate(_context->getCalendar()->getInitDate())); 
    196244          
    197245#define DECLARE_FUNCTOR(MType, mtype)              \ 
Note: See TracChangeset for help on using the changeset viewer.