HL-HDF
pyhlhdf_common.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2009 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of HLHDF.
5
6HLHDF 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
11HLHDF 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 HLHDF. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
19
27#ifndef PYHLHDF_COMMON_H
28#define PYHLHDF_COMMON_H
29
30#include "pyhlcompat.h"
31#include <hlhdf.h>
33
41int getFloatFromDictionary(char* name, float* val, PyObject* dict);
42
50int getDoubleFromDictionary(char* name, double* val, PyObject* dict);
51
59int getIntegerFromDictionary(char* name, int* val, PyObject* dict);
60
68int getUnsignedLongFromDictionary(char* name, unsigned long* val, PyObject* dict);
69
77int getLongFromDictionary(char* name, long* val, PyObject* dict);
78
86int getFloatFromObject(char* name, float* val, PyObject* dict);
87
95int getDoubleFromObject(char* name, double* val, PyObject* dict);
96
104int getIntegerFromObject(char* name, int* val, PyObject* dict);
105
113int getLongFromObject(char* name, long* val, PyObject* dict);
114
122int getUnsignedLongFromObject(char* name, unsigned long* val, PyObject* dict);
123
131int getShortFromObject(char* name, short* val, PyObject* dict);
132
140int getByteFromObject(char* name, unsigned char* val, PyObject* dict);
141
148char* getStringFromObject(char* name, PyObject* dict);
149
157int getIdxIntegerFromTuple(int idx, int* val, PyObject* tuple);
158
166int getIdxDoubleFromTuple(int idx, double* val, PyObject* tuple);
167
174char* getStringFromDictionary(char* name, PyObject* dict);
175
183int setMappingInteger(PyObject* info, char* keyname, int in_value);
184
192int setMappingDouble(PyObject* info, char* keyname, double in_value);
193
201int setMappingFloat(PyObject* info, char* keyname, float in_value);
202
210int setMappingString(PyObject* info,char* keyname,char* in_string);
211
220int setMappingString_Length(PyObject* info,char* keyname,char* in_string,int len);
221
229int setObjectInteger(PyObject* info, char* keyname, int in_value);
230
238int setObjectLong(PyObject* info, char* keyname, long in_value);
239
247int setObjectUnsignedLong(PyObject* info, char* keyname, unsigned long in_value);
248
256int setObjectDouble(PyObject* info, char* keyname, double in_value);
257
265int setObjectFloat(PyObject* info, char* keyname, float in_value);
266
274int setObjectString(PyObject* info,char* keyname,char* in_string);
275
284int setObjectString_Length(PyObject* info,char* keyname,char* in_string,int len);
285
291char* translatePyFormatToHlHdf(char type);
292
298int pyarraytypeFromHdfType(const char* format);
299
306PyArrayObject* new1d_ArrayObject(int nl, const char* format);
307
315PyArrayObject* new2d_ArrayObject(int xsize,int ysize, const char* format);
316
317#endif
Common functions for working with an HDF5 file through the HL-HDF API.
Ensures that the python arrayobject.h file is imported correctly.
Python compability file for making it possible to compile rave for both python >2....
int getFloatFromDictionary(char *name, float *val, PyObject *dict)
Retrives a float from a dictionary, python equivalent would be val = dict[name].
Definition pyhlhdf_common.c:35
int getShortFromObject(char *name, short *val, PyObject *dict)
Retrives a short from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:197
int getUnsignedLongFromDictionary(char *name, unsigned long *val, PyObject *dict)
Retrives a unsigned long from a dictionary, python equivalent would be val = dict[name].
Definition pyhlhdf_common.c:99
char * translatePyFormatToHlHdf(char type)
Translates a PyArray type to a hlhdf known format.
Definition pyhlhdf_common.c:521
int getDoubleFromObject(char *name, double *val, PyObject *dict)
Retrives a double from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:132
int setObjectString_Length(PyObject *info, char *keyname, char *in_string, int len)
Sets a string in an object, the python equivalent would be: info.keyname=in_string[0:len].
Definition pyhlhdf_common.c:498
int setObjectLong(PyObject *info, char *keyname, long in_value)
Sets an long in a object, the python equivalent would be: info.keyname=in_value.
Definition pyhlhdf_common.c:405
int getDoubleFromDictionary(char *name, double *val, PyObject *dict)
Retrives a double from a dictionary, python equivalent would be val = dict[name].
Definition pyhlhdf_common.c:51
int getLongFromObject(char *name, long *val, PyObject *dict)
Retrives a long from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:164
int getIdxDoubleFromTuple(int idx, double *val, PyObject *tuple)
Retrives a double from a index in a tuple, python equivalent would be val = tuple[idx].
Definition pyhlhdf_common.c:261
int setObjectDouble(PyObject *info, char *keyname, double in_value)
Sets an double in a object, the python equivalent would be: info.keyname=in_value.
Definition pyhlhdf_common.c:442
int getIntegerFromObject(char *name, int *val, PyObject *dict)
Retrives a integer from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:148
int setObjectUnsignedLong(PyObject *info, char *keyname, unsigned long in_value)
Sets an unsigned long in a object, the python equivalent would be: info.keyname=in_value.
Definition pyhlhdf_common.c:423
int getFloatFromObject(char *name, float *val, PyObject *dict)
Retrives a float from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:116
PyArrayObject * new2d_ArrayObject(int xsize, int ysize, const char *format)
Creates a new 2-dimensional PyArrayObject.
Definition pyhlhdf_common.c:626
int getIntegerFromDictionary(char *name, int *val, PyObject *dict)
Retrives a integer from a dictionary, python equivalent would be val = dict[name].
Definition pyhlhdf_common.c:67
int setMappingInteger(PyObject *info, char *keyname, int in_value)
Sets an integer in a dictionary, the python equivalent would be: info[keyname]=in_value.
Definition pyhlhdf_common.c:293
int pyarraytypeFromHdfType(const char *format)
Translates an hlhdf represented type into a PyArray known format.
Definition pyhlhdf_common.c:569
int setMappingFloat(PyObject *info, char *keyname, float in_value)
Sets an float in a dictionary, the python equivalent would be: info[keyname]=in_value.
Definition pyhlhdf_common.c:331
int getByteFromObject(char *name, unsigned char *val, PyObject *dict)
Retrives a unsigned char from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:213
int setMappingString(PyObject *info, char *keyname, char *in_string)
Sets an string in a dictionary, the python equivalent would be: info[keyname]=in_value.
Definition pyhlhdf_common.c:350
int getLongFromDictionary(char *name, long *val, PyObject *dict)
Retrives a long from a dictionary, python equivalent would be val = dict[name].
Definition pyhlhdf_common.c:83
int setMappingDouble(PyObject *info, char *keyname, double in_value)
Sets an double in a dictionary, the python equivalent would be: info[keyname]=in_value.
Definition pyhlhdf_common.c:312
int setMappingString_Length(PyObject *info, char *keyname, char *in_string, int len)
Sets a string in a dictionary, the python equivalent would be: info[keyname]=in_string[0:len].
Definition pyhlhdf_common.c:368
char * getStringFromObject(char *name, PyObject *dict)
Retrives a string from a name in an object, python equivalent would be val = dict....
Definition pyhlhdf_common.c:229
int getIdxIntegerFromTuple(int idx, int *val, PyObject *tuple)
Retrives a integer from a index in a tuple, python equivalent would be val = tuple[idx].
Definition pyhlhdf_common.c:245
char * getStringFromDictionary(char *name, PyObject *dict)
Retrives a string from a dictionary, python equivalent would be val = dict[name].
Definition pyhlhdf_common.c:277
int setObjectString(PyObject *info, char *keyname, char *in_string)
Sets an string in a object, the python equivalent would be: info.keyname=in_value.
Definition pyhlhdf_common.c:480
PyArrayObject * new1d_ArrayObject(int nl, const char *format)
Creates a new 1-dimensional PyArrayObject.
Definition pyhlhdf_common.c:606
int getUnsignedLongFromObject(char *name, unsigned long *val, PyObject *dict)
Retrives a unsigned long from an object, python equivalent would be val = dict.name.
Definition pyhlhdf_common.c:180
int setObjectInteger(PyObject *info, char *keyname, int in_value)
Sets an integer in a object, the python equivalent would be: info.keyname=in_value.
Definition pyhlhdf_common.c:386
int setObjectFloat(PyObject *info, char *keyname, float in_value)
Sets an float in a object, the python equivalent would be: info.keyname=in_value.
Definition pyhlhdf_common.c:461