[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::CFile * XFilePtr; |
---|
| 23 | typedef xmlioserver::tree::CFileGroup * XFileGroupPtr; |
---|
| 24 | |
---|
| 25 | // ------------------------- Attributs des axes ----------------------------- |
---|
| 26 | |
---|
[286] | 27 | void cxios_set_file_name(XFilePtr file_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 | file_hdl->name.setValue(name_str); |
---|
[300] | 33 | file_hdl->sendAttributToServer(file_hdl->name) ; |
---|
[274] | 34 | } |
---|
| 35 | |
---|
[286] | 36 | void cxios_set_file_description(XFilePtr file_hdl, const char * description, int description_size) |
---|
[274] | 37 | { |
---|
| 38 | std::string description_str; |
---|
| 39 | if (!cstr2string(description, description_size, description_str)) return; |
---|
| 40 | |
---|
| 41 | file_hdl->description.setValue(description_str); |
---|
[300] | 42 | file_hdl->sendAttributToServer(file_hdl->description) ; |
---|
[274] | 43 | } |
---|
| 44 | |
---|
[286] | 45 | void cxios_set_file_name_suffix(XFilePtr file_hdl, const char * name_suffix, int name_suffix_size) |
---|
[275] | 46 | { |
---|
| 47 | std::string name_suffix_str; |
---|
| 48 | if (!cstr2string(name_suffix, name_suffix_size, name_suffix_str)) return; |
---|
| 49 | |
---|
| 50 | file_hdl->name_suffix.setValue(name_suffix_str); |
---|
[300] | 51 | file_hdl->sendAttributToServer(file_hdl->name_suffix) ; |
---|
[275] | 52 | } |
---|
| 53 | |
---|
[286] | 54 | void cxios_set_file_output_freq(XFilePtr file_hdl, const char * output_freq, int output_freq_size) |
---|
[274] | 55 | { |
---|
| 56 | std::string output_freq_str; |
---|
| 57 | if (!cstr2string(output_freq, output_freq_size, output_freq_str)) return; |
---|
| 58 | |
---|
| 59 | file_hdl->output_freq.setValue(output_freq_str); |
---|
[300] | 60 | file_hdl->sendAttributToServer(file_hdl->output_freq) ; |
---|
[274] | 61 | } |
---|
| 62 | |
---|
[286] | 63 | void cxios_set_file_output_level(XFilePtr file_hdl, int output_level) |
---|
[274] | 64 | { |
---|
| 65 | file_hdl->output_level.setValue(output_level); |
---|
[300] | 66 | file_hdl->sendAttributToServer(file_hdl->output_level) ; |
---|
[274] | 67 | } |
---|
| 68 | |
---|
[286] | 69 | void cxios_set_file_enabled(XFilePtr file_hdl, bool enabled) |
---|
[274] | 70 | { |
---|
| 71 | file_hdl->enabled.setValue(enabled); |
---|
[300] | 72 | file_hdl->sendAttributToServer(file_hdl->enabled) ; |
---|
[274] | 73 | } |
---|
| 74 | |
---|
[300] | 75 | void cxios_set_file_type(XFilePtr file_hdl, const char * type, int type_size) |
---|
| 76 | { |
---|
| 77 | std::string type_str; |
---|
| 78 | if (!cstr2string(type, type_size, type_str)) return; |
---|
| 79 | |
---|
| 80 | file_hdl->type.setValue(type_str); |
---|
| 81 | file_hdl->sendAttributToServer(file_hdl->type) ; |
---|
| 82 | } |
---|
| 83 | |
---|
[274] | 84 | // -------------------- Attributs des groupes d'axes ------------------------ |
---|
| 85 | |
---|
[286] | 86 | void cxios_set_filegroup_name(XFileGroupPtr filegroup_hdl, const char * name, int name_size) |
---|
[274] | 87 | { |
---|
| 88 | std::string name_str; |
---|
| 89 | if (!cstr2string(name, name_size, name_str)) return; |
---|
| 90 | |
---|
| 91 | filegroup_hdl->name.setValue(name_str); |
---|
[300] | 92 | filegroup_hdl->sendAttributToServer(filegroup_hdl->name) ; |
---|
[274] | 93 | } |
---|
| 94 | |
---|
[286] | 95 | void cxios_set_filegroup_description(XFileGroupPtr filegroup_hdl, const char * description, int description_size) |
---|
[274] | 96 | { |
---|
| 97 | std::string description_str; |
---|
| 98 | if (!cstr2string(description, description_size, description_str)) return; |
---|
| 99 | |
---|
| 100 | filegroup_hdl->description.setValue(description_str); |
---|
[300] | 101 | filegroup_hdl->sendAttributToServer(filegroup_hdl->description) ; |
---|
[274] | 102 | } |
---|
| 103 | |
---|
[286] | 104 | void cxios_set_filegroup_name_suffix(XFileGroupPtr filegroup_hdl, const char * name_suffix, int name_suffix_size) |
---|
[275] | 105 | { |
---|
| 106 | std::string name_suffix_str; |
---|
| 107 | if (!cstr2string(name_suffix, name_suffix_size, name_suffix_str)) return; |
---|
| 108 | |
---|
| 109 | filegroup_hdl->name_suffix.setValue(name_suffix_str); |
---|
[300] | 110 | filegroup_hdl->sendAttributToServer(filegroup_hdl->name_suffix) ; |
---|
[275] | 111 | } |
---|
| 112 | |
---|
[286] | 113 | void cxios_set_filegroup_output_freq(XFileGroupPtr filegroup_hdl, const char * output_freq, int output_freq_size) |
---|
[274] | 114 | { |
---|
| 115 | std::string output_freq_str; |
---|
| 116 | if (!cstr2string(output_freq, output_freq_size, output_freq_str)) return; |
---|
| 117 | |
---|
| 118 | filegroup_hdl->output_freq.setValue(output_freq_str); |
---|
[300] | 119 | filegroup_hdl->sendAttributToServer(filegroup_hdl->output_freq) ; |
---|
[274] | 120 | } |
---|
| 121 | |
---|
[286] | 122 | void cxios_set_filegroup_output_level(XFileGroupPtr filegroup_hdl, int output_level) |
---|
[274] | 123 | { |
---|
| 124 | filegroup_hdl->output_level.setValue(output_level); |
---|
[300] | 125 | filegroup_hdl->sendAttributToServer(filegroup_hdl->output_level) ; |
---|
[274] | 126 | } |
---|
| 127 | |
---|
[286] | 128 | void cxios_set_filegroup_enabled(XFileGroupPtr filegroup_hdl, bool enabled) |
---|
[274] | 129 | { |
---|
| 130 | filegroup_hdl->enabled.setValue(enabled); |
---|
[300] | 131 | filegroup_hdl->sendAttributToServer(filegroup_hdl->enabled) ; |
---|
[274] | 132 | } |
---|
| 133 | |
---|
[300] | 134 | void cxios_set_filegroup_type(XFileGroupPtr filegroup_hdl, const char * type, int type_size) |
---|
| 135 | { |
---|
| 136 | std::string type_str; |
---|
| 137 | if (!cstr2string(type, type_size, type_str)) return; |
---|
| 138 | |
---|
| 139 | filegroup_hdl->type.setValue(type_str); |
---|
| 140 | filegroup_hdl->sendAttributToServer(filegroup_hdl->type) ; |
---|
| 141 | } |
---|
| 142 | |
---|
[274] | 143 | // ------------------------ Création des handle ----------------------------- |
---|
| 144 | |
---|
[286] | 145 | void cxios_file_handle_create (XFilePtr * _ret, const char * _id, int _id_len) |
---|
[274] | 146 | { |
---|
| 147 | std::string id; |
---|
| 148 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 149 | |
---|
| 150 | *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(id).get(); |
---|
| 151 | } |
---|
| 152 | |
---|
[286] | 153 | void cxios_filegroup_handle_create (XFileGroupPtr * _ret, const char * _id, int _id_len) |
---|
[274] | 154 | { |
---|
| 155 | std::string id; |
---|
| 156 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 157 | |
---|
| 158 | *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(id).get(); |
---|
| 159 | } |
---|
[280] | 160 | |
---|
| 161 | // -------------------- Vérification des identifiants ----------------------- |
---|
| 162 | |
---|
[286] | 163 | void cxios_file_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
[280] | 164 | { |
---|
| 165 | std::string id; |
---|
| 166 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 167 | |
---|
| 168 | *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CFile>(id); |
---|
| 169 | } |
---|
| 170 | |
---|
[286] | 171 | void cxios_filegroup_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
[280] | 172 | { |
---|
| 173 | std::string id; |
---|
| 174 | if (!cstr2string(_id, _id_len, id)) return; |
---|
| 175 | |
---|
| 176 | *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CFileGroup>(id); |
---|
| 177 | } |
---|
[274] | 178 | } // extern "C" |
---|