[open]lipc
Open-source LIPC header file
|
Hash-array data structure. More...
Typedefs | |
typedef void | LIPCha |
Enumerations | |
enum | LIPCHasharrayType { LIPC_HASHARRAY_INT = 0, LIPC_HASHARRAY_STRING = 1, LIPC_HASHARRAY_BLOB = 2 } |
Functions | |
LIPCha * | LipcHasharrayNew (LIPC *lipc) |
LIPCcode | LipcHasharrayFree (LIPCha *ha, int destroy) |
LIPCcode | LipcHasharrayDestroy (LIPCha *ha) |
int | LipcHasharrayGetHashCount (LIPCha *ha) |
LIPCcode | LipcHasharrayAddHash (LIPCha *ha, size_t *index) |
LIPCcode | LipcHasharrayKeys (LIPCha *ha, int index, const char *keys[], size_t *count) |
LIPCcode | LipcHasharrayCheckKey (LIPCha *ha, int index, const char *key, LIPCHasharrayType *type, size_t *size) |
LIPCcode | LipcHasharrayGetInt (LIPCha *ha, int index, const char *key, int *value) |
LIPCcode | LipcHasharrayPutInt (LIPCha *ha, int index, const char *key, int value) |
LIPCcode | LipcHasharrayGetString (LIPCha *ha, int index, const char *key, char **value) |
LIPCcode | LipcHasharrayPutString (LIPCha *ha, int index, const char *key, const char *value) |
LIPCcode | LipcHasharrayGetBlob (LIPCha *ha, int index, const char *key, unsigned char *data[], size_t *size) |
LIPCcode | LipcHasharrayPutBlob (LIPCha *ha, int index, const char *key, const unsigned char *data, size_t size) |
LIPCcode | LipcHasharrayCopy (LIPCha *dest, const LIPCha *src) |
LIPCcode | LipcHasharrayCopyHash (LIPCha *dest, int dest_index, const LIPCha *src, int src_index) |
LIPCha * | LipcHasharrayClone (const LIPCha *ha) |
LIPCcode | LipcHasharraySave (const LIPCha *ha, int fd) |
LIPCha * | LipcHasharrayRestore (LIPC *lipc, int fd) |
LIPCcode | LipcHasharrayToString (const LIPCha *ha, char *str, size_t *size) |
Hash-array data structure.
typedef void LIPCha |
LIPC hash-array handler.
enum LIPCHasharrayType |
Possible data types, which can be stored in the value of the hash component in the hash-array data structure.
Initialize new hash-array data structure.
lipc | LIPC library handler. |
Free resources associated with the hash-array handler.
ha | The LIPC hash-array handler. |
destroy | If TRUE, the underlying shared memory segment will be marked to be destroyed. |
Free resources associated with the hash-array handler.
This function is an equivalent of calling the LipcHasharrayFree() function with the destroy parameter set to TRUE.
ha | The LIPC hash-array handler. |
int LipcHasharrayGetHashCount | ( | LIPCha * | ha | ) |
Get the number of elements in the array component of the hash-array data structure.
ha | The LIPC hash-array handler. |
Append new hash map to the hash-array structure.
ha | The LIPC hash-array handler. |
index | The address where the index of newly added hash map (hence, the size of the array) will be stored. |
Get keys stored in the hash map of the hash-array data structure.
In order to determine the number of keys at the given index, one should call this function with the count parameter initialized to 0. The number of available keys will be returned back in this parameter - in fact the count parameter is always modified, and the number of keys is returned in it (be careful when reusing this variable for iteration over keys array).
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
keys | The array which can store up to the count number of string pointers - keys. |
count | The address where the number of keys to fetch is given. |
LIPCcode LipcHasharrayCheckKey | ( | LIPCha * | ha, |
int | index, | ||
const char * | key, | ||
LIPCHasharrayType * | type, | ||
size_t * | size | ||
) |
Get the data type stored in the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to check. |
type | The address where the data type will be stored. |
size | The address where the size of the value will be stored. |
Get the integer value form the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to get. |
value | The address where the integer value will be stored. |
Put the integer value into the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to set. |
value | The value to set. |
Get the string value form the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to get. |
value | The address where the pointer to the string will be stored. |
Put the string value into the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to set. |
value | The value to set. |
LIPCcode LipcHasharrayGetBlob | ( | LIPCha * | ha, |
int | index, | ||
const char * | key, | ||
unsigned char * | data[], | ||
size_t * | size | ||
) |
Get the blob data from the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to get. |
data | The address where the pointer to the data will be stored. |
size | The address where the size of the data will be stored. |
LIPCcode LipcHasharrayPutBlob | ( | LIPCha * | ha, |
int | index, | ||
const char * | key, | ||
const unsigned char * | data, | ||
size_t | size | ||
) |
Put the blob data into the hash map of the hash-array data structure.
ha | The LIPC hash-array handler. |
index | The 0-based index in the array. |
key | The key name to set. |
data | The data to set. |
size | The size of the data. |
Copy a hash-array data structure.
The destination hash-array structure handler has to be initialized with the LipcHasharrayNew() function.
dest | The destination hash-array handler. |
src | The source hash-array handler. |
Copy a single hash map of the hash-array data structure.
The destination hash-array structure handler has to be initialized with the LipcHasharrayNew() function.
dest | The destination hash-array handler. |
dest_index | The index in the destination hash-array structure, where the copied hash map will be placed. |
src | The source hash-array handler. |
src_index | The index within the source hash-array structure, from where the hash map is copied. |
Clone a hash-array data structure.
This function is (almost) an equivalent of calling the LipcHasharrayCopy() function using a newly initialized hash-array handler. However, using this function ensures, that the internal hash-array key and few other internal fields are copied too. The exact meaning of these fields is unknown.
ha | The hash-array handler to the structure which should be cloned. |
Save hash-array memory into the given file descriptor.
ha | The hash-array handler. |
fd | Opened file descriptor with the write permission. |
Restore hash-array form the memory read from the given file descriptor.
lipc | LIPC library handler. |
fd | Opened file descriptor with the read permission. |
Get string representation of the given hash-array.
In order to determine the number of bytes required to store the string representation of the given hash-array data structure, one should call this function with the size parameter initialized to 0. The number of required bytes will be returned back in this parameter - in fact the size parameter is always modified, and the number of required bytes is returned in it (be careful when reusing this variable).
ha | The hash-array handler. |
str | The pointer to the address, where the hash-array string representation will be stored. |
size | The pointer to the address, where the size of the str buffer is passed. On return, the number of actually used bytes will be stored at this address. |