|
Legofit
infers population history from nucleotide site patterns.
|
Map char* to double. More...
#include "strdblmap.h"#include "error.h"#include "binary.h"#include "misc.h"#include <assert.h>#include <string.h>#include <stdlib.h>#include <sys/errno.h>Data Structures | |
| struct | El |
| A single key-value pair, with a pointer to the next one. More... | |
| struct | StrDblMap |
| The hash table. More... | |
Functions | |
| static int | resize (StrDblMap *self) |
| Double the size of the hash map and rehash. | |
| static El * | El_new (const char *key, double value) |
| Construct a new element with given key and value. | |
| static void | El_free (El *e) |
| Destroy a linked list of El objects. | |
| static El * | El_insert (El *self, const char *key, double value, int *status) |
| Insert a new key/value pair into the linked list. More... | |
| StrDblMap * | StrDblMap_new (int dim) |
| Constructor. | |
| void | StrDblMap_free (StrDblMap *self) |
| Destructor. | |
| double | StrDblMap_get (StrDblMap *self, const char *key, int *status) |
| Get the value associated with key. More... | |
| int | StrDblMap_hasKey (StrDblMap *self, const char *key) |
| Return 1 if key is present in map; 0 otherwise. | |
| int | StrDblMap_insert (StrDblMap *self, const char *key, double value) |
| Insert a value into the table, resizing if necessary. More... | |
| unsigned long | StrDblMap_size (StrDblMap *self) |
| Return the number of elements. | |
| int | StrDblMap_keys (StrDblMap *self, unsigned size, char *keys[size]) |
| Put keys into array "keys". More... | |
Map char* to double.
Insert a new key/value pair into the linked list.
Usage:
El *list=NULL;
int status;
list = El_insert(list, key, value, &status);
if(status != 0)
printf("Error: key is already in list\n");
| self | current element of list | |
| [in] | key,a | pointer |
| [in] | value,another | pointer |
| [out] | status | pointer to int, which will be set to 0 on success or 1 if value is already in list. |
References El_insert(), El_new(), and El::next.
Referenced by El_insert(), and StrDblMap_insert().
| double StrDblMap_get | ( | StrDblMap * | self, |
| const char * | key, | ||
| int * | status | ||
| ) |
| int StrDblMap_insert | ( | StrDblMap * | self, |
| const char * | key, | ||
| double | value | ||
| ) |
Insert a value into the table, resizing if necessary.
References El_insert(), resize(), and strhash().