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