RAVE
|
Used for keeping track on attributes. More...
Go to the source code of this file.
Typedefs | |
typedef enum RaveAttribute_Format | RaveAttribute_Format |
typedef struct _RaveAttribute_t | RaveAttribute_t |
Defines a rave attribute. | |
Enumerations | |
enum | RaveAttribute_Format { RaveAttribute_Format_Undefined = -1 , RaveAttribute_Format_String = 0 , RaveAttribute_Format_Long = 1 , RaveAttribute_Format_Double = 2 , RaveAttribute_Format_LongArray = 3 , RaveAttribute_Format_DoubleArray = 4 } |
Functions | |
int | RaveAttribute_setName (RaveAttribute_t *attr, const char *name) |
Sets the name of this attribute. | |
const char * | RaveAttribute_getName (RaveAttribute_t *attr) |
Returns the name of this attribute. | |
RaveAttribute_Format | RaveAttribute_getFormat (RaveAttribute_t *attr) |
Returns the format for this attribute. | |
void | RaveAttribute_setLong (RaveAttribute_t *attr, long value) |
Sets the value as a long. | |
void | RaveAttribute_setDouble (RaveAttribute_t *attr, double value) |
Sets the value as a double. | |
int | RaveAttribute_setString (RaveAttribute_t *attr, const char *value) |
Sets the value as a string. | |
int | RaveAttribute_setLongArray (RaveAttribute_t *attr, long *value, int len) |
Sets the value as a simple 1-dimensional long array. | |
int | RaveAttribute_setDoubleArray (RaveAttribute_t *attr, double *value, int len) |
Sets the value as a simple 1-dimensional double array. | |
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 an appropriate array type. | |
int | RaveAttribute_getLong (RaveAttribute_t *attr, long *value) |
Returns the value as a long. | |
int | RaveAttribute_getDouble (RaveAttribute_t *attr, double *value) |
Returns the value as a double. | |
int | RaveAttribute_getString (RaveAttribute_t *attr, char **value) |
Returns the value as a string. | |
int | RaveAttribute_getLongArray (RaveAttribute_t *attr, long **value, int *len) |
Returns the value as a long array. | |
int | RaveAttribute_getDoubleArray (RaveAttribute_t *attr, double **value, int *len) |
Returns the value as a double array. | |
int | RaveAttribute_shiftArray (RaveAttribute_t *attr, int nx) |
Performs a circular shift of the array. | |
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>. | |
int | RaveAttributeHelp_validateHowGroupAttributeName (const char *gname, const char *aname) |
Validates an attribute name that resides in a how-main group. | |
RaveAttribute_t * | RaveAttributeHelp_createNamedAttribute (const char *name) |
Creates a named rave attribute. | |
RaveAttribute_t * | RaveAttributeHelp_createLong (const char *name, long value) |
Creates a long rave attribute. | |
RaveAttribute_t * | RaveAttributeHelp_createDouble (const char *name, double value) |
Creates a double rave attribute. | |
RaveAttribute_t * | RaveAttributeHelp_createDoubleFromString (const char *name, const char *value) |
Creates a double rave attribute from a string representation of the double value. | |
RaveAttribute_t * | RaveAttributeHelp_createString (const char *name, const char *value) |
Creates a string rave attribute. | |
RaveAttribute_t * | RaveAttributeHelp_createLongArray (const char *name, long *value, int len) |
Creates a long array rave attribute. | |
RaveAttribute_t * | RaveAttributeHelp_createDoubleArray (const char *name, double *value, int len) |
Creates a double array rave attribute. | |
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 array type. | |
RaveAttribute_t * | RaveAttributeHelp_createStringFmt (const char *name, const char *fmt,...) |
Creates a string from the provided varargs expression. | |
Variables | |
RaveCoreObjectType | RaveAttribute_TYPE |
Type definition to use when creating a rave object. | |
typedef struct _RaveAttribute_t RaveAttribute_t |
Defines a rave attribute.
enum RaveAttribute_Format |
int RaveAttribute_getDouble | ( | RaveAttribute_t * | attr, |
double * | value ) |
Returns the value as a double.
[in] | attr | - self |
[out] | value | - the double value |
int RaveAttribute_getDoubleArray | ( | RaveAttribute_t * | attr, |
double ** | value, | ||
int * | len ) |
Returns the value as a double array.
[in] | attr | - self |
[out] | value | - the internal double array, DO NOT RELEASE memory |
[out] | len | - the number of values in the array |
RaveAttribute_Format RaveAttribute_getFormat | ( | RaveAttribute_t * | attr | ) |
Returns the format for this attribute.
[in] | attr | - self |
int RaveAttribute_getLong | ( | RaveAttribute_t * | attr, |
long * | value ) |
Returns the value as a long.
[in] | attr | - self |
[out] | value | - the long value |
int RaveAttribute_getLongArray | ( | RaveAttribute_t * | attr, |
long ** | value, | ||
int * | len ) |
Returns the value as a long array.
[in] | attr | - self |
[out] | value | - the internal long array, DO NOT RELEASE memory |
[out] | len | - the number of values in the array |
const char * RaveAttribute_getName | ( | RaveAttribute_t * | attr | ) |
Returns the name of this attribute.
[in] | attr | - self |
int RaveAttribute_getString | ( | RaveAttribute_t * | attr, |
char ** | value ) |
Returns the value as a string.
[in] | attr | - self |
[out] | value | - the internal 0-terminated string, DO NOT RELEASE memory |
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 an appropriate array type.
[in] | attr | - self |
[in] | name | - the name of the attribute |
[in] | value | - the data |
[in] | len | - the number of items in the array |
[in] | type | - the data type |
void RaveAttribute_setDouble | ( | RaveAttribute_t * | attr, |
double | value ) |
Sets the value as a double.
[in] | attr | - self |
[in] | value | - the value |
int RaveAttribute_setDoubleArray | ( | RaveAttribute_t * | attr, |
double * | value, | ||
int | len ) |
Sets the value as a simple 1-dimensional double array.
[in] | attr | - self |
[in] | value | - the value |
[in] | len | - the number of doubles in the array |
void RaveAttribute_setLong | ( | RaveAttribute_t * | attr, |
long | value ) |
Sets the value as a long.
[in] | attr | - self |
[in] | value | - the value |
int RaveAttribute_setLongArray | ( | RaveAttribute_t * | attr, |
long * | value, | ||
int | len ) |
Sets the value as a simple 1-dimensional long array.
[in] | attr | - self |
[in] | value | - the value |
[in] | len | - the number of longs in the array |
int RaveAttribute_setName | ( | RaveAttribute_t * | attr, |
const char * | name ) |
Sets the name of this attribute.
[in] | attr | - self |
[in] | name | - the name this attribute should have |
int RaveAttribute_setString | ( | RaveAttribute_t * | attr, |
const char * | value ) |
Sets the value as a string.
[in] | attr | - self |
[in] | value | - the value |
int RaveAttribute_shiftArray | ( | RaveAttribute_t * | attr, |
int | nx ) |
Performs a circular shift of the array.
if nx < 0, then shift is performed counter clockwise, if nx > 0, shift is performed clock wise, if 0, no shift is performed.
[in] | attr | - attribute to shift |
[in] | nx | - number of positions to shift return 1 if successful, 0 if trying to shift an attribute that isn't an array or an error occurs during shift. |
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 array type.
[in] | name | - the name of the attribute |
[in] | value | - the data |
[in] | len | - the number of items in the array |
[in] | type | - the data type |
RaveAttribute_t * RaveAttributeHelp_createDouble | ( | const char * | name, |
double | value ) |
Creates a double rave attribute.
[in] | name | - the name of the attribute |
[in] | value | - the double |
RaveAttribute_t * RaveAttributeHelp_createDoubleArray | ( | const char * | name, |
double * | value, | ||
int | len ) |
Creates a double array rave attribute.
[in] | name | - the name of the attribute |
[in] | value | - the double array |
[in] | len | - the length of the array |
RaveAttribute_t * RaveAttributeHelp_createDoubleFromString | ( | const char * | name, |
const char * | value ) |
Creates a double rave attribute from a string representation of the double value.
[in] | name | - the name of the attribute |
[in] | value | - the double |
RaveAttribute_t * RaveAttributeHelp_createLong | ( | const char * | name, |
long | value ) |
Creates a long rave attribute.
[in] | name | - the name of the attribute |
[in] | value | - the long |
RaveAttribute_t * RaveAttributeHelp_createLongArray | ( | const char * | name, |
long * | value, | ||
int | len ) |
Creates a long array rave attribute.
[in] | name | - the name of the attribute |
[in] | value | - the long array |
[in] | len | - the length of the array |
RaveAttribute_t * RaveAttributeHelp_createNamedAttribute | ( | const char * | name | ) |
Creates a named rave attribute.
[in] | name | - the name of the attribute |
RaveAttribute_t * RaveAttributeHelp_createString | ( | const char * | name, |
const char * | value ) |
Creates a string rave attribute.
[in] | name | - the name of the attribute |
[in] | value | - the string |
RaveAttribute_t * RaveAttributeHelp_createStringFmt | ( | const char * | name, |
const char * | fmt, | ||
... ) |
Creates a string from the provided varargs expression.
[in] | name | - the name of the attribute |
[in] | fmt | - the varargs string format |
[in] | len | - the number of items in the array |
[in] | type | - the data type |
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>.
[in] | attrname | - the string that should get group and name extracted |
[out] | group | - the group name (allocated memory so free it) |
[out] | name | - the attr name (allocated memory so free it) |
int RaveAttributeHelp_validateHowGroupAttributeName | ( | const char * | gname, |
const char * | aname ) |
Validates an attribute name that resides in a how-main group.
This will validate that it may exists sub groups and that this name is valid. gname should be how, then aname is the trailing part For example: gname=how, aname=attribute gname=how, aname=subgroup1/attribute gname=how, aname=subgroup1/subgroup2/attribute are all valid names.
[in] | gname | - should always be how |
[in] | aname | - the rest of the name as described above. |
|
extern |
Type definition to use when creating a rave object.