RAVE
pyravefield.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2009-2010 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 PYRAVEFIELD_H
26#define PYRAVEFIELD_H
27#include "rave_field.h"
28
32typedef struct {
33 PyObject_HEAD /*Always have to be on top*/
36
37#define PyRaveField_Type_NUM 0
39#define PyRaveField_GetNative_NUM 1
40#define PyRaveField_GetNative_RETURN RaveField_t*
41#define PyRaveField_GetNative_PROTO (PyRaveField*)
43#define PyRaveField_New_NUM 2
44#define PyRaveField_New_RETURN PyRaveField*
45#define PyRaveField_New_PROTO (RaveField_t*)
47#define PyRaveField_API_pointers 3
49#define PyRaveField_CAPSULE_NAME "_ravefield._C_API"
50
51#ifdef PYRAVEFIELD_MODULE
53extern PyTypeObject PyRaveField_Type;
54
56#define PyRaveField_Check(op) ((op)->ob_type == &PyRaveField_Type)
57
60
63
64#else
66static void **PyRaveField_API;
67
72#define PyRaveField_GetNative \
73 (*(PyRaveField_GetNative_RETURN (*)PyRaveField_GetNative_PROTO) PyRaveField_API[PyRaveField_GetNative_NUM])
74
82#define PyRaveField_New \
83 (*(PyRaveField_New_RETURN (*)PyRaveField_New_PROTO) PyRaveField_API[PyRaveField_New_NUM])
84
88#define PyRaveField_Check(op) \
89 (Py_TYPE(op) == &PyRaveField_Type)
90
91#define PyRaveField_Type (*(PyTypeObject*)PyRaveField_API[PyRaveField_Type_NUM])
92
96#define import_pyravefield() \
97 PyRaveField_API = (void **)PyCapsule_Import(PyRaveField_CAPSULE_NAME, 1);
98
99#endif
100
101
102#endif /* PYRAVEFIELD_H */
#define PyRaveField_New_RETURN
return type for New
Definition pyravefield.h:44
#define PyRaveField_New_PROTO
arguments for New
Definition pyravefield.h:45
#define PyRaveField_GetNative
Returns a pointer to the internal field, remember to release the reference when done with the object.
Definition pyravefield.h:72
#define PyRaveField_GetNative_PROTO
arguments for GetNative
Definition pyravefield.h:41
#define PyRaveField_GetNative_RETURN
return type for GetNative
Definition pyravefield.h:40
#define PyRaveField_New
Creates a new rave field instance.
Definition pyravefield.h:82
Generic field that only provides a 2-dim data field and a number of dynamic attributes.
The rave field object.
Definition pyravefield.h:32
PyObject_HEAD RaveField_t * field
the rave field
Definition pyravefield.h:34
Represents the cartesian volume.
Definition rave_field.c:36