source: XIOS/dev/dev_olga/src/interface/c/icscalar.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.

File size: 2.1 KB
RevLine 
[891]1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
[1542]6#include <memory>
[891]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)
[1612]30   TRY
[891]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   }
[1612]38   CATCH_DUMP_STACK
[891]39
40   void cxios_scalargroup_handle_create (XScalarGroupPtr * _ret, const char * _id, int _id_len)
[1612]41   TRY
[891]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    }
[1612]49   CATCH_DUMP_STACK
[891]50
51   // -------------------- Vérification des identifiants -----------------------
52
53   void cxios_scalar_valid_id (bool * _ret, const char * _id, int _id_len)
[1612]54   TRY
[891]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   }
[1612]63   CATCH_DUMP_STACK
[891]64
65   void cxios_scalargroup_valid_id (bool * _ret, const char * _id, int _id_len)
[1612]66   TRY
[891]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   }
[1612]76   CATCH_DUMP_STACK
[891]77
78} // extern "C"
Note: See TracBrowser for help on using the repository browser.