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