RAVE
pyiocache.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------------------------------------------------------------------------*/
25#ifndef PYRAVEIOCACHE_H
26#define PYRAVEIOCACHE_H
27#include "rave_iocache.h"
28
32typedef struct {
33 PyObject_HEAD /* Always has to be on top */
36
37#define PyRaveIOCache_Type_NUM 0
39#define PyRaveIOCache_GetNative_NUM 1
40#define PyRaveIOCache_GetNative_RETURN RaveIOCache_t*
41#define PyRaveIOCache_GetNative_PROTO (PyRaveIOCache*)
43#define PyRaveIOCache_New_NUM 2
44#define PyRaveIOCache_New_RETURN PyRaveIOCache*
45#define PyRaveIOCache_New_PROTO (RaveIOCache_t*)
47#define PyRaveIOCache_API_pointers 3
49#define PyRaveIOCache_CAPSULE_NAME "_iocache._C_API"
50
51#ifdef PYRAVEIOCACHE_MODULE
53extern PyTypeObject PyRaveIOCache_Type;
54
56#define PyRaveIOCache_Check(op) ((op)->ob_type == &PyRaveIOCache_Type)
57
60
63
64#else
66static void **PyRaveIOCache_API;
67
72#define PyRaveIOCache_GetNative \
73 (*(PyRaveIOCache_GetNative_RETURN (*)PyRaveIOCache_GetNative_PROTO) PyRaveIOCache_API[PyRaveIOCache_GetNative_NUM])
74
82#define PyRaveIOCache_New \
83 (*(PyRaveIOCache_New_RETURN (*)PyRaveIOCache_New_PROTO) PyRaveIOCache_API[PyRaveIOCache_New_NUM])
84
88#define PyRaveIOCache_Check(op) \
89 (Py_TYPE(op) == &PyRaveIOCache_Type)
90
91#define PyRaveIOCache_Type (*(PyTypeObject*)PyRaveIOCache_API[PyRaveIOCache_Type_NUM])
92
96#define import_iocache() \
97 PyRaveIOCache_API = (void **)PyCapsule_Import(PyRaveIOCache_CAPSULE_NAME, 1);
98
99#endif
100
101#endif /* PYRAVEIOCACHE_H */
#define PyRaveIOCache_GetNative_PROTO
argument prototype for GetNative
Definition pyiocache.h:41
#define PyRaveIOCache_GetNative_RETURN
return type for GetNative
Definition pyiocache.h:40
#define PyRaveIOCache_New
Creates a new rave io cache instance.
Definition pyiocache.h:82
#define PyRaveIOCache_GetNative
Returns a pointer to the internal rave io, remember to release the reference when done with the objec...
Definition pyiocache.h:72
#define PyRaveIOCache_New_RETURN
return type for New
Definition pyiocache.h:44
#define PyRaveIOCache_New_PROTO
argument prototype for New
Definition pyiocache.h:45
Functions for managing io cache files like static files.
The RaveIOCache.
Definition pyiocache.h:32
PyObject_HEAD RaveIOCache_t * iocache
the iocache instance
Definition pyiocache.h:34
Defines the structure for the RaveIOCache.
Definition rave_iocache.c:48