source: XIOS/dev/dev_olga/src/interface/c/icgrid.cpp @ 1612

Last change on this file since 1612 was 1612, checked in by oabramkina, 5 years ago

Dev: adding exception handling.

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

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6
7#include "xios.hpp"
8
9#include "attribute_template.hpp"
10#include "object_template.hpp"
11#include "group_template.hpp"
12
13#include "icutil.hpp"
14#include "timer.hpp"
15#include "grid.hpp"
16
17extern "C"
18{
19// /////////////////////////////// Définitions ////////////////////////////// //
20
21   // ----------------------- Redéfinition de types ----------------------------
22   
23   typedef xios::CGrid      * XGridPtr;
24   typedef xios::CGridGroup * XGridGroupPtr;
25
26   // ------------------------ Création des handle -----------------------------
27 
28   void cxios_grid_handle_create (XGridPtr * _ret, const char * _id, int _id_len)
29   TRY
30   {
31      std::string id; 
32      if (!cstr2string(_id, _id_len, id)) return;
33      CTimer::get("XIOS").resume() ;
34      *_ret = CGrid::get(id);
35      CTimer::get("XIOS").suspend() ;
36   }
37   CATCH_DUMP_STACK
38   
39   void cxios_gridgroup_handle_create (XGridGroupPtr * _ret, const char * _id, int _id_len)
40   TRY
41   {
42      std::string id; 
43      if (!cstr2string(_id, _id_len, id)) return;
44      CTimer::get("XIOS").resume() ;
45      *_ret = CGridGroup::get(id);
46      CTimer::get("XIOS").suspend() ;
47   }
48   CATCH_DUMP_STACK
49
50   // -------------------- Vérification des identifiants -----------------------
51
52   void cxios_grid_valid_id (bool * _ret, const char * _id, int _id_len)
53   TRY
54   {
55      std::string id;
56      if (!cstr2string(_id, _id_len, id)) return;
57      CTimer::get("XIOS").resume() ;
58      *_ret = CGrid::has(id);
59      CTimer::get("XIOS").suspend() ;
60   }
61   CATCH_DUMP_STACK
62
63   void cxios_gridgroup_valid_id (bool * _ret, const char * _id, int _id_len)
64   TRY
65   {
66      std::string id;
67      if (!cstr2string(_id, _id_len, id)) return;
68      CTimer::get("XIOS").resume() ;
69      *_ret = CGridGroup::has(id);
70      CTimer::get("XIOS").suspend() ;
71   }
72   CATCH_DUMP_STACK
73} // extern "C"
Note: See TracBrowser for help on using the repository browser.