RAVE
pycompositegenerator.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 PYCOMPOSITEGENERATOR_H
26#define PYCOMPOSITEGENERATOR_H
27#include "compositegenerator.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
36
37#define PyCompositeGenerator_Type_NUM 0
38
39#define PyCompositeGenerator_GetNative_NUM 1
40#define PyCompositeGenerator_GetNative_RETURN CompositeGenerator_t*
41#define PyCompositeGenerator_GetNative_PROTO (PyCompositeGenerator*)
42
43#define PyCompositeGenerator_New_NUM 2
44#define PyCompositeGenerator_New_RETURN PyCompositeGenerator*
45#define PyCompositeGenerator_New_PROTO (CompositeGenerator_t*)
46
47#define PyCompositeGenerator_API_pointers 3
48
49#define PyCompositeGenerator_CAPSULE_NAME "_compositegenerator._C_API"
50
51
52#ifdef PYCOMPOSITEGENERATOR_MODULE
54extern PyTypeObject PyCompositeGenerator_Type;
55
57#define PyCompositeGenerator_Check(op) ((op)->ob_type == &PyCompositeGenerator_Type)
58
61
64
65#else
67static void **PyCompositeGenerator_API;
68
73#define PyCompositeGenerator_GetNative \
74 (*(PyCompositeGenerator_GetNative_RETURN (*)PyCompositeGenerator_GetNative_PROTO) PyCompositeGenerator_API[PyCompositeGenerator_GetNative_NUM])
75
83#define PyCompositeGenerator_New \
84 (*(PyCompositeGenerator_New_RETURN (*)PyCompositeGenerator_New_PROTO) PyCompositeGenerator_API[PyCompositeGenerator_New_NUM])
85
89#define PyCompositeGenerator_Check(op) \
90 (Py_TYPE(op) == &PyCompositeGenerator_Type)
91
92#define PyCompositeGenerator_Type (*(PyTypeObject*)PyCompositeGenerator_API[PyCompositeGenerator_Type_NUM])
93
97#define import_compositegenerator() \
98 PyCompositeGenerator_API = (void **)PyCapsule_Import(PyCompositeGenerator_CAPSULE_NAME, 0);
99
100#endif
101
102
103
104#endif /* PYCOMPOSITEGENERATOR_H */
Generator for generating composites using various approaches.
struct _CompositeGenerator_t CompositeGenerator_t
Defines a Composite generator.
Definition compositegenerator.h:43
#define PyCompositeGenerator_New_RETURN
return type for New
Definition pycompositegenerator.h:44
#define PyCompositeGenerator_New
Creates a new composite generator instance.
Definition pycompositegenerator.h:83
#define PyCompositeGenerator_GetNative
Returns a pointer to the internal composite, remember to release the reference when done with the obj...
Definition pycompositegenerator.h:73
#define PyCompositeGenerator_GetNative_RETURN
return type for GetNative
Definition pycompositegenerator.h:40
#define PyCompositeGenerator_New_PROTO
arguments for New
Definition pycompositegenerator.h:45
#define PyCompositeGenerator_GetNative_PROTO
arguments for GetNative
Definition pycompositegenerator.h:41
A composite generator.
Definition pycompositegenerator.h:32
PyObject_HEAD CompositeGenerator_t * generator
the composite generator
Definition pycompositegenerator.h:34