Ignore:
Timestamp:
04/04/18 12:20:26 (3 years ago)
Author:
oabramkina
Message:

Implementing a patch suggested by Rupert Nash in order to bring temporal_filter.cpp in compliance with c++98 norms.

For this, a constructor of CDuration has been added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/interface/c/icduration.cpp

    r801 r1472  
    77  void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size) 
    88  { 
    9     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    10                             dur_c.hour, dur_c.minute, dur_c.second, 
    11                             dur_c.timestep }; 
     9    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    1210 
    1311    if (!string_copy(dur.toString(), str, str_size)) 
     
    2826  cxios_duration cxios_duration_add(cxios_duration dur1_c, cxios_duration dur2_c) 
    2927  { 
    30     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    31                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    32                              dur1_c.timestep }; 
    33     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    34                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    35                              dur2_c.timestep }; 
     28    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     29    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
     30 
    3631    xios::CDuration res = dur1 + dur2; 
    3732    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    4035  cxios_duration cxios_duration_sub(cxios_duration dur1_c, cxios_duration dur2_c) 
    4136  { 
    42     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    43                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    44                              dur1_c.timestep }; 
    45     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    46                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    47                              dur2_c.timestep }; 
     37    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     38    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
     39 
    4840    xios::CDuration res = dur1 - dur2; 
    4941    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    5244  cxios_duration cxios_duration_mult(double val, cxios_duration dur_c) 
    5345  { 
    54     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    55                             dur_c.hour, dur_c.minute, dur_c.second, 
    56                             dur_c.timestep }; 
     46    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    5747    xios::CDuration res = val * dur; 
    5848    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    6151  cxios_duration cxios_duration_neg(cxios_duration dur_c) 
    6252  { 
    63     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    64                             dur_c.hour, dur_c.minute, dur_c.second, 
    65                             dur_c.timestep }; 
     53    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    6654    xios::CDuration res = -dur; 
    6755    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    7058  bool cxios_duration_eq(cxios_duration dur1_c, cxios_duration dur2_c) 
    7159  { 
    72     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    73                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    74                              dur1_c.timestep }; 
    75     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    76                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    77                              dur2_c.timestep }; 
     60    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     61    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    7862    return (dur1 == dur2); 
    7963  } 
     
    8165  bool cxios_duration_neq(cxios_duration dur1_c, cxios_duration dur2_c) 
    8266  { 
    83     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    84                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    85                              dur1_c.timestep }; 
    86     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    87                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    88                              dur2_c.timestep }; 
     67    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     68    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    8969    return (dur1 != dur2); 
    9070  } 
Note: See TracChangeset for help on using the changeset viewer.