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
39
44
49
56int RaveAttribute_setName(RaveAttribute_t* attr, const char* name);
57
63const char* RaveAttribute_getName(RaveAttribute_t* attr);
64
71
77void RaveAttribute_setLong(RaveAttribute_t* attr, long value);
78
84void RaveAttribute_setDouble(RaveAttribute_t* attr, double value);
85
92int RaveAttribute_setString(RaveAttribute_t* attr, const char* value);
93
101int RaveAttribute_setLongArray(RaveAttribute_t* attr, long* value, int len);
102
110int RaveAttribute_setDoubleArray(RaveAttribute_t* attr, double* value, int len);
111
122int RaveAttribute_setArrayFromData(RaveAttribute_t* attr, void* value, int len, RaveDataType type);
123
130int RaveAttribute_getLong(RaveAttribute_t* attr, long* value);
131
138int RaveAttribute_getDouble(RaveAttribute_t* attr, double* value);
139
146int RaveAttribute_getString(RaveAttribute_t* attr, char** value);
147
155int RaveAttribute_getLongArray(RaveAttribute_t* attr, long** value, int* len);
156
164int RaveAttribute_getDoubleArray(RaveAttribute_t* attr, double** value, int* len);
165
173
183 const char* attrname, char** group, char** name);
184
196int RaveAttributeHelp_validateHowGroupAttributeName(const char* gname, const char* aname);
197
204
211RaveAttribute_t* RaveAttributeHelp_createLong(const char* name, long value);
212
219RaveAttribute_t* RaveAttributeHelp_createDouble(const char* name, double value);
220
227RaveAttribute_t* RaveAttributeHelp_createDoubleFromString(const char* name, const char* value);
228
235RaveAttribute_t* RaveAttributeHelp_createString(const char* name, const char* value);
236
244RaveAttribute_t* RaveAttributeHelp_createLongArray(const char* name, long* value, int len);
245
253RaveAttribute_t* RaveAttributeHelp_createDoubleArray(const char* name, double* value, int len);
254
264RaveAttribute_t* RaveAttributeHelp_createArrayFromData(const char* name, void* value, int len, RaveDataType type);
265
266
267#endif /* RAVE_ATTRIBUTE_H */
268
int RaveAttribute_getString(RaveAttribute_t *attr, char **value)
Returns the value as a string.
Definition rave_attribute.c:366
int RaveAttribute_setDoubleArray(RaveAttribute_t *attr, double *value, int len)
Sets the value as a simple 1-dimensional double array.
Definition rave_attribute.c:259
RaveAttribute_t * RaveAttributeHelp_createNamedAttribute(const char *name)
Creates a named rave attribute.
Definition rave_attribute.c:521
RaveAttribute_Format
Definition rave_attribute.h:31
@ RaveAttribute_Format_Undefined
Undefined.
Definition rave_attribute.h:32
@ RaveAttribute_Format_LongArray
Simple 1-dimensional array of longs.
Definition rave_attribute.h:36
@ RaveAttribute_Format_String
String.
Definition rave_attribute.h:33
@ RaveAttribute_Format_DoubleArray
Simple 1-dimensional array of doubles.
Definition rave_attribute.h:37
@ RaveAttribute_Format_Double
Double.
Definition rave_attribute.h:35
@ RaveAttribute_Format_Long
Long.
Definition rave_attribute.h:34
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:553
void RaveAttribute_setLong(RaveAttribute_t *attr, long value)
Sets the value as a long.
Definition rave_attribute.c:186
int RaveAttribute_setString(RaveAttribute_t *attr, const char *value)
Sets the value as a string.
Definition rave_attribute.c:207
RaveCoreObjectType RaveAttribute_TYPE
Type definition to use when creating a rave object.
Definition rave_attribute.c:615
int RaveAttributeHelp_validateHowGroupAttributeName(const char *gname, const char *aname)
Validates an attribute name that resides in a how-main group.
Definition rave_attribute.c:497
void RaveAttribute_setDouble(RaveAttribute_t *attr, double value)
Sets the value as a double.
Definition rave_attribute.c:196
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:454
int RaveAttribute_getLong(RaveAttribute_t *attr, long *value)
Returns the value as a long.
Definition rave_attribute.c:336
RaveAttribute_t * RaveAttributeHelp_createString(const char *name, const char *value)
Creates a string rave attribute.
Definition rave_attribute.c:569
int RaveAttribute_setName(RaveAttribute_t *attr, const char *name)
Sets the name of this attribute.
Definition rave_attribute.c:160
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:602
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:287
RaveAttribute_t * RaveAttributeHelp_createLong(const char *name, long value)
Creates a long rave attribute.
Definition rave_attribute.c:535
int RaveAttribute_getDoubleArray(RaveAttribute_t *attr, double **value, int *len)
Returns the value as a double array.
Definition rave_attribute.c:393
int RaveAttribute_setLongArray(RaveAttribute_t *attr, long *value, int len)
Sets the value as a simple 1-dimensional long array.
Definition rave_attribute.c:231
const char * RaveAttribute_getName(RaveAttribute_t *attr)
Returns the name of this attribute.
Definition rave_attribute.c:174
RaveAttribute_t * RaveAttributeHelp_createLongArray(const char *name, long *value, int len)
Creates a long array rave attribute.
Definition rave_attribute.c:580
RaveAttribute_t * RaveAttributeHelp_createDoubleArray(const char *name, double *value, int len)
Creates a double array rave attribute.
Definition rave_attribute.c:591
int RaveAttribute_shiftArray(RaveAttribute_t *attr, int nx)
Performs a circular shift of the array.
Definition rave_attribute.c:408
int RaveAttribute_getDouble(RaveAttribute_t *attr, double *value)
Returns the value as a double.
Definition rave_attribute.c:351
RaveAttribute_Format RaveAttribute_getFormat(RaveAttribute_t *attr)
Returns the format for this attribute.
Definition rave_attribute.c:180
RaveAttribute_t * RaveAttributeHelp_createDouble(const char *name, double value)
Creates a double rave attribute.
Definition rave_attribute.c:544
int RaveAttribute_getLongArray(RaveAttribute_t *attr, long **value, int *len)
Returns the value as a long array.
Definition rave_attribute.c:378
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:45
RAVE_OBJECT_HEAD char * name
Always on top.
Definition rave_attribute.c:47
The rave object type definition.
Definition rave_object.h:52