RAVE
pyodimsource.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 PYODIMSOURCE_H
26#define PYODIMSOURCE_H
27#include "odim_source.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
36
37#define PyOdimSource_Type_NUM 0
38
39#define PyOdimSource_GetNative_NUM 1
40#define PyOdimSource_GetNative_RETURN OdimSource_t*
41#define PyOdimSource_GetNative_PROTO (PyOdimSource*)
42
43#define PyOdimSource_New_NUM 2
44#define PyOdimSource_New_RETURN PyOdimSource*
45#define PyOdimSource_New_PROTO (OdimSource_t*)
46
47#define PyOdimSource_API_pointers 3
48
49#define PyOdimSource_CAPSULE_NAME "_odimsource._C_API"
50
51#ifdef PYODIMSOURCE_MODULE
53extern PyTypeObject PyOdimSource_Type;
54
56#define PyOdimSource_Check(op) ((op)->ob_type == &PyOdimSource_Type)
57
60
63
64#else
66static void **PyOdimSource_API;
67
72#define PyOdimSource_GetNative \
73 (*(PyOdimSource_GetNative_RETURN (*)PyOdimSource_GetNative_PROTO) PyOdimSource_API[PyOdimSource_GetNative_NUM])
74
82#define PyOdimSource_New \
83 (*(PyOdimSource_New_RETURN (*)PyOdimSource_New_PROTO) PyOdimSource_API[PyOdimSource_New_NUM])
84
88#define PyOdimSource_Check(op) \
89 (Py_TYPE(op) == &PyOdimSource_Type)
90
91#define PyOdimSource_Type (*(PyTypeObject*)PyOdimSource_API[PyOdimSource_Type_NUM])
92
96#define import_odimsource() \
97 PyOdimSource_API = (void **)PyCapsule_Import(PyOdimSource_CAPSULE_NAME, 1);
98
99#endif
100
101#endif /* PYODIMSOURCE_H */
Defines an odim source.
struct _OdimSource_t OdimSource_t
Defines a Geographical Area.
Definition odim_source.h:33
#define PyOdimSource_GetNative
Returns a pointer to the internal area, remember to release the reference when done with the object.
Definition pyodimsource.h:72
#define PyOdimSource_GetNative_PROTO
arguments for GetNative
Definition pyodimsource.h:41
#define PyOdimSource_New
Creates a new odim source instance.
Definition pyodimsource.h:82
#define PyOdimSource_New_PROTO
arguments for New
Definition pyodimsource.h:45
#define PyOdimSource_GetNative_RETURN
return type for GetNative
Definition pyodimsource.h:40
#define PyOdimSource_New_RETURN
return type for New
Definition pyodimsource.h:44
A odim source.
Definition pyodimsource.h:32
PyObject_HEAD OdimSource_t * source
the source
Definition pyodimsource.h:34