[474] | 1 | /* ************************************************************************** * |
---|
| 2 | * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * |
---|
| 3 | * ************************************************************************** */ |
---|
| 4 | |
---|
| 5 | #include <boost/multi_array.hpp> |
---|
| 6 | #include <boost/shared_ptr.hpp> |
---|
| 7 | |
---|
[591] | 8 | #include "xios.hpp" |
---|
[474] | 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 "variable.hpp" |
---|
| 17 | |
---|
| 18 | extern "C" |
---|
| 19 | { |
---|
| 20 | // /////////////////////////////// Définitions ////////////////////////////// // |
---|
| 21 | |
---|
| 22 | // ----------------------- Redéfinition de types ---------------------------- |
---|
| 23 | |
---|
| 24 | typedef xios::CVariable * XVariablePtr; |
---|
| 25 | typedef xios::CVariableGroup * XVariableGroupPtr; |
---|
| 26 | |
---|
| 27 | // ------------------------ Création des handle ----------------------------- |
---|
| 28 | |
---|
| 29 | void cxios_variable_handle_create (XVariablePtr * _ret, const char * _id, int _id_len) |
---|
| 30 | { |
---|
| 31 | std::string id; |
---|
| 32 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 33 | CTimer::get("XIOS").resume() ; |
---|
| 34 | *_ret = xios::CVariable::get(id); |
---|
| 35 | CTimer::get("XIOS").suspend() ; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | void cxios_variablegroup_handle_create (XVariableGroupPtr * _ret, const char * _id, int _id_len) |
---|
| 39 | { |
---|
| 40 | std::string id; |
---|
| 41 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 42 | CTimer::get("XIOS").resume() ; |
---|
| 43 | *_ret = xios::CVariableGroup::get(id); |
---|
| 44 | CTimer::get("XIOS").suspend() ; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | // -------------------- Vérification des identifiants ----------------------- |
---|
| 48 | |
---|
| 49 | void cxios_variable_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
| 50 | { |
---|
| 51 | std::string id; |
---|
| 52 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 53 | |
---|
| 54 | CTimer::get("XIOS").resume() ; |
---|
| 55 | *_ret = xios::CVariable::has(id); |
---|
| 56 | CTimer::get("XIOS").suspend() ; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | void cxios_variablegroup_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
| 60 | { |
---|
| 61 | std::string id; |
---|
| 62 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 63 | |
---|
| 64 | CTimer::get("XIOS").resume() ; |
---|
| 65 | *_ret = xios::CVariableGroup::has(id); |
---|
| 66 | CTimer::get("XIOS").suspend() ; |
---|
| 67 | |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | } // extern "C" |
---|
| 71 | |
---|