|
RAVE
|
Data value abstraction. More...
#include "rave_value.h"#include "rave_debug.h"#include "rave_alloc.h"#include <string.h>#include "rave_list.h"#include "rave_object.h"#include "rave_data2d.h"#include "raveobject_hashtable.h"#include "raveobject_list.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_t * | RaveValue_createString (const char *value) |
| Creates a string rave value. | |
| RaveValue_t * | RaveValue_createStringFmt (const char *fmt,...) |
| Creates a string rave value from a varargs list. | |
| 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_t * | RaveValue_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_t * | RaveValue_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_t * | RaveValue_createBoolean (int value) |
| Creates a boolean rave value. | |
| void | RaveValue_setBoolean (RaveValue_t *self, int value) |
| Sets the value as a boolean. | |
| int | RaveValue_getBoolean (RaveValue_t *self, int *value) |
| Returns the value as a boolean. | |
| int | RaveValue_toBoolean (RaveValue_t *self) |
| Returns the boolean value. | |
| RaveValue_t * | RaveValue_createNull () |
| Creates a null rave value. | |
| void | RaveValue_setNull (RaveValue_t *self) |
| Sets the value as a null value. | |
| int | RaveValue_isNull (RaveValue_t *self) |
| Returns if the value is null or not. | |
| int | RaveValue_isStringArray (RaveValue_t *self) |
| Returns if the rave value can be represented as a string array (list of strings only) | |
| RaveValue_t * | RaveValue_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 string array. | |
| int | RaveValue_getStringArray (RaveValue_t *self, char ***value, int *len) |
| Returns the value as a string array. | |
| int | RaveValue_isLongArray (RaveValue_t *self) |
| Returns if the rave value can be represented as a long array (list of long only) | |
| RaveValue_t * | RaveValue_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. | |
| int | RaveValue_isDoubleArray (RaveValue_t *self) |
| Returns if the rave value can be represented as a double array (list of double only) | |
| RaveValue_t * | RaveValue_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. | |
| RaveValue_t * | RaveValue_createHashTable (RaveObjectHashTable_t *hashtable) |
| Creates a rave value hash table. | |
| 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_t * | RaveValue_toHashTable (RaveValue_t *self) |
| NOTE! | |
| int | RaveValueHash_put (RaveValue_t *self, const char *key, RaveValue_t *value) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_put. | |
| RaveValue_t * | RaveValueHash_get (RaveValue_t *self, const char *key) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_get. | |
| int | RaveValueHash_size (RaveValue_t *self) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_size. | |
| int | RaveValueHash_exists (RaveValue_t *self, const char *key) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_exists. | |
| void | RaveValueHash_remove (RaveValue_t *self, const char *key) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_remove except that the value is destrouyed. | |
| void | RaveValueHash_clear (RaveValue_t *self) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_clear. | |
| RaveList_t * | RaveValueHash_keys (RaveValue_t *self) |
| If rave value is hash, then this provides same functionality as RaveObjectHashTable_keys. | |
| RaveValue_t * | RaveValue_createList (RaveObjectList_t *rlist) |
| Creates a rave value list. | |
| int | RaveValue_setList (RaveValue_t *self, RaveObjectList_t *rlist) |
| Sets the value as a rave list. | |
| int | RaveValue_getList (RaveValue_t *self, RaveObjectList_t **rlist) |
| Returns the rave list if possible. | |
| RaveObjectList_t * | RaveValue_toList (RaveValue_t *self) |
| NOTE! | |
| int | RaveValueList_add (RaveValue_t *self, RaveValue_t *value) |
| If rave value is list, then this provides same functionality as RaveObjectList_add. | |
| int | RaveValueList_insert (RaveValue_t *self, int index, RaveValue_t *value) |
| If rave value is list, then this provides same functionality as RaveObjectList_insert. | |
| RaveValue_t * | RaveValueList_join (RaveValue_t *self, const char *sep) |
| Creates a rave value string from the list of strings and adds the separator between each entry. | |
| int | RaveValueList_size (RaveValue_t *self) |
| If rave value is list, then this provides same functionality as RaveObjectList_size. | |
| RaveValue_t * | RaveValueList_get (RaveValue_t *self, int index) |
| If rave value is list, then this provides same functionality as RaveObjectList_get. | |
| void | RaveValueList_release (RaveValue_t *self, int index) |
| If rave value is list, then this provides same functionality as RaveObjectList_release. | |
| void | RaveValueList_clear (RaveValue_t *self) |
| If rave value is list, then this provides same functionality as RaveObjectList_clear. | |
| char * | RaveValue_toJSON (RaveValue_t *self) |
| Translates self to a json representation. | |
| RaveValue_t * | RaveValue_fromJSON (const char *json) |
| Support function for translating a json structure to a rave value. | |
| RaveValue_t * | RaveValue_loadJSON (const char *filename) |
| Loads a JSON object from a file. | |
Variables | |
| RaveCoreObjectType | RaveValue_TYPE |
| Type definition to use when creating a rave object. | |
Data value abstraction.
| RaveValue_t * RaveValue_createBoolean | ( | int | value | ) |
Creates a boolean rave value.
| [in] | value | - the boolean. 0 means false, other values means true |
| RaveValue_t * RaveValue_createDouble | ( | double | value | ) |
Creates a double rave value.
| [in] | value | - the double |
| RaveValue_t * RaveValue_createDoubleArray | ( | double * | value, |
| int | len ) |
Creates a double array rave value.
| [in] | value | - the double array |
| [in] | len | - the length of the array |
| RaveValue_t * RaveValue_createHashTable | ( | RaveObjectHashTable_t * | hashtable | ) |
Creates a rave value hash table.
| [in] | hashtable | - the hashtable |
| RaveValue_t * RaveValue_createList | ( | RaveObjectList_t * | rlist | ) |
Creates a rave value list.
| [in] | rlist | - the rave list |
| RaveValue_t * RaveValue_createLong | ( | long | value | ) |
Creates a long rave value.
| [in] | value | - the long |
| RaveValue_t * RaveValue_createLongArray | ( | long * | value, |
| int | len ) |
Creates a long array rave value.
| [in] | value | - the long array |
| [in] | len | - the length of the array |
| RaveValue_t * RaveValue_createNull | ( | ) |
Creates a null rave value.
| [in] | value | - the null value |
| RaveValue_t * RaveValue_createString | ( | const char * | value | ) |
Creates a string rave value.
| [in] | value | - the string |
| RaveValue_t * RaveValue_createStringArray | ( | const char ** | value, |
| int | len ) |
Creates a string array rave value.
| [in] | value | - the string array |
| [in] | len | - the length of the array |
| RaveValue_t * RaveValue_createStringFmt | ( | const char * | fmt, |
| ... ) |
Creates a string rave value from a varargs list.
| [in] | value | - the string |
| RaveValue_t * RaveValue_fromJSON | ( | const char * | json | ) |
Support function for translating a json structure to a rave value.
| [in] | json | - the json string |
| int RaveValue_getBoolean | ( | RaveValue_t * | self, |
| int * | value ) |
Returns the value as a boolean.
| [in] | self | - self |
| [out] | value | - the boolean value |
| int RaveValue_getDouble | ( | RaveValue_t * | self, |
| double * | value ) |
Returns the value as a double.
| [in] | self | - self |
| [out] | value | - the double value |
| int RaveValue_getDoubleArray | ( | RaveValue_t * | self, |
| double ** | value, | ||
| int * | len ) |
Returns the value as a double array.
| [in] | self | - self |
| [out] | value | - the double array, Release memory |
| [out] | len | - the number of values in the array |
| int RaveValue_getHashTable | ( | RaveValue_t * | self, |
| RaveObjectHashTable_t ** | table ) |
Returns the hash table if possible.
| [in] | self | |
| [out] | table | - a reference to the hash table |
| int RaveValue_getList | ( | RaveValue_t * | self, |
| RaveObjectList_t ** | rlist ) |
Returns the rave list if possible.
| [in] | self | |
| [out] | rlist | - a reference to the rave list |
| int RaveValue_getLong | ( | RaveValue_t * | self, |
| long * | value ) |
Returns the value as a long.
| [in] | self | - self |
| [out] | value | - the long value |
| int RaveValue_getLongArray | ( | RaveValue_t * | self, |
| long ** | value, | ||
| int * | len ) |
Returns the value as a long array.
| [in] | self | - self |
| [out] | value | - the long array, Release memory |
| [out] | len | - the number of values in the array |
| int RaveValue_getString | ( | RaveValue_t * | self, |
| char ** | value ) |
Returns the value as a string.
| [in] | self | - self |
| [out] | value | - the internal 0-terminated string, DO NOT RELEASE memory |
| int RaveValue_getStringArray | ( | RaveValue_t * | self, |
| char *** | value, | ||
| int * | len ) |
Returns the value as a string array.
| [in] | self | - self |
| [out] | value | - the a string array. Release memory. |
| [out] | len | - the number of values in the array |
| int RaveValue_isDoubleArray | ( | RaveValue_t * | self | ) |
Returns if the rave value can be represented as a double array (list of double only)
| [in] | self | - self |
| int RaveValue_isLongArray | ( | RaveValue_t * | self | ) |
Returns if the rave value can be represented as a long array (list of long only)
| [in] | self | - self |
| int RaveValue_isNull | ( | RaveValue_t * | self | ) |
Returns if the value is null or not.
| [in] | self | - self |
| int RaveValue_isStringArray | ( | RaveValue_t * | self | ) |
Returns if the rave value can be represented as a string array (list of strings only)
| [in] | self | - self |
| RaveValue_t * RaveValue_loadJSON | ( | const char * | filename | ) |
Loads a JSON object from a file.
| [in] | filename | - the filename |
| void RaveValue_reset | ( | RaveValue_t * | self | ) |
Resets the value object.
| [in] | self | - self |
| void RaveValue_setBoolean | ( | RaveValue_t * | self, |
| int | value ) |
Sets the value as a boolean.
| [in] | self | - self |
| [in] | value | - the value |
| void RaveValue_setDouble | ( | RaveValue_t * | self, |
| double | value ) |
Sets the value as a double.
| [in] | self | - self |
| [in] | value | - the value |
| int RaveValue_setDoubleArray | ( | RaveValue_t * | self, |
| double * | value, | ||
| int | len ) |
Sets the value as a simple 1-dimensional double array.
| [in] | self | - self |
| [in] | value | - the value |
| [in] | len | - the number of doubles in the array |
| int RaveValue_setHashTable | ( | RaveValue_t * | self, |
| RaveObjectHashTable_t * | table ) |
Sets the value as a hash table.
| [in] | self | - self |
| [in] | table | - the object hash table. |
| int RaveValue_setList | ( | RaveValue_t * | self, |
| RaveObjectList_t * | rlist ) |
Sets the value as a rave list.
| [in] | self | - self |
| [in] | rlist | - the object list. |
| void RaveValue_setLong | ( | RaveValue_t * | self, |
| long | value ) |
Sets the value as a long.
| [in] | self | - self |
| [in] | value | - the value |
| int RaveValue_setLongArray | ( | RaveValue_t * | self, |
| long * | value, | ||
| int | len ) |
Sets the value as a simple 1-dimensional long array.
| [in] | self | - self |
| [in] | value | - the value |
| [in] | len | - the number of longs in the array |
| void RaveValue_setNull | ( | RaveValue_t * | self | ) |
Sets the value as a null value.
| [in] | self | - self |
| int RaveValue_setString | ( | RaveValue_t * | self, |
| const char * | value ) |
Sets a string value in self.
| [in] | self | - self |
| [in] | value | - the value |
| int RaveValue_setStringArray | ( | RaveValue_t * | self, |
| const char ** | value, | ||
| int | len ) |
Sets the value as a simple 1-dimensional string array.
| [in] | self | - self |
| [in] | value | - the value |
| [in] | len | - the number of doubles in the array |
| int RaveValue_toBoolean | ( | RaveValue_t * | self | ) |
Returns the boolean value.
NOTE! It up to user to ensure that value actually is a boolean otherwise behavior will be undefined.
| [in] | self | - self |
| 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.
| [in] | self | - self |
| 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.
| [in] | self | - self |
| char * RaveValue_toJSON | ( | RaveValue_t * | self | ) |
Translates self to a json representation.
| [in] | self | - self |
| RaveObjectList_t * RaveValue_toList | ( | RaveValue_t * | self | ) |
NOTE!
It up to user to ensure that value actually is a rave list otherwise behavior will be undefined.
| [in] | self | - self |
| 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.
| [in] | self | - self |
| 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.
| [in] | self | - self |
| RaveValue_Type RaveValue_type | ( | RaveValue_t * | self | ) |
Returns the format for this attribute.
| [in] | self | - self |
| void RaveValueHash_clear | ( | RaveValue_t * | self | ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_clear.
| [in] | self | - self |
| int RaveValueHash_exists | ( | RaveValue_t * | self, |
| const char * | key ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_exists.
| [in] | self | - self |
| [in] | key | - the key |
| RaveValue_t * RaveValueHash_get | ( | RaveValue_t * | self, |
| const char * | key ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_get.
| [in] | self | - self |
| [in] | key | - the key |
| RaveList_t * RaveValueHash_keys | ( | RaveValue_t * | self | ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_keys.
| [in] | self | - self |
| int RaveValueHash_put | ( | RaveValue_t * | self, |
| const char * | key, | ||
| RaveValue_t * | value ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_put.
| [in] | self | - self |
| [in] | key | - the key |
| [in] | value | - the rave value |
| void RaveValueHash_remove | ( | RaveValue_t * | self, |
| const char * | key ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_remove except that the value is destrouyed.
| [in] | self | - self |
| [in] | key | - the key |
| int RaveValueHash_size | ( | RaveValue_t * | self | ) |
If rave value is hash, then this provides same functionality as RaveObjectHashTable_size.
| [in] | self | - self |
| int RaveValueList_add | ( | RaveValue_t * | self, |
| RaveValue_t * | value ) |
If rave value is list, then this provides same functionality as RaveObjectList_add.
| [in] | self | - self |
| [in] | value | - the value |
| void RaveValueList_clear | ( | RaveValue_t * | self | ) |
If rave value is list, then this provides same functionality as RaveObjectList_clear.
| [in] | self | - self |
| RaveValue_t * RaveValueList_get | ( | RaveValue_t * | self, |
| int | index ) |
If rave value is list, then this provides same functionality as RaveObjectList_get.
| [in] | self | - self |
| [in] | index | - the index |
| int RaveValueList_insert | ( | RaveValue_t * | self, |
| int | index, | ||
| RaveValue_t * | value ) |
If rave value is list, then this provides same functionality as RaveObjectList_insert.
| [in] | self | - self |
| [in] | index | - the index where to insert the value |
| [in] | value | - the value |
| RaveValue_t * RaveValueList_join | ( | RaveValue_t * | self, |
| const char * | sep ) |
Creates a rave value string from the list of strings and adds the separator between each entry.
| [in] | self | - the list |
| [in] | sep | - the separator |
| void RaveValueList_release | ( | RaveValue_t * | self, |
| int | index ) |
If rave value is list, then this provides same functionality as RaveObjectList_release.
| [in] | self | - self |
| [in] | index | - the index |
| int RaveValueList_size | ( | RaveValue_t * | self | ) |
If rave value is list, then this provides same functionality as RaveObjectList_size.
| [in] | self | - self |
| RaveCoreObjectType RaveValue_TYPE |
Type definition to use when creating a rave object.