RAVE
pyprojection.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 PYPROJECTION_H
26#define PYPROJECTION_H
27#include "projection.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
36
37#define PyProjection_Type_NUM 0
39#define PyProjection_GetNative_NUM 1
40#define PyProjection_GetNative_RETURN Projection_t*
41#define PyProjection_GetNative_PROTO (PyProjection*)
43#define PyProjection_New_NUM 2
44#define PyProjection_New_RETURN PyProjection*
45#define PyProjection_New_PROTO (Projection_t*)
47#define PyProjection_NewFromDef_NUM 3
48#define PyProjection_NewFromDef_RETURN PyProjection*
49#define PyProjection_NewFromDef_PROTO (const char* id, const char* definition, const char* description)
51#define PyProjection_API_pointers 4
53#define PyProjection_CAPSULE_NAME "_projection._C_API"
54
55#ifdef PYPROJECTION_MODULE
57extern PyTypeObject PyProjection_Type;
58
60#define PyProjection_Check(op) ((op)->ob_type == &PyProjection_Type)
61
66
71
76
77#else
79static void **PyProjection_API;
80
85#define PyProjection_GetNative \
86 (*(PyProjection_GetNative_RETURN (*)PyProjection_GetNative_PROTO) PyProjection_API[PyProjection_GetNative_NUM])
87
94#define PyProjection_New \
95 (*(PyProjection_New_RETURN (*)PyProjection_New_PROTO) PyProjection_API[PyProjection_New_NUM])
96
104#define PyProjection_NewFromDef \
105 (*(PyProjection_NewFromDef_RETURN (*)PyProjection_NewFromDef_PROTO) PyProjection_API[PyProjection_NewFromDef_NUM])
106
110#define PyProjection_Check(op) \
111 (Py_TYPE(op) == &PyProjection_Type)
112
113#define PyProjection_Type (*(PyTypeObject *)PyProjection_API[PyProjection_Type_NUM])
114
118#define import_pyprojection() \
119 PyProjection_API = (void **)PyCapsule_Import(PyProjection_CAPSULE_NAME, 1);
120
121#endif
122
123#endif /* PYPROJECTION_H */
Wrapper around PROJ.4.
#define PyProjection_NewFromDef
Creates a new projection instance from a definition.
Definition pyprojection.h:104
#define PyProjection_NewFromDef_RETURN
return type for NewFromDef
Definition pyprojection.h:48
#define PyProjection_GetNative
Returns a pointer to the internal projection, remember to release the reference when done with the ob...
Definition pyprojection.h:85
#define PyProjection_New_PROTO
argument prototype for New
Definition pyprojection.h:45
#define PyProjection_GetNative_RETURN
return type for GetNative
Definition pyprojection.h:40
#define PyProjection_New_RETURN
return type for New
Definition pyprojection.h:44
#define PyProjection_New
Creates a new projection instance.
Definition pyprojection.h:94
#define PyProjection_GetNative_PROTO
argument prototype for GetNative
Definition pyprojection.h:41
#define PyProjection_NewFromDef_PROTO
argument prototype for NewFromDef
Definition pyprojection.h:49
A projection.
Definition pyprojection.h:32
PyObject_HEAD Projection_t * projection
The projection definition.
Definition pyprojection.h:34
Represents one projection.
Definition projection.c:55