OpenMPI  0.1.1
KeyValueList Interface

Provides an additional list of key-value pairs that can be added to records. More...

Files

file  OTF_KeyValue.h
 Provides an additional list of key value pairs that can be added to records.
 

Functions

OTF_KeyValueListOTF_KeyValueList_new (void)
 Create a new OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_close (OTF_KeyValueList *list)
 Close an OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_reset (OTF_KeyValueList *list)
 Reset an OTF_KeyValueList instance without deallocating memory. More...
 
uint8_t OTF_KeyValueList_realloc (OTF_KeyValueList *list, uint32_t num)
 Expand an OTF_KeyValueList by allocating more memory. More...
 
uint8_t OTF_KeyValueList_appendChar (OTF_KeyValueList *list, uint32_t key, char value)
 Append a character to a given OTF_KeyValueList instance. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
uint8_t OTF_KeyValueList_appendFloat (OTF_KeyValueList *list, uint32_t key, float value)
 Append a float to a given OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_appendDouble (OTF_KeyValueList *list, uint32_t key, double value)
 Append a double to a given OTF_KeyValueList instance. More...
 
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. More...
 
uint8_t OTF_KeyValueList_appendKeyValueList (OTF_KeyValueList *dest_list, OTF_KeyValueList *source_list)
 Append an existing OTF_KeyValueList to a given OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_getChar (OTF_KeyValueList *list, uint32_t key, char *value)
 Read a character from the given OTF_KeyValueList instance. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
uint8_t OTF_KeyValueList_getFloat (OTF_KeyValueList *list, uint32_t key, float *value)
 Read a float from the given OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_getDouble (OTF_KeyValueList *list, uint32_t key, double *value)
 Read a double from the given OTF_KeyValueList instance. More...
 
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. More...
 
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. More...
 
OTF_Type OTF_KeyValueList_getTypeForKey (OTF_KeyValueList *list, uint32_t key)
 Search for key in given OTF_KeyValueList instance and return its type. More...
 
uint8_t OTF_KeyValueList_hasKey (OTF_KeyValueList *list, uint32_t key)
 Search for key in the given OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_removeKey (OTF_KeyValueList *list, uint32_t key)
 Remove key from the given OTF_KeyValueList instance. More...
 
uint8_t OTF_KeyValueList_getKeyByIndex (OTF_KeyValueList *list, uint32_t index, uint32_t *key)
 Search for a key at the given index position. More...
 
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. More...
 
uint32_t OTF_KeyValueList_getCount (OTF_KeyValueList *list)
 Returns the number of elements in the given OTF_KeyValueList instance. More...
 
float OTF_Int32ToFloat (uint32_t value)
 Convert an integer of 32 bit to a float.
 
uint32_t OTF_FloatToInt32 (float value)
 Convert a float to an integer of 32 bit.
 
double OTF_Int64ToDouble (uint64_t value)
 Convert an integer of 64 bit to a double.
 
uint64_t OTF_DoubleToInt64 (double value)
 Convert a double to a signed integer of 64 bit.
 

Detailed Description

Provides an additional list of key-value pairs that can be added to records.

A short Example of writing a KeyValueList

You can append key-value pairs to an OTF_KeyValueList instance that can be added to any record.

After one call to OTF_Writer_writeXxxKV() the given KeyValueList instance will be empty.

#include <assert.h>
#include "otf.h"
int main( int argc, char** argv ) {
OTF_FileManager* manager;
OTF_Writer* writer;
OTF_KeyValueList* KeyValueList;
manager= OTF_FileManager_open( 100 );
assert( manager );
writer = OTF_Writer_open( "mytrace", 1, manager );
assert( writer );

Initialize the prior declared OTF_KeyValueList.

KeyValueList = OTF_KeyValueList_new();

Write a DefKeyValue record that assigns key=1 to name="first_arg" with description="first argument of function" and type=OTF_INT32.

OTF_Writer_writeDefKeyValue( writer, 0, 1, OTF_INT32, "first_arg", "first argument of function" );

Append a signed integer for key=1 to the initialized KeyValueList.

OTF_KeyValueList_appendInt32( KeyValueList, 1, 25);

Write the entries of the KeyValueList together with the enter record. Afterwards the KeyValueList will be empty!

OTF_Writer_writeEnterKV( writer, 10000, 100, 1, 0, KeyValueList );

Clean up before exiting the program. Close the OTF_KeyValueList.

OTF_KeyValueList_close( KeyValueList );
OTF_Writer_close( writer );
return 0;
}

Compile this using $ gcc -o write write.c otfconfig --libs.

A short Example of reading from a KeyValueList

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "otf.h"
int global_key = 0;

Define a callback to read all DefKeyValue records.

int handleDefKeyValue( void* userData, uint32_t stream, uint32_t key, OTF_Type type, const char* name, const char *description ) {

Find out which key you are looking for.

if( strcmp( name, "first_arg") == 0 ) {
global_key = key;
}
return OTF_RETURN_OK;
}

Define a callback to read all enter records.

int handleEnter (void *userData, uint64_t time, uint32_t function, uint32_t process, uint32_t source, OTF_KeyValueList *list) {
int value;

Ask for a key value pair with key=global_key. Save the value in variable "value".

switch( OTF_KeyValueList_getInt32( list, global_key, &value) ) {
case 0:
printf("We entered function %u with argument %d\n", function, value);
break;
case 1:
printf("We entered function %u with no argument.\n", function);
break;
default:
printf("An error occurred while asking for key value pair.\n");
}
return OTF_RETURN_OK;
}

main() includes the common instructions to read an .otf-file.

int main( int argc, char** argv ) {
OTF_FileManager* manager;
OTF_Reader* reader;
OTF_HandlerArray* handlers;
manager= OTF_FileManager_open( 100 );
assert( manager );
handlers = OTF_HandlerArray_open();
assert( handlers );
reader = OTF_Reader_open( "mytrace", manager );
assert( reader );
OTF_HandlerArray_setHandler( handlers, (OTF_FunctionPointer*) handleDefKeyValue, OTF_DEFKEYVALUE_RECORD );
OTF_HandlerArray_setHandler( handlers, (OTF_FunctionPointer*) handleEnter, OTF_ENTER_RECORD );
OTF_Reader_readDefinitions( reader, handlers );
OTF_Reader_readEvents( reader, handlers );
OTF_Reader_close( reader );
return 0;
}

Compile this using $ gcc -o read read.c otfconfig --libs.

Function Documentation

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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valuePointer to a byte array that should be appended to the KeyValueList.
lenLenght of byte array.
Returns
0 on success, 1 if key already in list and 255 if an error occurs

References OTF_KeyValueList_hasKey().

uint8_t OTF_KeyValueList_appendChar ( OTF_KeyValueList list,
uint32_t  key,
char  value 
)

Append a character to a given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA character that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
uint8_t OTF_KeyValueList_appendDouble ( OTF_KeyValueList list,
uint32_t  key,
double  value 
)

Append a double to a given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA double that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
uint8_t OTF_KeyValueList_appendFloat ( OTF_KeyValueList list,
uint32_t  key,
float  value 
)

Append a float to a given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA float that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA signed integer of 16 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA signed integer of 32 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA signed integer of 64 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueA signed integer of 8 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
uint8_t OTF_KeyValueList_appendKeyValueList ( OTF_KeyValueList dest_list,
OTF_KeyValueList source_list 
)

Append an existing OTF_KeyValueList to a given OTF_KeyValueList instance.

Parameters
dest_listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
source_listPointer to an initialized OTF_KeyValueList instance that shall be appended to the given KeyValueList. See also OTF_KeyValueList_new();
Returns
0 on success, 1 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueAn unsigned integer of 16 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueAn unsigned integer of 32 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueAn unsigned integer of 64 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the KeyValueList.
valueAn unsigned integer of 8 bit that should be appended to the KeyValueList.
Returns
0 on success, 1 if key already in list and 255 if an error occurs
uint8_t OTF_KeyValueList_close ( OTF_KeyValueList list)

Close an OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
Returns
0 if instance was closed successfully and 1 otherwise.

Referenced by OTF_KeyValueList_new(), and OTF_RBuffer_close().

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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the pair in the OTF_KeyValueList.
lenReturn value for the array length.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to an allocated byte array, where the result is saved.
lenInput and output parameter: Musst contain the number of bytes that can be written to the buffer pointed by the parameter value. Therefore at least len bytes musst be allocated for this buffer before. At the end len contains the number of bytes written to the buffer. This can be less or equal to the input of parameter len. To get the total number of bytes stored in the byte-array for the specific key you can use the function OTF_KeyValueList_getArrayLength() before.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
uint8_t OTF_KeyValueList_getChar ( OTF_KeyValueList list,
uint32_t  key,
char *  value 
)

Read a character from the given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
valuePointer to a char array, where the result is saved.
keyAn unique id that identifies the value in the OTF_KeyValueList.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
uint32_t OTF_KeyValueList_getCount ( OTF_KeyValueList list)

Returns the number of elements in the given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
Returns
Number of elements currently in list.
uint8_t OTF_KeyValueList_getDouble ( OTF_KeyValueList list,
uint32_t  key,
double *  value 
)

Read a double from the given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to a double, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
uint8_t OTF_KeyValueList_getFloat ( OTF_KeyValueList list,
uint32_t  key,
float *  value 
)

Read a float from the given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to a float, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to a signed integer of 16 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to a signed integer of 32 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to a signed integer of 64 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to a signed integer of 8 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
uint8_t OTF_KeyValueList_getKeyByIndex ( OTF_KeyValueList list,
uint32_t  index,
uint32_t *  key 
)

Search for a key at the given index position.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
indexIndex position in the OTF_KeyValueList.
keyReturn value for the found key.
Returns
0 on success, 1 if index not in list
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
indexIndex position in the OTF_KeyValueList.
pairPointer to the found key-value pair.
Returns
0 on success, 1 if index not in list
OTF_Type OTF_KeyValueList_getTypeForKey ( OTF_KeyValueList list,
uint32_t  key 
)

Search for key in given OTF_KeyValueList instance and return its type.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the pair in the OTF_KeyValueList.
Returns
OTF_Type on success, OTF_UNKNOWN if key not found or an error occurred.
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to an unsigned integer of 16 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to an unsigned integer of 32 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to an unsigned integer of 64 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
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.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyAn unique id that identifies the value in the OTF_KeyValueList.
valuePointer to an unsigned integer of 8 bit, where the result is saved.
Returns
0 on success, 1 if key not found, 2 if type differs and 255 if an error occurs
uint8_t OTF_KeyValueList_hasKey ( OTF_KeyValueList list,
uint32_t  key 
)

Search for key in the given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyToken that shall be searched in the OTF_KeyValueList.
Returns
0 on success, 1 if key not found or an error occurred.

Referenced by OTF_KeyValueList_appendByteArray().

OTF_KeyValueList* OTF_KeyValueList_new ( void  )

Create a new OTF_KeyValueList instance.

Returns
Initialized OTF_KeyValueList instance or NULL if an error occurred.

References OTF_KeyValueList_close(), and OTF_KeyValueList_realloc().

Referenced by OTF_RBuffer_open(), and OTF_RBuffer_open_with_external_buffer().

uint8_t OTF_KeyValueList_realloc ( OTF_KeyValueList list,
uint32_t  num 
)

Expand an OTF_KeyValueList by allocating more memory.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
numNumber of elements for which memory should be allocated.
Returns
0 on success, 1 if an error occurs

Referenced by OTF_KeyValueList_new().

uint8_t OTF_KeyValueList_removeKey ( OTF_KeyValueList list,
uint32_t  key 
)

Remove key from the given OTF_KeyValueList instance.

Parameters
listPointer to an initialized OTF_KeyValueList object. See also OTF_KeyValueList_new().
keyToken that shall be removed from the OTF_KeyValueList.
Returns
0 on success, 1 if key not found or an error occurred.