RAVE
rave_attribute.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_ATTRIBUTE_H
27#define RAVE_ATTRIBUTE_H
28#include "rave_object.h"
29#include "rave_types.h"
30#include <stdarg.h>
31
40
45
50
57int RaveAttribute_setName(RaveAttribute_t* attr, const char* name);
58
64const char* RaveAttribute_getName(RaveAttribute_t* attr);
65
72
78void RaveAttribute_setLong(RaveAttribute_t* attr, long value);
79
85void RaveAttribute_setDouble(RaveAttribute_t* attr, double value);
86
93int RaveAttribute_setString(RaveAttribute_t* attr, const char* value);
94
102int RaveAttribute_setLongArray(RaveAttribute_t* attr, long* value, int len);
103
111int RaveAttribute_setDoubleArray(RaveAttribute_t* attr, double* value, int len);
112
123int RaveAttribute_setArrayFromData(RaveAttribute_t* attr, void* value, int len, RaveDataType type);
124
131int RaveAttribute_getLong(RaveAttribute_t* attr, long* value);
132
139int RaveAttribute_getDouble(RaveAttribute_t* attr, double* value);
140
147int RaveAttribute_getString(RaveAttribute_t* attr, char** value);
148
156int RaveAttribute_getLongArray(RaveAttribute_t* attr, long** value, int* len);
157
165int RaveAttribute_getDoubleArray(RaveAttribute_t* attr, double** value, int* len);
166
174
184 const char* attrname, char** group, char** name);
185
197int RaveAttributeHelp_validateHowGroupAttributeName(const char* gname, const char* aname);
198
205
212RaveAttribute_t* RaveAttributeHelp_createLong(const char* name, long value);
213
220RaveAttribute_t* RaveAttributeHelp_createDouble(const char* name, double value);
221
228RaveAttribute_t* RaveAttributeHelp_createDoubleFromString(const char* name, const char* value);
229
236RaveAttribute_t* RaveAttributeHelp_createString(const char* name, const char* value);
237
245RaveAttribute_t* RaveAttributeHelp_createLongArray(const char* name, long* value, int len);
246
254RaveAttribute_t* RaveAttributeHelp_createDoubleArray(const char* name, double* value, int len);
255
265RaveAttribute_t* RaveAttributeHelp_createArrayFromData(const char* name, void* value, int len, RaveDataType type);
266
275RaveAttribute_t* RaveAttributeHelp_createStringFmt(const char* name, const char* fmt, ...);
276
277#endif /* RAVE_ATTRIBUTE_H */
278
int RaveAttribute_getString(RaveAttribute_t *attr, char **value)
Returns the value as a string.
Definition rave_attribute.c:367
int RaveAttribute_setDoubleArray(RaveAttribute_t *attr, double *value, int len)
Sets the value as a simple 1-dimensional double array.
Definition rave_attribute.c:260
RaveAttribute_t * RaveAttributeHelp_createNamedAttribute(const char *name)
Creates a named rave attribute.
Definition rave_attribute.c:522
RaveAttribute_Format
Definition rave_attribute.h:32
@ RaveAttribute_Format_Undefined
Undefined.
Definition rave_attribute.h:33
@ RaveAttribute_Format_LongArray
Simple 1-dimensional array of longs.
Definition rave_attribute.h:37
@ RaveAttribute_Format_String
String.
Definition rave_attribute.h:34
@ RaveAttribute_Format_DoubleArray
Simple 1-dimensional array of doubles.
Definition rave_attribute.h:38
@ RaveAttribute_Format_Double
Double.
Definition rave_attribute.h:36
@ RaveAttribute_Format_Long
Long.
Definition rave_attribute.h:35
RaveAttribute_t * RaveAttributeHelp_createDoubleFromString(const char *name, const char *value)
Creates a double rave attribute from a string representation of the double value.
Definition rave_attribute.c:554
void RaveAttribute_setLong(RaveAttribute_t *attr, long value)
Sets the value as a long.
Definition rave_attribute.c:187
int RaveAttribute_setString(RaveAttribute_t *attr, const char *value)
Sets the value as a string.
Definition rave_attribute.c:208
RaveAttribute_t * RaveAttributeHelp_createStringFmt(const char *name, const char *fmt,...)
Creates a string from the provided varargs expression.
Definition rave_attribute.c:614
RaveCoreObjectType RaveAttribute_TYPE
Type definition to use when creating a rave object.
Definition rave_attribute.c:646
int RaveAttributeHelp_validateHowGroupAttributeName(const char *gname, const char *aname)
Validates an attribute name that resides in a how-main group.
Definition rave_attribute.c:498
void RaveAttribute_setDouble(RaveAttribute_t *attr, double value)
Sets the value as a double.
Definition rave_attribute.c:197
int RaveAttributeHelp_extractGroupAndName(const char *attrname, char **group, char **name)
Helper function for extracting the group and name part from a string with the format <group>/<name>.
Definition rave_attribute.c:455
int RaveAttribute_getLong(RaveAttribute_t *attr, long *value)
Returns the value as a long.
Definition rave_attribute.c:337
RaveAttribute_t * RaveAttributeHelp_createString(const char *name, const char *value)
Creates a string rave attribute.
Definition rave_attribute.c:570
int RaveAttribute_setName(RaveAttribute_t *attr, const char *name)
Sets the name of this attribute.
Definition rave_attribute.c:161
RaveAttribute_t * RaveAttributeHelp_createArrayFromData(const char *name, void *value, int len, RaveDataType type)
Creates an array from the provided data with the specified type and converts it into an appropriate a...
Definition rave_attribute.c:603
int RaveAttribute_setArrayFromData(RaveAttribute_t *attr, void *value, int len, RaveDataType type)
Sets the attribute with the array from the provided data with the specified type and converts it into...
Definition rave_attribute.c:288
RaveAttribute_t * RaveAttributeHelp_createLong(const char *name, long value)
Creates a long rave attribute.
Definition rave_attribute.c:536
int RaveAttribute_getDoubleArray(RaveAttribute_t *attr, double **value, int *len)
Returns the value as a double array.
Definition rave_attribute.c:394
int RaveAttribute_setLongArray(RaveAttribute_t *attr, long *value, int len)
Sets the value as a simple 1-dimensional long array.
Definition rave_attribute.c:232
const char * RaveAttribute_getName(RaveAttribute_t *attr)
Returns the name of this attribute.
Definition rave_attribute.c:175
RaveAttribute_t * RaveAttributeHelp_createLongArray(const char *name, long *value, int len)
Creates a long array rave attribute.
Definition rave_attribute.c:581
RaveAttribute_t * RaveAttributeHelp_createDoubleArray(const char *name, double *value, int len)
Creates a double array rave attribute.
Definition rave_attribute.c:592
int RaveAttribute_shiftArray(RaveAttribute_t *attr, int nx)
Performs a circular shift of the array.
Definition rave_attribute.c:409
int RaveAttribute_getDouble(RaveAttribute_t *attr, double *value)
Returns the value as a double.
Definition rave_attribute.c:352
RaveAttribute_Format RaveAttribute_getFormat(RaveAttribute_t *attr)
Returns the format for this attribute.
Definition rave_attribute.c:181
RaveAttribute_t * RaveAttributeHelp_createDouble(const char *name, double value)
Creates a double rave attribute.
Definition rave_attribute.c:545
int RaveAttribute_getLongArray(RaveAttribute_t *attr, long **value, int *len)
Returns the value as a long array.
Definition rave_attribute.c:379
Generic implementation of an object that is used within rave.
Type definitions for RAVE.
RaveDataType
Different data types that are supported during transformation.
Definition rave_types.h:130
Represents one scan in a volume.
Definition rave_attribute.c:46
RAVE_OBJECT_HEAD char * name
Always on top.
Definition rave_attribute.c:48
The rave object type definition.
Definition rave_object.h:52