1 /***************************************************************************
2                           ncdf_cl.hpp  -  NetCDF GDL library functions
3                              -------------------
4     begin                : March 14 2004
5     copyright            : (C) 2004 by Christopher Lee
6     email                : leec_gdl@publius.co.uk
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef NCDF_HPP_CL_
19 #define NCDF_HPP_CL_
20 
21 #include <netcdf.h>
22 #include <string>
23 
24 namespace lib {
25 
26   using namespace std;
27   using namespace antlr;
28 
29   void ncdf_handle_error(EnvT* e, int status, const char * function);
30 
31   template <typename T>void ncdf_handle_error(EnvT* e, int status,
32 					      const char * function, T* data);
33 
34   DStringGDL ncdf_gdl_typename(nc_type type);
35 
36   void negzero_message(const char * name, int index, int set);
37 
38   void exceed_message(const char * name, int index, int set);
39 
40   string _ncdf_itos(int i);
41 
42 
43   BaseGDL* ncdf_open(EnvT* e);/*IDL seems to segfault
44 				after ~40 files,GDL does
45 				1024 with no segfault :)*/
46 
47   BaseGDL* ncdf_create(EnvT* e);
48   void ncdf_close(EnvT* e);
49   BaseGDL* ncdf_inquire(EnvT* e);
50   void ncdf_control(EnvT* e);
51 
52   //------------------
53   //----------------- dim relative func/pro
54 
55   void ncdf_diminq(EnvT* e);
56   void ncdf_dimrename(EnvT* e);
57 
58   BaseGDL* ncdf_dimid(EnvT* e);
59   BaseGDL* ncdf_dimdef(EnvT* e);
60 
61   //---------------------------
62   //----------------- variable relative func/pro
63 
64   void ncdf_varget1(EnvT* e);
65   void ncdf_varget(EnvT* e);
66   void ncdf_varrename(EnvT* e);
67   void ncdf_varput(EnvT* e);
68 
69   BaseGDL* ncdf_varinq(EnvT* e);
70   BaseGDL* ncdf_varid(EnvT* e);
71   BaseGDL* ncdf_vardef(EnvT* e);
72 
73   template <typename T> void ncdf_var_handle_error(EnvT *e, int status,
74 						   const char *function,
75 						   T* data);
76 
77   //----------------- attribute relative func/pro
78 
79   void ncdf_attput(EnvT* e);
80   void ncdf_attget(EnvT* e);
81   void ncdf_attdel(EnvT* e);
82   void ncdf_attrename(EnvT* e);
83 
84   BaseGDL* ncdf_attinq(EnvT* e);
85   BaseGDL* ncdf_attname(EnvT* e);
86   BaseGDL* ncdf_attcopy(EnvT* e);
87 
88   template <typename T> void ncdf_att_handle_error(EnvT *e, int status,
89 						   const char *function,
90 						   T* data);
91 
92   // --- groups were introduced in netcdf4
93 
94   BaseGDL* ncdf_groupsinq(EnvT* e);
95   BaseGDL* ncdf_groupname(EnvT* e);
96   BaseGDL* ncdf_groupdef(EnvT* e);
97   BaseGDL* ncdf_fullgroupname(EnvT* e);
98   BaseGDL* ncdf_groupparent(EnvT* e);
99   BaseGDL* ncdf_dimidsinq(EnvT* e);
100   BaseGDL* ncdf_ncidinq(EnvT* e);
101   BaseGDL* ncdf_varidsinq(EnvT* e);
102   BaseGDL* ncdf_unlimdimsinq(EnvT* e);
103 
104   template <typename T> void ncdf_grp_handle_error(EnvT *e, int status,
105 						   const char *function,
106 						   T* data);
107 
108 } // namespace
109 
110 #endif
111