RAVE
pyodimsources.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2025 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 PYODIMSOURCES_H
26#define PYODIMSOURCES_H
27#include "odim_sources.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
36
37#define PyOdimSources_Type_NUM 0
38
39#define PyOdimSources_GetNative_NUM 1
40#define PyOdimSources_GetNative_RETURN OdimSources_t*
41#define PyOdimSources_GetNative_PROTO (PyOdimSources*)
42
43#define PyOdimSources_New_NUM 2
44#define PyOdimSources_New_RETURN PyOdimSources*
45#define PyOdimSources_New_PROTO (OdimSources_t*)
46
47#define PyOdimSources_Load_NUM 3
48#define PyOdimSources_Load_RETURN PyOdimSources*
49#define PyOdimSources_Load_PROTO (const char* filename)
50
51#define PyOdimSources_API_pointers 4
52
53#define PyOdimSources_CAPSULE_NAME "_odimsources._C_API"
54
55#ifdef PYODIMSOURCES_MODULE
57extern PyTypeObject PyOdimSources_Type;
58
60#define PyOdimSources_Check(op) ((op)->ob_type == &PyOdimSources_Type)
61
64
67
70
71#else
73static void **PyOdimSources_API;
74
79#define PyOdimSources_GetNative \
80 (*(PyOdimSources_GetNative_RETURN (*)PyOdimSources_GetNative_PROTO) PyOdimSources_API[PyOdimSources_GetNative_NUM])
81
89#define PyOdimSources_New \
90 (*(PyOdimSources_New_RETURN (*)PyOdimSources_New_PROTO) PyOdimSources_API[PyOdimSources_New_NUM])
91
97#define PyOdimSources_Load \
98 (*(PyOdimSources_Load_RETURN (*)PyOdimSources_Load_PROTO) PyOdimSources_API[PyOdimSources_Load_NUM])
99
103#define PyOdimSources_Check(op) \
104 (Py_TYPE(op) == &PyOdimSources_Type)
105
106#define PyOdimSources_Type (*(PyTypeObject*)PyOdimSources_API[PyOdimSources_Type_NUM])
107
111#define import_odimsources() \
112 PyOdimSources_API = (void **)PyCapsule_Import(PyOdimSources_CAPSULE_NAME, 1);
113
114#endif
115
116#endif /* PYODIMSOURCES_H */
Provides support for reading the odim sources from an xml-file This object supports RAVE_OBJECT_CLONE...
struct _OdimSources_t OdimSources_t
Defines the odim sources.
Definition odim_sources.h:35
#define PyOdimSources_New_PROTO
arguments for New
Definition pyodimsources.h:45
#define PyOdimSources_GetNative_PROTO
arguments for GetNative
Definition pyodimsources.h:41
#define PyOdimSources_New
Creates a odim sources instance.
Definition pyodimsources.h:89
#define PyOdimSources_Load_PROTO
argument prototype for Open
Definition pyodimsources.h:49
#define PyOdimSources_Load
Loads a odim sources instance.
Definition pyodimsources.h:97
#define PyOdimSources_GetNative
Returns a pointer to the internal odim sources, remember to release the reference when done with the ...
Definition pyodimsources.h:79
#define PyOdimSources_New_RETURN
return type for New
Definition pyodimsources.h:44
#define PyOdimSources_Load_RETURN
return type for Load
Definition pyodimsources.h:48
#define PyOdimSources_GetNative_RETURN
return type for GetNative
Definition pyodimsources.h:40
A cartesian product.
Definition pyodimsources.h:32
PyObject_HEAD OdimSources_t * sources
the odim sources
Definition pyodimsources.h:34