source: XMLIO_V2/dev/common/src/fortran/icfile.cpp @ 300

Last change on this file since 300 was 300, checked in by ymipsl, 12 years ago

nouvelle version de developpement de xios

  • nouvelle interface fortran
  • recodage complet de la couche de communication
  • et bien d'autres choses...

YM

File size: 6.2 KB
Line 
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
16extern "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      file_hdl->sendAttributToServer(file_hdl->name) ;
34   }
35   
36   void cxios_set_file_description(XFilePtr file_hdl, const char * description, int description_size)
37   {
38      std::string description_str; 
39      if (!cstr2string(description, description_size, description_str)) return;
40
41      file_hdl->description.setValue(description_str);
42      file_hdl->sendAttributToServer(file_hdl->description) ;
43   } 
44   
45   void cxios_set_file_name_suffix(XFilePtr file_hdl, const char * name_suffix, int name_suffix_size)
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);
51      file_hdl->sendAttributToServer(file_hdl->name_suffix) ;
52   } 
53   
54   void cxios_set_file_output_freq(XFilePtr file_hdl, const char * output_freq, int output_freq_size)
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);
60      file_hdl->sendAttributToServer(file_hdl->output_freq) ;
61   }
62   
63   void cxios_set_file_output_level(XFilePtr file_hdl, int output_level)
64   {
65      file_hdl->output_level.setValue(output_level);
66      file_hdl->sendAttributToServer(file_hdl->output_level) ;
67   }
68   
69   void cxios_set_file_enabled(XFilePtr file_hdl, bool enabled)
70   {
71      file_hdl->enabled.setValue(enabled);
72      file_hdl->sendAttributToServer(file_hdl->enabled) ;
73   }
74   
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   
84   // -------------------- Attributs des groupes d'axes ------------------------
85   
86   void cxios_set_filegroup_name(XFileGroupPtr filegroup_hdl, const char * name, int name_size)
87   {
88      std::string name_str; 
89      if (!cstr2string(name, name_size, name_str)) return;
90
91      filegroup_hdl->name.setValue(name_str);
92      filegroup_hdl->sendAttributToServer(filegroup_hdl->name) ;
93   }
94   
95   void cxios_set_filegroup_description(XFileGroupPtr filegroup_hdl, const char * description, int description_size)
96   {
97      std::string description_str; 
98      if (!cstr2string(description, description_size, description_str)) return;
99
100      filegroup_hdl->description.setValue(description_str);
101      filegroup_hdl->sendAttributToServer(filegroup_hdl->description) ;
102   } 
103   
104   void cxios_set_filegroup_name_suffix(XFileGroupPtr filegroup_hdl, const char * name_suffix, int name_suffix_size)
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);
110      filegroup_hdl->sendAttributToServer(filegroup_hdl->name_suffix) ;
111   } 
112   
113   void cxios_set_filegroup_output_freq(XFileGroupPtr filegroup_hdl, const char * output_freq, int output_freq_size)
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);
119      filegroup_hdl->sendAttributToServer(filegroup_hdl->output_freq) ;
120   }
121   
122   void cxios_set_filegroup_output_level(XFileGroupPtr filegroup_hdl, int output_level)
123   {
124      filegroup_hdl->output_level.setValue(output_level);
125      filegroup_hdl->sendAttributToServer(filegroup_hdl->output_level) ;
126   }
127   
128   void cxios_set_filegroup_enabled(XFileGroupPtr filegroup_hdl, bool enabled)
129   {
130      filegroup_hdl->enabled.setValue(enabled);
131      filegroup_hdl->sendAttributToServer(filegroup_hdl->enabled) ;
132   }
133   
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   
143   // ------------------------ Création des handle -----------------------------
144   
145   void cxios_file_handle_create (XFilePtr * _ret, const char * _id, int _id_len)
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   
153   void cxios_filegroup_handle_create (XFileGroupPtr * _ret, const char * _id, int _id_len)
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   }
160
161   // -------------------- Vérification des identifiants -----------------------
162
163   void cxios_file_valid_id (bool * _ret, const char * _id, int _id_len)
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
171   void cxios_filegroup_valid_id (bool * _ret, const char * _id, int _id_len)
172   {
173      std::string id;
174      if (!cstr2string(_id, _id_len, id)) return;
175
176      *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CFileGroup>(id);
177   }
178} // extern "C"
Note: See TracBrowser for help on using the repository browser.