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

Last change on this file since 274 was 274, checked in by hozdoba, 13 years ago

nouvelle interface fortran et corrections

File size: 3.8 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 xios_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 xios_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 xios_set_file_output_freq(XFilePtr file_hdl, const char * output_freq, int output_freq_size)
44   {
45      std::string output_freq_str; 
46      if (!cstr2string(output_freq, output_freq_size, output_freq_str)) return;
47
48      file_hdl->output_freq.setValue(output_freq_str);
49   }
50   
51   void xios_set_file_output_level(XFilePtr file_hdl, int output_level)
52   {
53      file_hdl->output_level.setValue(output_level);
54   }
55   
56   void xios_set_file_enabled(XFilePtr file_hdl, bool enabled)
57   {
58      file_hdl->enabled.setValue(enabled);
59   }
60   
61   // -------------------- Attributs des groupes d'axes ------------------------
62   
63   void xios_set_filegroup_name(XFileGroupPtr filegroup_hdl, const char * name, int name_size)
64   {
65      std::string name_str; 
66      if (!cstr2string(name, name_size, name_str)) return;
67      if (!cstr2string(name, name_size, name_str)) return;
68
69      filegroup_hdl->name.setValue(name_str);
70   }
71   
72   void xios_set_filegroup_description(XFileGroupPtr filegroup_hdl, const char * description, int description_size)
73   {
74      std::string description_str; 
75      if (!cstr2string(description, description_size, description_str)) return;
76
77      filegroup_hdl->description.setValue(description_str);
78   } 
79   
80   void xios_set_filegroup_output_freq(XFileGroupPtr filegroup_hdl, const char * output_freq, int output_freq_size)
81   {
82      std::string output_freq_str; 
83      if (!cstr2string(output_freq, output_freq_size, output_freq_str)) return;
84
85      filegroup_hdl->output_freq.setValue(output_freq_str);
86   }
87   
88   void xios_set_filegroup_output_level(XFileGroupPtr filegroup_hdl, int output_level)
89   {
90      filegroup_hdl->output_level.setValue(output_level);
91   }
92   
93   void xios_set_filegroup_enabled(XFileGroupPtr filegroup_hdl, bool enabled)
94   {
95      filegroup_hdl->enabled.setValue(enabled);
96   }
97   
98   // ------------------------ Création des handle -----------------------------
99   
100   void xios_file_handle_create (XFilePtr * _ret, const char * _id, int _id_len)
101   {
102      std::string id; 
103      if (!cstr2string(_id, _id_len, id)) return;
104
105      *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(id).get();
106   }
107   
108   void xios_filegroup_handle_create (XFileGroupPtr * _ret, const char * _id, int _id_len)
109   {
110      std::string id; 
111      if (!cstr2string(_id, _id_len, id)) return;
112
113      *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(id).get();
114   }
115   
116} // extern "C"
Note: See TracBrowser for help on using the repository browser.