RAVE
pyacqva.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2024 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------------------------------------------------------------------------*/
26#ifndef PYACQVA_H
27#define PYACQVA_H
28#include "acqva.h"
29
34typedef struct {
35 PyObject_HEAD; /*Always has to be on top*/
37} PyAcqva;
38
39#define PyAcqva_Type_NUM 0
40
41#define PyAcqva_GetNative_NUM 1
42#define PyAcqva_GetNative_RETURN Acqva_t*
43#define PyAcqva_GetNative_PROTO (PyAcqva*)
44
45#define PyAcqva_New_NUM 2
46#define PyAcqva_New_RETURN PyAcqva*
47#define PyAcqva_New_PROTO (Acqva_t*)
48
49#define PyAcqva_API_pointers 3
50
51#define PyAcqva_CAPSULE_NAME "_pyacqva._C_API"
52
53
54#ifdef PYACQVA_MODULE
56extern PyTypeObject PyAcqva_Type;
57
59#define PyAcqva_Check(op) ((op)->ob_type == &PyAcqva_Type)
60
63
66
67#else
69static void **PyAcqva_API;
70
75#define PyAcqva_GetNative \
76 (*(PyAcqva_GetNative_RETURN (*)PyAcqva_GetNative_PROTO) PyAcqva_API[PyAcqva_GetNative_NUM])
77
85#define PyAcqva_New \
86 (*(PyAcqva_New_RETURN (*)PyAcqva_New_PROTO) PyAcqva_API[PyAcqva_New_NUM])
87
91#define PyAcqva_Check(op) \
92 (Py_TYPE(op) == &PyAcqva_Type)
93
94#define PyAcqva_Type (*(PyTypeObject*)PyAcqva_API[PyAcqva_Type_NUM])
95
99#define import_pyacqva() \
100 PyAcqva_API = (void **)PyCapsule_Import(PyAcqva_CAPSULE_NAME, 1);
101
102#endif
103
104
105
106#endif /* PyAcqva_H */
Provides functionality for creating composites according to the acqva method.
struct _Acqva_t Acqva_t
Defines a Acqva composite generator.
Definition acqva.h:42
#define PyAcqva_GetNative_PROTO
arguments for GetNative
Definition pyacqva.h:43
#define PyAcqva_New_PROTO
arguments for New
Definition pyacqva.h:47
#define PyAcqva_GetNative_RETURN
return type for GetNative
Definition pyacqva.h:42
#define PyAcqva_New_RETURN
return type for New
Definition pyacqva.h:46
#define PyAcqva_New
Creates a new acqva instance.
Definition pyacqva.h:85
#define PyAcqva_GetNative
Returns a pointer to the internal composite, remember to release the reference when done with the obj...
Definition pyacqva.h:75
A composite generator.
Definition pyacqva.h:34
Acqva_t * acqva
the composite generator
Definition pyacqva.h:36