source: XMLIO_V2/dev/common/src/fortran/icgrid.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: 4.7 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::CGrid      * XGridPtr;
23   typedef xmlioserver::tree::CGridGroup * XGridGroupPtr;
24
25   // ------------------------- Attributs des axes -----------------------------
26   
27   void cxios_set_grid_name(XGridPtr grid_hdl, const char * name,  int name_size)
28   {
29      std::string name_str; 
30      if (!cstr2string(name, name_size, name_str)) return;
31
32      grid_hdl->name.setValue(name_str);
33      grid_hdl->sendAttributToServer(name_str) ;
34   }
35   
36   void cxios_set_grid_description(XGridPtr grid_hdl, const char * description,  int description_size)
37   {
38      std::string description_str; 
39      if (!cstr2string(description, description_size, description_str)) return;
40
41      grid_hdl->description.setValue(description_str);
42      grid_hdl->sendAttributToServer(description_str) ;
43   }
44   
45   void cxios_set_grid_domain_ref(XGridPtr grid_hdl, const char * domain_ref,  int domain_ref_size)
46   {
47      std::string domain_ref_str; 
48      if (!cstr2string(domain_ref, domain_ref_size, domain_ref_str)) return;
49
50      grid_hdl->domain_ref.setValue(domain_ref_str);
51      grid_hdl->sendAttributToServer(domain_ref_str) ;
52   }
53   
54   void cxios_set_grid_axis_ref(XGridPtr grid_hdl, const char * axis_ref,  int axis_ref_size)
55   {
56      std::string axis_ref_str; 
57      if (!cstr2string(axis_ref, axis_ref_size, axis_ref_str)) return;
58
59     grid_hdl->axis_ref.setValue(axis_ref_str);
60     grid_hdl->sendAttributToServer(axis_ref_str) ;
61   }
62   
63   // -------------------- Attributs des groupes de grilles --------------------
64   
65   void cxios_set_gridgroup_name(XGridGroupPtr gridgroup_hdl, const char * name,  int name_size)
66   {
67      std::string name_str; 
68      if (!cstr2string(name, name_size, name_str)) return;
69
70      gridgroup_hdl->name.setValue(name_str);
71      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->name) ;
72   }
73   
74   void cxios_set_gridgroup_description(XGridGroupPtr gridgroup_hdl, const char * description,  int description_size)
75   {
76      std::string description_str; 
77      if (!cstr2string(description, description_size, description_str)) return;
78
79      gridgroup_hdl->description.setValue(description_str);
80      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->description) ;
81   }
82   
83   void cxios_set_gridgroup_domain_ref(XGridGroupPtr gridgroup_hdl, const char * domain_ref,  int domain_ref_size)
84   {
85      std::string domain_ref_str; 
86      if (!cstr2string(domain_ref, domain_ref_size, domain_ref_str)) return;
87
88      gridgroup_hdl->domain_ref.setValue(domain_ref_str);
89      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->domain_ref) ;
90   }
91   
92   void cxios_set_gridgroup_axis_ref(XGridGroupPtr gridgroup_hdl, const char * axis_ref,  int axis_ref_size)
93   {
94      std::string axis_ref_str; 
95      if (!cstr2string(axis_ref, axis_ref_size, axis_ref_str)) return;
96
97      gridgroup_hdl->axis_ref.setValue(axis_ref_str);
98      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->axis_ref) ;
99   }
100   
101   // ------------------------ Création des handle -----------------------------
102 
103   void cxios_grid_handle_create (XGridPtr * _ret, const char * _id, int _id_len)
104   {
105      std::string id; 
106      if (!cstr2string(_id, _id_len, id)) return;
107
108      *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGrid>(id).get();
109   }
110   
111   void cxios_gridgroup_handle_create (XGridGroupPtr * _ret, const char * _id, int _id_len)
112   {
113      std::string id; 
114      if (!cstr2string(_id, _id_len, id)) return;
115
116      *_ret = xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGridGroup>(id).get();
117   }
118
119   // -------------------- Vérification des identifiants -----------------------
120
121   void cxios_grid_valid_id (bool * _ret, const char * _id, int _id_len)
122   {
123      std::string id;
124      if (!cstr2string(_id, _id_len, id)) return;
125
126      *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CGrid>(id);
127   }
128
129   void cxios_gridgroup_valid_id (bool * _ret, const char * _id, int _id_len)
130   {
131      std::string id;
132      if (!cstr2string(_id, _id_len, id)) return;
133
134      *_ret = xmlioserver::CObjectFactory::HasObject<xmlioserver::tree::CGridGroup>(id);
135   }
136} // extern "C"
Note: See TracBrowser for help on using the repository browser.