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

Last change on this file since 1612 was 1612, checked in by oabramkina, 21 months ago

Dev: adding exception handling.

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

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#include <memory>
7
8#include "xios.hpp"
9
10#include "object_template.hpp"
11#include "group_template.hpp"
12#include "attribute_template.hpp"
13
14#include "icutil.hpp"
15#include "timer.hpp"
16#include "scalar.hpp"
17
18extern "C"
19{
20// /////////////////////////////// Définitions ////////////////////////////// //
21
22   // ----------------------- Redéfinition de types ----------------------------
23
24   typedef xios::CScalar      * XScalarPtr;
25   typedef xios::CScalarGroup * XScalarGroupPtr;
26
27   // ------------------------ Création des handle -----------------------------
28
29   void cxios_scalar_handle_create (XScalarPtr * _ret, const char * _id, int _id_len)
30   TRY
31   {
32      std::string id;
33      if (!cstr2string(_id, _id_len, id)) return;
34      CTimer::get("XIOS").resume() ;
35      *_ret = xios::CScalar::get(id);
36      CTimer::get("XIOS").suspend() ;
37   }
38   CATCH_DUMP_STACK
39
40   void cxios_scalargroup_handle_create (XScalarGroupPtr * _ret, const char * _id, int _id_len)
41   TRY
42   {
43      std::string id;
44      if (!cstr2string(_id, _id_len, id)) return;
45      CTimer::get("XIOS").resume() ;
46      *_ret = xios::CScalarGroup::get(id);
47      CTimer::get("XIOS").suspend() ;
48    }
49   CATCH_DUMP_STACK
50
51   // -------------------- Vérification des identifiants -----------------------
52
53   void cxios_scalar_valid_id (bool * _ret, const char * _id, int _id_len)
54   TRY
55   {
56      std::string id;
57      if (!cstr2string(_id, _id_len, id)) return;
58
59      CTimer::get("XIOS").resume() ;
60      *_ret = xios::CScalar::has(id);
61      CTimer::get("XIOS").suspend() ;
62   }
63   CATCH_DUMP_STACK
64
65   void cxios_scalargroup_valid_id (bool * _ret, const char * _id, int _id_len)
66   TRY
67   {
68      std::string id;
69      if (!cstr2string(_id, _id_len, id)) return;
70
71      CTimer::get("XIOS").resume() ;
72      *_ret = xios::CScalarGroup::has(id);
73      CTimer::get("XIOS").suspend() ;
74
75   }
76   CATCH_DUMP_STACK
77
78} // extern "C"
Note: See TracBrowser for help on using the repository browser.