RAVE
rave_utilities.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------------------------------------------------------------------------*/
26#ifndef RAVE_UTILITIES_H
27#define RAVE_UTILITIES_H
28#include "rave_attribute.h"
29#include "raveobject_list.h"
31
32#ifdef _MSC_VER
33#ifndef strncasecmp
34#define strcasecmp(x, y) _stricmp(x,y)
35#endif
36#endif
37
45int RaveUtilities_addLongAttributeToList(RaveObjectList_t* l, const char* name, long value);
46
54int RaveUtilities_addDoubleAttributeToList(RaveObjectList_t* l, const char* name, double value);
55
63int RaveUtilities_addStringAttributeToList(RaveObjectList_t* l, const char* name, const char* value);
64
73int RaveUtilities_replaceLongAttributeInList(RaveObjectList_t* l, const char* name, long value);
74
83int RaveUtilities_replaceDoubleAttributeInList(RaveObjectList_t* l, const char* name, double value);
84
93int RaveUtilities_replaceStringAttributeInList(RaveObjectList_t* l, const char* name, const char* value);
94
101
110
118
125char* RaveUtilities_trimText(const char* str, int len);
126
134RaveList_t* RaveUtilities_getTrimmedTokens(const char* str, int c);
135
142
148
154
161char* RaveUtilities_handleSourceVersion(const char* source, RaveIO_ODIM_Version version);
162
172int RaveUtilities_isSourceValid(const char* source, RaveIO_ODIM_Version version);
173
174#endif /* RAVE_UTILITIES_H */
Used for keeping track on attributes.
RaveIO_ODIM_Version
The /Conventions version in a ODIM HDF5 file.
Definition rave_types.h:43
char * RaveUtilities_trimText(const char *str, int len)
Trims the text from all leading and trailing whitespaces.
Definition rave_utilities.c:204
int RaveUtilities_addDoubleAttributeToList(RaveObjectList_t *l, const char *name, double value)
Adds a double attribute to an object list.
Definition rave_utilities.c:48
void RaveUtilities_removeAttributeFromList(RaveObjectList_t *l, const char *name)
Removes the rave attribute with specified name from the list.
Definition rave_utilities.c:161
int RaveUtilities_getRaveAttributeDoubleFromHash(RaveObjectHashTable_t *h, const char *name, double *v)
Gets the double value from a rave attribute that resides in a hash table.
Definition rave_utilities.c:181
int RaveUtilities_addStringAttributeToList(RaveObjectList_t *l, const char *name, const char *value)
Adds a string attribute to an object list.
Definition rave_utilities.c:63
int RaveUtilities_isLegacyProjEnabled(void)
Returns if legacy PROJ (PROJ.4 and PROJ 5) is enabled or not.
Definition rave_utilities.c:320
int RaveUtilities_isCFConventionSupported(void)
Returns if CF convention IO support is activated or not.
Definition rave_utilities.c:311
int RaveUtilities_isXmlSupported(void)
Returns if xml support is activated or not since expat support is optional and ought to be tested.
Definition rave_utilities.c:302
int RaveUtilities_replaceStringAttributeInList(RaveObjectList_t *l, const char *name, const char *value)
Replaces the content of a attribute in the object list.
Definition rave_utilities.c:133
int RaveUtilities_addLongAttributeToList(RaveObjectList_t *l, const char *name, long value)
Adds a long attribute to an object list.
Definition rave_utilities.c:33
char * RaveUtilities_handleSourceVersion(const char *source, RaveIO_ODIM_Version version)
Handles the source value according to version.
Definition rave_utilities.c:329
int RaveUtilities_replaceDoubleAttributeInList(RaveObjectList_t *l, const char *name, double value)
Replaces the content of a attribute in the object list.
Definition rave_utilities.c:106
int RaveUtilities_isSourceValid(const char *source, RaveIO_ODIM_Version version)
Verifies if the source is valid according to ODIM version rules.
Definition rave_utilities.c:372
RaveList_t * RaveUtilities_getTrimmedTokens(const char *str, int c)
Returns a list of tokens delimited by 'c'.
Definition rave_utilities.c:241
int RaveUtilities_iswhitespace(char c)
Returns if the character is a whitespace character or not, i.e.
Definition rave_utilities.c:198
int RaveUtilities_replaceLongAttributeInList(RaveObjectList_t *l, const char *name, long value)
Replaces the content of a attribute in the object list.
Definition rave_utilities.c:78
Implementation of a rave object hashtable that maps between strings and rave core objects.
Implementation of a rave object list that ensures that the objects contained within the list are rele...
Represents a list.
Definition rave_list.c:36
Represents a hash table.
Definition raveobject_hashtable.c:45
Represents a list.
Definition raveobject_list.c:35