RAVE
pytransform.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 PYTRANSFORM_H
26#define PYTRANSFORM_H
27#include "transform.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
36
37#define PyTransform_Type_NUM 0
39#define PyTransform_GetNative_NUM 1
40#define PyTransform_GetNative_RETURN Transform_t*
41#define PyTransform_GetNative_PROTO (PyTransform*)
43#define PyTransform_New_NUM 2
44#define PyTransform_New_RETURN PyTransform*
45#define PyTransform_New_PROTO (Transform_t*)
47#define PyTransform_API_pointers 3
49#define PyTransform_CAPSULE_NAME "_transform._C_API"
50
51#ifdef PYTRANSFORM_MODULE
53extern PyTypeObject PyTransform_Type;
54
56#define PyTransform_Check(op) ((op)->ob_type == &PyTransform_Type)
57
60
63
64#else
66static void **PyTransform_API;
67
72#define PyTransform_GetNative \
73 (*(PyTransform_GetNative_RETURN (*)PyTransform_GetNative_PROTO) PyTransform_API[PyTransform_GetNative_NUM])
74
80#define PyTransform_New \
81 (*(PyTransform_New_RETURN (*)PyTransform_New_PROTO) PyTransform_API[PyTransform_New_NUM])
82
86#define PyTransform_Check(op) \
87 (Py_TYPE(op) == &PyTransform_Type)
88
89#define PyTransform_Type (*(PyTypeObject*)PyTransform_API[PyTransform_Type_NUM])
90
94#define import_pytransform() \
95 PyTransform_API = (void **)PyCapsule_Import(PyTransform_CAPSULE_NAME, 1);
96
97#endif
98
99
100
101#endif /* PYTRANSFORM_H */
#define PyTransform_New_PROTO
Argument prototype for New.
Definition pytransform.h:45
#define PyTransform_GetNative_RETURN
Return type for GetNative.
Definition pytransform.h:40
#define PyTransform_New_RETURN
Return type for New.
Definition pytransform.h:44
#define PyTransform_GetNative_PROTO
Argument prototype for GetNative.
Definition pytransform.h:41
#define PyTransform_GetNative
Returns a pointer to the internal polar scan, remember to release the reference when done with the ob...
Definition pytransform.h:72
#define PyTransform_New
Creates a new polar scan instance.
Definition pytransform.h:80
The transformator.
Definition pytransform.h:32
PyObject_HEAD Transform_t * transform
the c-api transformator
Definition pytransform.h:34
Represents one transformator.
Definition transform.c:41
Defines the functions available when transforming between different types of products.