RAVE
rave_value.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2025 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_VALUE_H
27#define RAVE_VALUE_H
28#include "rave_object.h"
30#include <stdarg.h>
31
43
48
53
60
66
72RaveValue_t* RaveValue_createString(const char* value);
73
80int RaveValue_setString(RaveValue_t* self, const char* value);
81
88int RaveValue_getString(RaveValue_t* self, char** value);
89
95const char* RaveValue_toString(RaveValue_t* self);
96
103
109void RaveValue_setLong(RaveValue_t* self, long value);
110
117int RaveValue_getLong(RaveValue_t* self, long* value);
118
124long RaveValue_toLong(RaveValue_t* self);
125
126
133
139void RaveValue_setDouble(RaveValue_t* self, double value);
140
147int RaveValue_getDouble(RaveValue_t* self, double* value);
148
154double RaveValue_toDouble(RaveValue_t* self);
155
162RaveValue_t* RaveValue_createStringArray(const char** value, int len);
163
171int RaveValue_setStringArray(RaveValue_t* self, const char** value, int len);
172
180int RaveValue_getStringArray(RaveValue_t* self, char*** value, int* len);
181
188RaveValue_t* RaveValue_createLongArray(long* value, int len);
189
197int RaveValue_setLongArray(RaveValue_t* self, long* value, int len);
198
206int RaveValue_getLongArray(RaveValue_t* self, long** value, int* len);
207
214RaveValue_t* RaveValue_createDoubleArray(double* value, int len);
215
223int RaveValue_setDoubleArray(RaveValue_t* self, double* value, int len);
224
232int RaveValue_getDoubleArray(RaveValue_t* self, double** value, int* len);
233
241
249
256
257#endif /* RAVE_VALUE_H */
258
Generic implementation of an object that is used within rave.
struct _raveobjecttype RaveCoreObjectType
The rave object type definition.
RaveCoreObjectType RaveValue_TYPE
Type definition to use when creating a rave object.
Definition rave_value.c:483
int RaveValue_setString(RaveValue_t *self, const char *value)
Sets a string value in self.
Definition rave_value.c:184
int RaveValue_getString(RaveValue_t *self, char **value)
Returns the value as a string.
Definition rave_value.c:207
int RaveValue_getLongArray(RaveValue_t *self, long **value, int *len)
Returns the value as a long array.
Definition rave_value.c:392
RaveValue_t * RaveValue_createString(const char *value)
Creates a string rave value.
Definition rave_value.c:173
int RaveValue_getHashTable(RaveValue_t *self, RaveObjectHashTable_t **table)
Returns the hash table if possible.
Definition rave_value.c:463
RaveValue_Type RaveValue_type(RaveValue_t *self)
Returns the format for this attribute.
Definition rave_value.c:151
int RaveValue_setStringArray(RaveValue_t *self, const char **value, int len)
Sets the value as a simple 1-dimensional double array.
Definition rave_value.c:312
int RaveValue_getStringArray(RaveValue_t *self, char ***value, int *len)
Returns the value as a string array.
Definition rave_value.c:344
const char * RaveValue_toString(RaveValue_t *self)
Returns the string value.
Definition rave_value.c:219
RaveValue_t * RaveValue_createLongArray(long *value, int len)
Creates a long array rave value.
Definition rave_value.c:358
void RaveValue_setLong(RaveValue_t *self, long value)
Sets the value as a long.
Definition rave_value.c:236
RaveValue_t * RaveValue_createStringArray(const char **value, int len)
Creates a string array rave value.
Definition rave_value.c:301
int RaveValue_setHashTable(RaveValue_t *self, RaveObjectHashTable_t *table)
Sets the value as a hash table.
Definition rave_value.c:452
int RaveValue_setLongArray(RaveValue_t *self, long *value, int len)
Sets the value as a simple 1-dimensional long array.
Definition rave_value.c:369
RaveObjectHashTable_t * RaveValue_toHashTable(RaveValue_t *self)
NOTE!
Definition rave_value.c:474
int RaveValue_getDouble(RaveValue_t *self, double *value)
Returns the value as a double.
Definition rave_value.c:283
int RaveValue_getLong(RaveValue_t *self, long *value)
Returns the value as a long.
Definition rave_value.c:244
struct _RaveValue_t RaveValue_t
Defines a rave value.
Definition rave_value.h:47
void RaveValue_reset(RaveValue_t *self)
Resets the value object.
Definition rave_value.c:157
long RaveValue_toLong(RaveValue_t *self)
Returns the long value.
Definition rave_value.c:256
RaveValue_t * RaveValue_createDoubleArray(double *value, int len)
Creates a double array rave value.
Definition rave_value.c:405
RaveValue_t * RaveValue_createDouble(double value)
Creates a double rave value.
Definition rave_value.c:262
RaveValue_t * RaveValue_createLong(long value)
Creates a long rave value.
Definition rave_value.c:225
double RaveValue_toDouble(RaveValue_t *self)
Returns the double value.
Definition rave_value.c:295
RaveValue_Type
Definition rave_value.h:32
@ RaveValue_Type_DoubleArray
Simple 1-dimensional array of doubles.
Definition rave_value.h:39
@ RaveValue_Type_String
String.
Definition rave_value.h:34
@ RaveValue_Type_Long
Long.
Definition rave_value.h:35
@ RaveValue_Type_LongArray
Simple 1-dimensional array of longs.
Definition rave_value.h:38
@ RaveValue_Type_Hashtable
Hash table.
Definition rave_value.h:41
@ RaveValue_Type_StringArray
Simple 1-dimensional array of strings.
Definition rave_value.h:37
@ RaveValue_Type_Data2D
2D array
Definition rave_value.h:40
@ RaveValue_Type_Undefined
Undefined.
Definition rave_value.h:33
@ RaveValue_Type_Double
Double.
Definition rave_value.h:36
int RaveValue_setDoubleArray(RaveValue_t *self, double *value, int len)
Sets the value as a simple 1-dimensional double array.
Definition rave_value.c:416
void RaveValue_setDouble(RaveValue_t *self, double value)
Sets the value as a double.
Definition rave_value.c:274
int RaveValue_getDoubleArray(RaveValue_t *self, double **value, int *len)
Returns the value as a double array.
Definition rave_value.c:439
Implementation of a rave object hashtable that maps between strings and rave core objects.
struct _RaveObjectHashTable_t RaveObjectHashTable_t
Defines a hash table.
Definition raveobject_hashtable.h:38
Represents one scan in a volume.
Definition rave_value.c:37