Changeset 318 for XIOS/trunk/src/node/file.cpp
- Timestamp:
- 02/21/12 15:34:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/file.cpp
r300 r318 11 11 #include "context_server.hpp" 12 12 #include "nc4_data_output.hpp" 13 #include "calendar_util.hpp" 14 #include "date.hpp" 13 15 14 16 … … 125 127 126 128 //---------------------------------------------------------------- 127 129 bool CFile::isSyncTime(void) 130 { 131 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 132 date::CDate& currentDate=context->calendar->getCurrentDate() ; 133 if (! sync_freq.isEmpty()) 134 { 135 if (*lastSync+syncFreq < currentDate) 136 { 137 *lastSync=currentDate ; 138 return true ; 139 } 140 } 141 return false ; 142 } 143 128 144 void CFile::createHeader(void) 129 145 { 130 146 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 147 148 if (! sync_freq.isEmpty()) syncFreq = date::CDuration::FromString(sync_freq.getValue()); 149 lastSync=new date::CDate(context->calendar->getCurrentDate()) ; 150 131 151 std::vector<boost::shared_ptr<CField> >::iterator it, end = this->enabledFields.end(); 132 152 133 153 AllDomainEmpty=true ; 154 set<CDomain*> setDomain ; 134 155 for (it = this->enabledFields.begin() ;it != end; it++) 135 156 { 136 157 boost::shared_ptr<CField> field = *it; 137 158 AllDomainEmpty&=field->grid->domain->isEmpty() ; 138 } 139 159 setDomain.insert(field->grid->domain.get()) ; 160 } 161 nbDomain=setDomain.size() ; 162 140 163 if (!AllDomainEmpty || type.getValue()=="one_file") 141 164 { … … 156 179 } 157 180 158 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ;159 181 CContextServer* server=context->server ; 160 182 … … 188 210 if (!AllDomainEmpty || type.getValue()=="one_file") 189 211 this->data_out->closeFile(); 212 delete lastSync ; 190 213 } 191 214 //----------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.