RAVE
pycomposite.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 PYCOMPOSITE_H
26#define PYCOMPOSITE_H
27#include "composite.h"
28
32typedef struct {
33 PyObject_HEAD /*Always has to be on top*/
36
37#define PyComposite_Type_NUM 0
39#define PyComposite_GetNative_NUM 1
40#define PyComposite_GetNative_RETURN Composite_t*
41#define PyComposite_GetNative_PROTO (PyComposite*)
43#define PyComposite_New_NUM 2
44#define PyComposite_New_RETURN PyComposite*
45#define PyComposite_New_PROTO (Composite_t*)
47#define PyComposite_API_pointers 3
49#define PyComposite_CAPSULE_NAME "_pycomposite._C_API"
50
51
52#ifdef PYCOMPOSITE_MODULE
54extern PyTypeObject PyComposite_Type;
55
57#define PyComposite_Check(op) ((op)->ob_type == &PyComposite_Type)
58
61
64
65#else
67static void **PyComposite_API;
68
73#define PyComposite_GetNative \
74 (*(PyComposite_GetNative_RETURN (*)PyComposite_GetNative_PROTO) PyComposite_API[PyComposite_GetNative_NUM])
75
83#define PyComposite_New \
84 (*(PyComposite_New_RETURN (*)PyComposite_New_PROTO) PyComposite_API[PyComposite_New_NUM])
85
89#define PyComposite_Check(op) \
90 (Py_TYPE(op) == &PyComposite_Type)
91
92#define PyComposite_Type (*(PyTypeObject*)PyComposite_API[PyComposite_Type_NUM])
93
97#define import_pycomposite() \
98 PyComposite_API = (void **)PyCapsule_Import(PyComposite_CAPSULE_NAME, 1);
99
100#endif
101
102
103
104#endif /* PYCOMPOSITE_H */
Provides functionality for creating composites.
#define PyComposite_GetNative
Returns a pointer to the internal composite, remember to release the reference when done with the obj...
Definition pycomposite.h:73
#define PyComposite_New_RETURN
return type for New
Definition pycomposite.h:44
#define PyComposite_GetNative_PROTO
arguments for GetNative
Definition pycomposite.h:41
#define PyComposite_GetNative_RETURN
return type for GetNative
Definition pycomposite.h:40
#define PyComposite_New
Creates a new composite instance.
Definition pycomposite.h:83
#define PyComposite_New_PROTO
arguments for New
Definition pycomposite.h:45
A composite generator.
Definition pycomposite.h:32
PyObject_HEAD Composite_t * composite
the composite generator
Definition pycomposite.h:34
Represents the cartesian product.
Definition composite.c:45