RAVE
rave_value.c File Reference

Data value abstraction. More...

#include "rave_value.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include "rave_object.h"
#include "rave_data2d.h"
#include <errno.h>
#include <stdio.h>

Classes

struct  _RaveValue_t
 Represents one scan in a volume. More...
 

Functions

RaveValue_Type RaveValue_type (RaveValue_t *self)
 Returns the format for this attribute.
 
void RaveValue_reset (RaveValue_t *self)
 Resets the value object.
 
RaveValue_tRaveValue_createString (const char *value)
 Creates a string rave value.
 
int RaveValue_setString (RaveValue_t *self, const char *value)
 Sets a string value in self.
 
int RaveValue_getString (RaveValue_t *self, char **value)
 Returns the value as a string.
 
const char * RaveValue_toString (RaveValue_t *self)
 Returns the string value.
 
RaveValue_tRaveValue_createLong (long value)
 Creates a long rave value.
 
void RaveValue_setLong (RaveValue_t *self, long value)
 Sets the value as a long.
 
int RaveValue_getLong (RaveValue_t *self, long *value)
 Returns the value as a long.
 
long RaveValue_toLong (RaveValue_t *self)
 Returns the long value.
 
RaveValue_tRaveValue_createDouble (double value)
 Creates a double rave value.
 
void RaveValue_setDouble (RaveValue_t *self, double value)
 Sets the value as a double.
 
int RaveValue_getDouble (RaveValue_t *self, double *value)
 Returns the value as a double.
 
double RaveValue_toDouble (RaveValue_t *self)
 Returns the double value.
 
RaveValue_tRaveValue_createStringArray (const char **value, int len)
 Creates a string array rave value.
 
int RaveValue_setStringArray (RaveValue_t *self, const char **value, int len)
 Sets the value as a simple 1-dimensional double array.
 
int RaveValue_getStringArray (RaveValue_t *self, char ***value, int *len)
 Returns the value as a string array.
 
RaveValue_tRaveValue_createLongArray (long *value, int len)
 Creates a long array rave value.
 
int RaveValue_setLongArray (RaveValue_t *self, long *value, int len)
 Sets the value as a simple 1-dimensional long array.
 
int RaveValue_getLongArray (RaveValue_t *self, long **value, int *len)
 Returns the value as a long array.
 
RaveValue_tRaveValue_createDoubleArray (double *value, int len)
 Creates a double array rave value.
 
int RaveValue_setDoubleArray (RaveValue_t *self, double *value, int len)
 Sets the value as a simple 1-dimensional double array.
 
int RaveValue_getDoubleArray (RaveValue_t *self, double **value, int *len)
 Returns the value as a double array.
 
int RaveValue_setHashTable (RaveValue_t *self, RaveObjectHashTable_t *table)
 Sets the value as a hash table.
 
int RaveValue_getHashTable (RaveValue_t *self, RaveObjectHashTable_t **table)
 Returns the hash table if possible.
 
RaveObjectHashTable_tRaveValue_toHashTable (RaveValue_t *self)
 NOTE!
 

Variables

RaveCoreObjectType RaveValue_TYPE
 Type definition to use when creating a rave object.
 

Detailed Description

Data value abstraction.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2025-02-14

Function Documentation

◆ RaveValue_createDouble()

RaveValue_t * RaveValue_createDouble ( double value)

Creates a double rave value.

Parameters
[in]value- the double
Returns
the value on success otherwise NULL

◆ RaveValue_createDoubleArray()

RaveValue_t * RaveValue_createDoubleArray ( double * value,
int len )

Creates a double array rave value.

Parameters
[in]value- the double array
[in]len- the length of the array
Returns
the value on success otherwise NULL

◆ RaveValue_createLong()

RaveValue_t * RaveValue_createLong ( long value)

Creates a long rave value.

Parameters
[in]value- the long
Returns
the value on success otherwise NULL

◆ RaveValue_createLongArray()

RaveValue_t * RaveValue_createLongArray ( long * value,
int len )

Creates a long array rave value.

Parameters
[in]value- the long array
[in]len- the length of the array
Returns
the value on success otherwise NULL

◆ RaveValue_createString()

RaveValue_t * RaveValue_createString ( const char * value)

Creates a string rave value.

Parameters
[in]value- the string
Returns
the value on success otherwise NULL

◆ RaveValue_createStringArray()

RaveValue_t * RaveValue_createStringArray ( const char ** value,
int len )

Creates a string array rave value.

Parameters
[in]value- the string array
[in]len- the length of the array
Returns
the value on success otherwise NULL

◆ RaveValue_getDouble()

int RaveValue_getDouble ( RaveValue_t * self,
double * value )

Returns the value as a double.

Parameters
[in]self- self
[out]value- the double value
Returns
1 on success or 0 if format of the data not is a double

◆ RaveValue_getDoubleArray()

int RaveValue_getDoubleArray ( RaveValue_t * self,
double ** value,
int * len )

Returns the value as a double array.

Parameters
[in]self- self
[out]value- the internal double array, DO NOT RELEASE memory
[out]len- the number of values in the array
Returns
1 on success or 0 if format of the data not is a double array

◆ RaveValue_getHashTable()

int RaveValue_getHashTable ( RaveValue_t * self,
RaveObjectHashTable_t ** table )

Returns the hash table if possible.

Parameters
[in]self
[out]table- a reference to the hash table
Returns
1 if value is a hash table otherwise 0

◆ RaveValue_getLong()

int RaveValue_getLong ( RaveValue_t * self,
long * value )

Returns the value as a long.

Parameters
[in]self- self
[out]value- the long value
Returns
1 on success or 0 if format of the data not is a long

◆ RaveValue_getLongArray()

int RaveValue_getLongArray ( RaveValue_t * self,
long ** value,
int * len )

Returns the value as a long array.

Parameters
[in]self- self
[out]value- the internal long array, DO NOT RELEASE memory
[out]len- the number of values in the array
Returns
1 on success or 0 if format of the data not is a long array

◆ RaveValue_getString()

int RaveValue_getString ( RaveValue_t * self,
char ** value )

Returns the value as a string.

Parameters
[in]self- self
[out]value- the internal 0-terminated string, DO NOT RELEASE memory
Returns
1 on success or 0 if format of the data not is a string

◆ RaveValue_getStringArray()

int RaveValue_getStringArray ( RaveValue_t * self,
char *** value,
int * len )

Returns the value as a string array.

Parameters
[in]self- self
[out]value- the internal string array, DO NOT RELEASE memory
[out]len- the number of values in the array
Returns
1 on success or 0 if format of the data not is a double array

◆ RaveValue_reset()

void RaveValue_reset ( RaveValue_t * self)

Resets the value object.

Parameters
[in]self- self

◆ RaveValue_setDouble()

void RaveValue_setDouble ( RaveValue_t * self,
double value )

Sets the value as a double.

Parameters
[in]self- self
[in]value- the value

◆ RaveValue_setDoubleArray()

int RaveValue_setDoubleArray ( RaveValue_t * self,
double * value,
int len )

Sets the value as a simple 1-dimensional double array.

Parameters
[in]self- self
[in]value- the value
[in]len- the number of doubles in the array
Returns
1 on success otherwise 0

◆ RaveValue_setHashTable()

int RaveValue_setHashTable ( RaveValue_t * self,
RaveObjectHashTable_t * table )

Sets the value as a hash table.

Parameters
[in]self- self
[in]table- the object hash table.
Returns
1 on success or 0 if not settable

◆ RaveValue_setLong()

void RaveValue_setLong ( RaveValue_t * self,
long value )

Sets the value as a long.

Parameters
[in]self- self
[in]value- the value

◆ RaveValue_setLongArray()

int RaveValue_setLongArray ( RaveValue_t * self,
long * value,
int len )

Sets the value as a simple 1-dimensional long array.

Parameters
[in]self- self
[in]value- the value
[in]len- the number of longs in the array
Returns
1 on success otherwise 0

◆ RaveValue_setString()

int RaveValue_setString ( RaveValue_t * self,
const char * value )

Sets a string value in self.

Parameters
[in]self- self
[in]value- the value
Returns
1 on success otherwise 0

◆ RaveValue_setStringArray()

int RaveValue_setStringArray ( RaveValue_t * self,
const char ** value,
int len )

Sets the value as a simple 1-dimensional double array.

Parameters
[in]self- self
[in]value- the value
[in]len- the number of doubles in the array
Returns
1 on success otherwise 0

◆ RaveValue_toDouble()

double RaveValue_toDouble ( RaveValue_t * self)

Returns the double value.

NOTE! It up to user to ensure that value actually is a double otherwise behavior will be undefined.

Parameters
[in]self- self
Returns
the double value or -

◆ RaveValue_toHashTable()

RaveObjectHashTable_t * RaveValue_toHashTable ( RaveValue_t * self)

NOTE!

It up to user to ensure that value actually is a hash table otherwise behavior will be undefined.

Parameters
[in]self- self
Returns
the hash table or NULL

◆ RaveValue_toLong()

long RaveValue_toLong ( RaveValue_t * self)

Returns the long value.

NOTE! It up to user to ensure that value actually is a long otherwise behavior will be undefined.

Parameters
[in]self- self
Returns
the long value or 0

◆ RaveValue_toString()

const char * RaveValue_toString ( RaveValue_t * self)

Returns the string value.

NOTE! It up to user to ensure that value actually is a string otherwise behavior will be undefined.

Parameters
[in]self- self
Returns
the string value or NULL

◆ RaveValue_type()

RaveValue_Type RaveValue_type ( RaveValue_t * self)

Returns the format for this attribute.

Parameters
[in]self- self
Returns
the format

Variable Documentation

◆ RaveValue_TYPE

RaveCoreObjectType RaveValue_TYPE
Initial value:
= {
"RaveValue",
sizeof(RaveValue_t),
RaveValue_constructor,
RaveValue_destructor,
RaveValue_copyconstructor
}
struct _RaveValue_t RaveValue_t
Defines a rave value.
Definition rave_value.h:47

Type definition to use when creating a rave object.