[44] | 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 | |
---|
| 8 | #include "xmlioserver.hpp" |
---|
| 9 | |
---|
| 10 | #include "attribute_template.hpp" |
---|
| 11 | #include "object_template.hpp" |
---|
| 12 | #include "group_template.hpp" |
---|
| 13 | |
---|
| 14 | #include "icutil.hpp" |
---|
| 15 | #include "timer.hpp" |
---|
| 16 | #include "field.hpp" |
---|
| 17 | |
---|
| 18 | extern "C" |
---|
| 19 | { |
---|
| 20 | // /////////////////////////////// Définitions ////////////////////////////// // |
---|
| 21 | |
---|
| 22 | // ----------------------- Redéfinition de types ---------------------------- |
---|
| 23 | |
---|
| 24 | typedef xios::CField * XFieldPtr; |
---|
| 25 | typedef xios::CFieldGroup * XFieldGroupPtr; |
---|
| 26 | |
---|
| 27 | // -------------------------------------------------------------------------- |
---|
| 28 | // ------------------------ Création des handle ----------------------------- |
---|
| 29 | // -------------------------------------------------------------------------- |
---|
| 30 | |
---|
| 31 | void cxios_field_handle_create (XFieldPtr * _ret, const char * _id, int _id_len) |
---|
| 32 | { |
---|
| 33 | std::string id; |
---|
| 34 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 35 | CTimer::get("XIOS").resume() ; |
---|
| 36 | *_ret = CField::get(id); |
---|
| 37 | CTimer::get("XIOS").suspend() ; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | void cxios_fieldgroup_handle_create (XFieldGroupPtr * _ret, const char * _id, int _id_len) |
---|
| 41 | { |
---|
| 42 | std::string id; |
---|
| 43 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 44 | CTimer::get("XIOS").resume() ; |
---|
| 45 | *_ret = CFieldGroup::get(id); |
---|
| 46 | CTimer::get("XIOS").suspend() ; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | // -------------------- Vérification des identifiants ----------------------- |
---|
| 51 | |
---|
| 52 | void cxios_field_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
| 53 | { |
---|
| 54 | std::string id; |
---|
| 55 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 56 | CTimer::get("XIOS").resume() ; |
---|
| 57 | *_ret = CField::has(id); |
---|
| 58 | CTimer::get("XIOS").suspend() ; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | void cxios_fieldgroup_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
| 62 | { |
---|
| 63 | std::string id; |
---|
| 64 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 65 | CTimer::get("XIOS").resume() ; |
---|
| 66 | *_ret = CFieldGroup::has(id); |
---|
| 67 | CTimer::get("XIOS").suspend() ; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | // ----------------------------------------------------------------------------------------------------- |
---|
| 71 | // ------------------------- other function---------- --------------------------- --------------------- |
---|
| 72 | // ----------------------------------------------------------------------------------------------------- |
---|
| 73 | |
---|
| 74 | void cxios_field_is_active (XFieldPtr field_hdl, bool* ret) |
---|
| 75 | { |
---|
| 76 | CTimer::get("XIOS").resume() ; |
---|
| 77 | *ret = field_hdl->isActive(); |
---|
| 78 | CTimer::get("XIOS").suspend() ; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | } // extern "C" |
---|