Ignore:
Timestamp:
12/11/14 14:32:37 (10 years ago)
Author:
rlacroix
Message:

Add a new attribute type for durations and use it for the context's timestep.

Note that the "xios_time" type and the "xios_set_timestep" procedure have been removed from the Fortran interface. Instead, the "xios_duration" type and the "xios_get_context_attr"/"xios_set_context_attr" procedures should now be used to get/set the timestep.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/type/type_specialisation.hpp

    r533 r537  
    287287      ptrValue->setSecond(sec); 
    288288    } 
     289 
     290    return ret; 
     291  } 
     292 
     293// template specializations for CDuration 
     294 
     295  template <> 
     296  size_t CType<CDuration>::_size() const 
     297  { 
     298    return 7 * sizeof(double); 
     299  } 
     300 
     301  template <> 
     302  size_t CType_ref<CDuration>::_size() const 
     303  { 
     304    return 7 * sizeof(double); 
     305  } 
     306 
     307  template <> 
     308  bool CType<CDuration>::_toBuffer(CBufferOut& buffer) const 
     309  { 
     310    if (buffer.remain() < size()) return false; 
     311    else 
     312    { 
     313      bool ret = true; 
     314      if (ret) ret &= buffer.put(ptrValue->year); 
     315      if (ret) ret &= buffer.put(ptrValue->month); 
     316      if (ret) ret &= buffer.put(ptrValue->day); 
     317      if (ret) ret &= buffer.put(ptrValue->hour); 
     318      if (ret) ret &= buffer.put(ptrValue->minute); 
     319      if (ret) ret &= buffer.put(ptrValue->second); 
     320      if (ret) ret &= buffer.put(ptrValue->timestep); 
     321      return ret; 
     322    } 
     323  } 
     324   
     325  template <> 
     326  bool CType_ref<CDuration>::_toBuffer(CBufferOut& buffer) const 
     327  { 
     328    if (buffer.remain() < size()) return false; 
     329    else 
     330    { 
     331      bool ret = true; 
     332      if (ret) ret &= buffer.put(ptrValue->year); 
     333      if (ret) ret &= buffer.put(ptrValue->month); 
     334      if (ret) ret &= buffer.put(ptrValue->day); 
     335      if (ret) ret &= buffer.put(ptrValue->hour); 
     336      if (ret) ret &= buffer.put(ptrValue->minute); 
     337      if (ret) ret &= buffer.put(ptrValue->second); 
     338      if (ret) ret &= buffer.put(ptrValue->timestep); 
     339      return ret; 
     340    } 
     341  } 
     342 
     343  template <> 
     344  bool CType<CDuration>::_fromBuffer(CBufferIn& buffer) 
     345  { 
     346    allocate(); 
     347    bool ret = true; 
     348 
     349    if (ret) ret &= buffer.get(ptrValue->year); 
     350    if (ret) ret &= buffer.get(ptrValue->month); 
     351    if (ret) ret &= buffer.get(ptrValue->day); 
     352    if (ret) ret &= buffer.get(ptrValue->hour); 
     353    if (ret) ret &= buffer.get(ptrValue->minute); 
     354    if (ret) ret &= buffer.get(ptrValue->second); 
     355    if (ret) ret &= buffer.get(ptrValue->timestep); 
     356 
     357    return ret; 
     358  } 
     359 
     360  template <> 
     361  bool CType_ref<CDuration>::_fromBuffer(CBufferIn& buffer) const 
     362  { 
     363    bool ret = true; 
     364     
     365    if (ret) ret &= buffer.get(ptrValue->year); 
     366    if (ret) ret &= buffer.get(ptrValue->month); 
     367    if (ret) ret &= buffer.get(ptrValue->day); 
     368    if (ret) ret &= buffer.get(ptrValue->hour); 
     369    if (ret) ret &= buffer.get(ptrValue->minute); 
     370    if (ret) ret &= buffer.get(ptrValue->second); 
     371    if (ret) ret &= buffer.get(ptrValue->timestep); 
     372 
     373    return ret; 
     374  } 
     375 
     376  template <> 
     377  bool CType_ref<CDuration>::_fromBuffer(CBufferIn& buffer) 
     378  { 
     379    bool ret = true; 
     380     
     381    if (ret) ret &= buffer.get(ptrValue->year); 
     382    if (ret) ret &= buffer.get(ptrValue->month); 
     383    if (ret) ret &= buffer.get(ptrValue->day); 
     384    if (ret) ret &= buffer.get(ptrValue->hour); 
     385    if (ret) ret &= buffer.get(ptrValue->minute); 
     386    if (ret) ret &= buffer.get(ptrValue->second); 
     387    if (ret) ret &= buffer.get(ptrValue->timestep); 
    289388 
    290389    return ret; 
Note: See TracChangeset for help on using the changeset viewer.