RAVE
pygra.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2014 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of RAVE.
5
6RAVE is free software: you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11RAVE is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with RAVE. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
25#ifndef PYGRA_H
26#define PYGRA_H
27#include "Python.h"
28#include "rave_gra.h"
29
33typedef struct {
34 PyObject_HEAD /*Always has to be on top*/
36} PyGra;
37
38#define PyGra_Type_NUM 0
40#define PyGra_GetNative_NUM 1
41#define PyGra_GetNative_RETURN RaveGra_t*
42#define PyGra_GetNative_PROTO (PyGra*)
44#define PyGra_New_NUM 2
45#define PyGra_New_RETURN PyGra*
46#define PyGra_New_PROTO (RaveGra_t*)
48#define PyGra_API_pointers 3
50#define PyGra_CAPSULE_NAME "_gra._C_API"
51
52
53#ifdef PYGRA_MODULE
55extern PyTypeObject PyGra_Type;
56
58#define PyGra_Check(op) ((op)->ob_type == &PyGra_Type)
59
62
65
66#else
68static void **PyGra_API;
69
74#define PyGra_GetNative \
75 (*(PyGra_GetNative_RETURN (*)PyGra_GetNative_PROTO) PyGra_API[PyGra_GetNative_NUM])
76
84#define PyGra_New \
85 (*(PyGra_New_RETURN (*)PyGra_New_PROTO) PyGra_API[PyGra_New_NUM])
86
90#define PyGra_Check(op) \
91 (Py_TYPE(op) == &PyGra_Type)
92
93#define PyGra_Type (*(PyTypeObject*)PyGra_API[PyGra_Type_NUM])
94
98#define import_gra() \
99 PyGra_API = (void **)PyCapsule_Import(PyGra_CAPSULE_NAME, 1);
100
101#endif
102
103#endif /* PYGRA_H */
#define PyGra_New_PROTO
arguments for New
Definition pygra.h:46
#define PyGra_New
Creates a new polar scan instance.
Definition pygra.h:84
#define PyGra_GetNative
Returns a pointer to the internal acrr, remember to release the reference when done with the object.
Definition pygra.h:74
#define PyGra_GetNative_RETURN
return type for GetNative
Definition pygra.h:41
#define PyGra_New_RETURN
return type for New
Definition pygra.h:45
#define PyGra_GetNative_PROTO
arguments for GetNative
Definition pygra.h:42
Gauge radar adjustment (GRA).
A gra coefficient applier.
Definition pygra.h:33
PyObject_HEAD RaveGra_t * gra
the gra applier
Definition pygra.h:35
Represents the gra applier.
Definition rave_gra.c:53