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 | |
---|
27 | void cxios_set_file_name(XFilePtr file_hdl, const char * name, int name_size) |
---|
28 | { |
---|
29 | std::string name_str; |
---|
30 | if (!cstr2string(name, name_size, name_str)) return; |
---|
31 | |
---|
32 | file_hdl->name.setValue(name_str); |
---|
33 | } |
---|
34 | |
---|
35 | void cxios_set_file_description(XFilePtr file_hdl, const char * description, int description_size) |
---|
36 | { |
---|
37 | std::string description_str; |
---|
38 | if (!cstr2string(description, description_size, description_str)) return; |
---|
39 | |
---|
40 | file_hdl->description.setValue(description_str); |
---|
41 | } |
---|
42 | |
---|
43 | void cxios_set_file_name_suffix(XFilePtr file_hdl, const char * name_suffix, int name_suffix_size) |
---|
44 | { |
---|
45 | std::string name_suffix_str; |
---|
46 | if (!cstr2string(name_suffix, name_suffix_size, name_suffix_str)) return; |
---|
47 | |
---|
48 | file_hdl->name_suffix.setValue(name_suffix_str); |
---|
49 | } |
---|
50 | |
---|
51 | void cxios_set_file_output_freq(XFilePtr file_hdl, const char * output_freq, int output_freq_size) |
---|
52 | { |
---|
53 | std::string output_freq_str; |
---|
54 | if (!cstr2string(output_freq, output_freq_size, output_freq_str)) return; |
---|
55 | |
---|
56 | file_hdl->output_freq.setValue(output_freq_str); |
---|
57 | } |
---|
58 | |
---|
59 | void cxios_set_file_output_level(XFilePtr file_hdl, int output_level) |
---|
60 | { |
---|
61 | file_hdl->output_level.setValue(output_level); |
---|
62 | } |
---|
63 | |
---|
64 | void cxios_set_file_enabled(XFilePtr file_hdl, bool enabled) |
---|
65 | { |
---|
66 | file_hdl->enabled.setValue(enabled); |
---|
67 | } |
---|
68 | |
---|
69 | // -------------------- Attributs des groupes d'axes ------------------------ |
---|
70 | |
---|
71 | void cxios_set_filegroup_name(XFileGroupPtr filegroup_hdl, const char * name, int name_size) |
---|
72 | { |
---|
73 | std::string name_str; |
---|
74 | if (!cstr2string(name, name_size, name_str)) return; |
---|
75 | if (!cstr2string(name, name_size, name_str)) return; |
---|
76 | |
---|
77 | filegroup_hdl->name.setValue(name_str); |
---|
78 | } |
---|
79 | |
---|
80 | void cxios_set_filegroup_description(XFileGroupPtr filegroup_hdl, const char * description, int description_size) |
---|
81 | { |
---|
82 | std::string description_str; |
---|
83 | if (!cstr2string(description, description_size, description_str)) return; |
---|
84 | |
---|
85 | filegroup_hdl->description.setValue(description_str); |
---|
86 | } |
---|
87 | |
---|
88 | void cxios_set_filegroup_name_suffix(XFileGroupPtr filegroup_hdl, const char * name_suffix, int name_suffix_size) |
---|
89 | { |
---|
90 | std::string name_suffix_str; |
---|
91 | if (!cstr2string(name_suffix, name_suffix_size, name_suffix_str)) return; |
---|
92 | |
---|
93 | filegroup_hdl->name_suffix.setValue(name_suffix_str); |
---|
94 | } |
---|
95 | |
---|
96 | void cxios_set_filegroup_output_freq(XFileGroupPtr filegroup_hdl, const char * output_freq, int output_freq_size) |
---|
97 | { |
---|
98 | std::string output_freq_str; |
---|
99 | if (!cstr2string(output_freq, output_freq_size, output_freq_str)) return; |
---|
100 | |
---|
101 | filegroup_hdl->output_freq.setValue(output_freq_str); |
---|
102 | } |
---|
103 | |
---|
104 | void cxios_set_filegroup_output_level(XFileGroupPtr filegroup_hdl, int output_level) |
---|
105 | { |
---|
106 | filegroup_hdl->output_level.setValue(output_level); |
---|
107 | } |
---|
108 | |
---|
109 | void cxios_set_filegroup_enabled(XFileGroupPtr filegroup_hdl, bool enabled) |
---|
110 | { |
---|
111 | filegroup_hdl->enabled.setValue(enabled); |
---|
112 | } |
---|
113 | |
---|
114 | // ------------------------ Création des handle ----------------------------- |
---|
115 | |
---|
116 | void cxios_file_handle_create (XFilePtr * _ret, const char * _id, int _id_len) |
---|
117 | { |
---|
118 | std::string id; |
---|
119 | if (!cstr2string(_id, _id_len, id)) return; |
---|
120 | |
---|
121 | *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(id).get(); |
---|
122 | } |
---|
123 | |
---|
124 | void cxios_filegroup_handle_create (XFileGroupPtr * _ret, const char * _id, int _id_len) |
---|
125 | { |
---|
126 | std::string id; |
---|
127 | if (!cstr2string(_id, _id_len, id)) return; |
---|
128 | |
---|
129 | *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(id).get(); |
---|
130 | } |
---|
131 | |
---|
132 | // -------------------- Vérification des identifiants ----------------------- |
---|
133 | |
---|
134 | void cxios_file_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
135 | { |
---|
136 | std::string id; |
---|
137 | if (!cstr2string(_id, _id_len, id)) return; |
---|
138 | |
---|
139 | *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CFile>(id); |
---|
140 | } |
---|
141 | |
---|
142 | void cxios_filegroup_valid_id (bool * _ret, const char * _id, int _id_len) |
---|
143 | { |
---|
144 | std::string id; |
---|
145 | if (!cstr2string(_id, _id_len, id)) return; |
---|
146 | |
---|
147 | *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CFileGroup>(id); |
---|
148 | } |
---|
149 | } // extern "C" |
---|