RAVE
pyarea.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2009 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 PYAREA_H
26#define PYAREA_H
27#include "area.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
35} PyArea;
36
37#define PyArea_Type_NUM 0
39#define PyArea_GetNative_NUM 1
40#define PyArea_GetNative_RETURN Area_t*
41#define PyArea_GetNative_PROTO (PyArea*)
43#define PyArea_New_NUM 2
44#define PyArea_New_RETURN PyArea*
45#define PyArea_New_PROTO (Area_t*)
47#define PyArea_API_pointers 3
49#define PyArea_CAPSULE_NAME "_area._C_API"
50
51#ifdef PYAREA_MODULE
53extern PyTypeObject PyArea_Type;
54
56#define PyArea_Check(op) ((op)->ob_type == &PyArea_Type)
57
60
63
64#else
66static void **PyArea_API;
67
72#define PyArea_GetNative \
73 (*(PyArea_GetNative_RETURN (*)PyArea_GetNative_PROTO) PyArea_API[PyArea_GetNative_NUM])
74
82#define PyArea_New \
83 (*(PyArea_New_RETURN (*)PyArea_New_PROTO) PyArea_API[PyArea_New_NUM])
84
88#define PyArea_Check(op) \
89 (Py_TYPE(op) == &PyArea_Type)
90
91#define PyArea_Type (*(PyTypeObject*)PyArea_API[PyArea_Type_NUM])
92
96#define import_pyarea() \
97 PyArea_API = (void **)PyCapsule_Import(PyArea_CAPSULE_NAME, 1);
98
99#endif
100
101#endif /* PYAREA_H */
Defines an area, the extent, projection, etc.
#define PyArea_GetNative
Returns a pointer to the internal area, remember to release the reference when done with the object.
Definition pyarea.h:72
#define PyArea_New
Creates a new polar scan instance.
Definition pyarea.h:82
#define PyArea_GetNative_RETURN
return type for GetNative
Definition pyarea.h:40
#define PyArea_New_PROTO
arguments for New
Definition pyarea.h:45
#define PyArea_GetNative_PROTO
arguments for GetNative
Definition pyarea.h:41
#define PyArea_New_RETURN
return type for New
Definition pyarea.h:44
A cartesian product.
Definition pyarea.h:32
PyObject_HEAD Area_t * area
the area
Definition pyarea.h:34
Represents the area.
Definition area.c:34