[274] | 1 | /* ************************************************************************** * |
---|
| 2 | * Copyright © IPSL/LSCE, XMLIOServer, 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_impl.hpp" |
---|
| 11 | #include "object_template_impl.hpp" |
---|
| 12 | #include "group_template_impl.hpp" |
---|
| 13 | |
---|
| 14 | #include "icutil.hpp" |
---|
| 15 | |
---|
| 16 | extern "C" |
---|
| 17 | { |
---|
| 18 | // /////////////////////////////// Définitions ////////////////////////////// // |
---|
| 19 | |
---|
| 20 | // ----------------------- Redéfinition de types ---------------------------- |
---|
| 21 | |
---|
| 22 | typedef xmlioserver::tree::CGrid * XGridPtr; |
---|
| 23 | typedef xmlioserver::tree::CGridGroup * XGridGroupPtr; |
---|
| 24 | |
---|
| 25 | // ------------------------- Attributs des axes ----------------------------- |
---|
| 26 | |
---|
[286] | 27 | void cxios_set_grid_name(XGridPtr grid_hdl, const char * name, int name_size) |
---|
[274] | 28 | { |
---|
| 29 | std::string name_str; |
---|
| 30 | if (!cstr2string(name, name_size, name_str)) return; |
---|
| 31 | |
---|
| 32 | grid_hdl->name.setValue(name_str); |
---|
| 33 | } |
---|
| 34 | |
---|
[286] | 35 | void cxios_set_grid_description(XGridPtr grid_hdl, const char * description, int description_size) |
---|
[274] | 36 | { |
---|
| 37 | std::string description_str; |
---|
| 38 | if (!cstr2string(description, description_size, description_str)) return; |
---|
| 39 | |
---|
| 40 | grid_hdl->description.setValue(description_str); |
---|
| 41 | } |
---|
| 42 | |
---|
[286] | 43 | void cxios_set_grid_domain_ref(XGridPtr grid_hdl, const char * domain_ref, int domain_ref_size) |
---|
[274] | 44 | { |
---|
| 45 | std::string domain_ref_str; |
---|
| 46 | if (!cstr2string(domain_ref, domain_ref_size, domain_ref_str)) return; |
---|
| 47 | |
---|
| 48 | grid_hdl->domain_ref.setValue(domain_ref_str); |
---|
| 49 | } |
---|
| 50 | |
---|
[286] | 51 | void cxios_set_grid_axis_ref(XGridPtr grid_hdl, const char * axis_ref, int axis_ref_size) |
---|
[274] | 52 | { |
---|
| 53 | std::string axis_ref_str; |
---|
| 54 | if (!cstr2string(axis_ref, axis_ref_size, axis_ref_str)) return; |
---|
| 55 | |
---|
| 56 | grid_hdl->axis_ref.setValue(axis_ref_str); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | // -------------------- Attributs des groupes de grilles -------------------- |
---|
| 60 | |
---|
[286] | 61 | void cxios_set_gridgroup_name(XGridGroupPtr gridgroup_hdl, const char * name, int name_size) |
---|
[274] | 62 | { |
---|
| 63 | std::string name_str; |
---|
| 64 | if (!cstr2string(name, name_size, name_str)) return; |
---|
| 65 | |
---|
| 66 | gridgroup_hdl->name.setValue(name_str); |
---|
| 67 | } |
---|
| 68 | |
---|
[286] | 69 | void cxios_set_gridgroup_description(XGridGroupPtr gridgroup_hdl, const char * description, int description_size) |
---|
[274] | 70 | { |
---|
| 71 | std::string description_str; |
---|
| 72 | if (!cstr2string(description, description_size, description_str)) return; |
---|
| 73 | |
---|
| 74 | gridgroup_hdl->description.setValue(description_str); |
---|
| 75 | } |
---|
| 76 | |
---|
[286] | 77 | void cxios_set_gridgroup_domain_ref(XGridGroupPtr gridgroup_hdl, const char * domain_ref, int domain_ref_size) |
---|
[274] | 78 | { |
---|
| 79 | std::string domain_ref_str; |
---|
| 80 | if (!cstr2string(domain_ref, domain_ref_size, domain_ref_str)) return; |
---|
| 81 | |
---|
| 82 | gridgroup_hdl->domain_ref.setValue(domain_ref_str); |
---|
| 83 | } |
---|
| 84 | |
---|
[286] | 85 | void cxios_set_gridgroup_axis_ref(XGridGroupPtr gridgroup_hdl, const char * axis_ref, int axis_ref_size) |
---|
[274] | 86 | { |
---|
| 87 | std::string axis_ref_str; |
---|
| 88 | if (!cstr2string(axis_ref, axis_ref_size, axis_ref_str)) return; |
---|
| 89 | |
---|
| 90 | gridgroup_hdl->axis_ref.setValue(axis_ref_str); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | // ------------------------ Création des handle ----------------------------- |
---|
| 94 | |
---|
[286] | 95 | void cxios_grid_handle_create (XGridPtr * _ret, const char * _id, int _id_len) |
---|
[274] | 96 | { |
---|
| 97 | std::string id; |
---|
| 98 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 99 | |
---|
| 100 | *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGrid>(id).get(); |
---|
| 101 | } |
---|
| 102 | |
---|
[286] | 103 | void cxios_gridgroup_handle_create (XGridGroupPtr * _ret, const char * _id, int _id_len) |
---|
[274] | 104 | { |
---|
| 105 | std::string id; |
---|
| 106 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 107 | |
---|
| 108 | *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGridGroup>(id).get(); |
---|
| 109 | } |
---|
| 110 | |
---|
[280] | 111 | // -------------------- Vérification des identifiants ----------------------- |
---|
| 112 | |
---|
[286] | 113 | void cxios_grid_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
[280] | 114 | { |
---|
| 115 | std::string id; |
---|
| 116 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 117 | |
---|
| 118 | *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CGrid>(id); |
---|
| 119 | } |
---|
| 120 | |
---|
[286] | 121 | void cxios_gridgroup_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
[280] | 122 | { |
---|
| 123 | std::string id; |
---|
| 124 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 125 | |
---|
| 126 | *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CGridGroup>(id); |
---|
| 127 | } |
---|
[274] | 128 | } // extern "C" |
---|