166 #ifndef OTF_KEYVALUE_H
167 #define OTF_KEYVALUE_H
198 typedef struct byte_array_struct {
199 uint8_t array[OTF_KEYVALUE_MAX_ARRAY_LEN];
203 typedef union OTF_Value_union {
215 byte_array otf_byte_array;
218 struct OTF_KeyValuePair_struct {
224 typedef struct OTF_KeyValuePairList_struct {
225 struct OTF_KeyValuePair_struct kvPair;
226 struct OTF_KeyValuePairList_struct *kvNext;
227 struct OTF_KeyValuePairList_struct *kvPrev;
228 } OTF_KeyValuePairList;
230 struct OTF_KeyValueList_struct {
234 OTF_KeyValuePairList *kvBegin;
235 OTF_KeyValuePairList *kvEnd;
236 OTF_KeyValuePairList *kvCurrent;
uint8_t OTF_KeyValueList_getInt32(OTF_KeyValueList *list, uint32_t key, int32_t *value)
Read a signed integer of 32 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:548
uint8_t OTF_KeyValueList_getArrayLength(OTF_KeyValueList *list, uint32_t key, uint32_t *len)
Provides the lenght of a byte array in an OTF_KeyValueList instance by given key. ...
Definition: OTF_KeyValue.c:714
uint8_t OTF_KeyValueList_getInt16(OTF_KeyValueList *list, uint32_t key, int16_t *value)
Read a signed integer of 16 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:524
uint8_t OTF_KeyValueList_close(OTF_KeyValueList *list)
Close an OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:61
uint8_t OTF_KeyValueList_getFloat(OTF_KeyValueList *list, uint32_t key, float *value)
Read a float from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:596
uint8_t OTF_KeyValueList_appendChar(OTF_KeyValueList *list, uint32_t key, char value)
Append a character to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:229
uint8_t OTF_KeyValueList_getInt64(OTF_KeyValueList *list, uint32_t key, int64_t *value)
Read a signed integer of 64 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:572
uint8_t OTF_KeyValueList_getInt8(OTF_KeyValueList *list, uint32_t key, int8_t *value)
Read a signed integer of 8 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:500
OTF_Type_enum
An enum which holds all OTF datatypes that are relevant for OTF_KeyValueList.
Definition: OTF_KeyValue.h:178
uint8_t OTF_KeyValueList_appendInt64(OTF_KeyValueList *list, uint32_t key, int64_t value)
Append a signed integer of 64 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:313
uint8_t OTF_KeyValueList_appendKeyValueList(OTF_KeyValueList *dest_list, OTF_KeyValueList *source_list)
Append an existing OTF_KeyValueList to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:401
uint8_t OTF_KeyValueList_realloc(OTF_KeyValueList *list, uint32_t num)
Expand an OTF_KeyValueList by allocating more memory.
Definition: OTF_KeyValue.c:134
uint8_t OTF_KeyValueList_getDouble(OTF_KeyValueList *list, uint32_t key, double *value)
Read a double from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:608
uint8_t OTF_KeyValueList_hasKey(OTF_KeyValueList *list, uint32_t key)
Search for key in the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:754
uint8_t OTF_KeyValueList_getByteArray(OTF_KeyValueList *list, uint32_t key, uint8_t *value, uint32_t *len)
Read a byte array from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:620
OTF_KeyValueList * OTF_KeyValueList_new(void)
Create a new OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:15
double OTF_Int64ToDouble(uint64_t value)
Convert an integer of 64 bit to a double.
Definition: OTF_KeyValue.c:430
uint8_t OTF_KeyValueList_appendDouble(OTF_KeyValueList *list, uint32_t key, double value)
Append a double to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:349
struct OTF_KeyValuePair_struct OTF_KeyValuePair
Object type which holds a key-value pair.
Definition: OTF_KeyValue.h:245
uint8_t OTF_KeyValueList_appendUint16(OTF_KeyValueList *list, uint32_t key, uint16_t value)
Append an unsigned integer of 16 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:277
uint8_t OTF_KeyValueList_getChar(OTF_KeyValueList *list, uint32_t key, char *value)
Read a character from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:488
float OTF_Int32ToFloat(uint32_t value)
Convert an integer of 32 bit to a float.
Definition: OTF_KeyValue.c:442
uint8_t OTF_KeyValueList_appendInt8(OTF_KeyValueList *list, uint32_t key, int8_t value)
Append a signed integer of 8 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:241
uint32_t OTF_KeyValueList_getCount(OTF_KeyValueList *list)
Returns the number of elements in the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:910
uint8_t OTF_KeyValueList_getPairByIndex(OTF_KeyValueList *list, uint32_t index, OTF_KeyValuePair **pair)
Search for a key-value pair at the given index position.
Definition: OTF_KeyValue.c:866
uint8_t OTF_KeyValueList_appendUint8(OTF_KeyValueList *list, uint32_t key, uint8_t value)
Append an unsigned integer of 8 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:253
uint8_t OTF_KeyValueList_appendInt16(OTF_KeyValueList *list, uint32_t key, int16_t value)
Append a signed integer of 16 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:265
uint8_t OTF_KeyValueList_reset(OTF_KeyValueList *list)
Reset an OTF_KeyValueList instance without deallocating memory.
Definition: OTF_KeyValue.c:88
uint8_t OTF_KeyValueList_removeKey(OTF_KeyValueList *list, uint32_t key)
Remove key from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:783
enum OTF_Type_enum OTF_Type
An enum which holds all OTF datatypes that are relevant for OTF_KeyValueList.
uint32_t OTF_FloatToInt32(float value)
Convert a float to an integer of 32 bit.
Definition: OTF_KeyValue.c:448
uint8_t OTF_KeyValueList_getKeyByIndex(OTF_KeyValueList *list, uint32_t index, uint32_t *key)
Search for a key at the given index position.
Definition: OTF_KeyValue.c:822
uint64_t OTF_DoubleToInt64(double value)
Convert a double to a signed integer of 64 bit.
Definition: OTF_KeyValue.c:436
uint8_t OTF_KeyValueList_getUint16(OTF_KeyValueList *list, uint32_t key, uint16_t *value)
Read an unsigned integer of 16 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:536
OTF_Type OTF_KeyValueList_getTypeForKey(OTF_KeyValueList *list, uint32_t key)
Search for key in given OTF_KeyValueList instance and return its type.
Definition: OTF_KeyValue.c:726
uint8_t OTF_KeyValueList_getUint8(OTF_KeyValueList *list, uint32_t key, uint8_t *value)
Read an unsigned integer of 8 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:512
uint8_t OTF_KeyValueList_appendInt32(OTF_KeyValueList *list, uint32_t key, int32_t value)
Append a signed integer of 32 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:289
uint8_t OTF_KeyValueList_getUint32(OTF_KeyValueList *list, uint32_t key, uint32_t *value)
Read an unsigned integer of 32 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:560
uint8_t OTF_KeyValueList_appendFloat(OTF_KeyValueList *list, uint32_t key, float value)
Append a float to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:337
struct OTF_KeyValueList_struct OTF_KeyValueList
Object type which holds a key-value list.
Definition: OTF_KeyValue.h:242
Provides many many macros for different purposes.
uint8_t OTF_KeyValueList_appendUint32(OTF_KeyValueList *list, uint32_t key, uint32_t value)
Append an unsigned integer of 32 bit to a OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:301
Deals with all data type related issues.
uint8_t OTF_KeyValueList_appendUint64(OTF_KeyValueList *list, uint32_t key, uint64_t value)
Append an unsigned integer of 64 bit to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:325
uint8_t OTF_KeyValueList_getUint64(OTF_KeyValueList *list, uint32_t key, uint64_t *value)
Read an unsigned integer of 64 bit from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:584
uint8_t OTF_KeyValueList_appendByteArray(OTF_KeyValueList *list, uint32_t key, uint8_t *value, uint32_t len)
Append a byte array to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:361