Ignore:
Timestamp:
11/23/18 14:48:14 (21 months ago)
Author:
oabramkina
Message:

Dev: adding exception handling.

To activate it, compilation flag -DXIOS_EXCEPTION should be added.

File:
1 edited

Legend:

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

    r1472 r1612  
     1#include "xios.hpp" 
     2 
    13#include "icutil.hpp" 
    24#include "icdate.hpp" 
     
    68{ 
    79  void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size) 
     10  TRY 
    811  { 
    912    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
     
    1215      ERROR("void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size)", << "Input string is too short"); 
    1316  } 
     17  CATCH_DUMP_STACK 
    1418 
    1519  cxios_duration cxios_duration_convert_from_string(const char* str, int str_size) 
     20  TRY 
    1621  { 
    1722    std::string dur_str; 
     
    2328    return { dur.year, dur.month, dur.day, dur.hour, dur.minute, dur.second, dur.timestep }; 
    2429  } 
     30  CATCH_DUMP_STACK 
    2531 
    2632  cxios_duration cxios_duration_add(cxios_duration dur1_c, cxios_duration dur2_c) 
     33  TRY 
    2734  { 
    2835    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     
    3239    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
    3340  } 
     41  CATCH_DUMP_STACK 
    3442 
    3543  cxios_duration cxios_duration_sub(cxios_duration dur1_c, cxios_duration dur2_c) 
     44  TRY 
    3645  { 
    3746    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     
    4150    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
    4251  } 
     52  CATCH_DUMP_STACK 
    4353 
    4454  cxios_duration cxios_duration_mult(double val, cxios_duration dur_c) 
     55  TRY 
    4556  { 
    4657    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
     
    4859    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
    4960  } 
     61  CATCH_DUMP_STACK 
    5062 
    5163  cxios_duration cxios_duration_neg(cxios_duration dur_c) 
     64  TRY 
    5265  { 
    5366    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
     
    5568    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
    5669  } 
     70  CATCH_DUMP_STACK 
    5771 
    5872  bool cxios_duration_eq(cxios_duration dur1_c, cxios_duration dur2_c) 
     73  TRY 
    5974  { 
    6075    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     
    6277    return (dur1 == dur2); 
    6378  } 
     79  CATCH_DUMP_STACK 
    6480 
    6581  bool cxios_duration_neq(cxios_duration dur1_c, cxios_duration dur2_c) 
     82  TRY 
    6683  { 
    6784    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     
    6986    return (dur1 != dur2); 
    7087  } 
     88  CATCH_DUMP_STACK 
    7189} 
Note: See TracChangeset for help on using the changeset viewer.