Main Page   Data Structures   File List   Data Fields   Globals  

mperfl.c File Reference

#include "mperfl.h"
#include <math.h>
#include <limits.h>
#include <assert.h>

Functions

MPerfmperf_ctor (MPerf *mp)
void add_key (SSizedKeys *keys, KeyString *key)
MPerfmperf_init (MPerf *mp, KeyString *keys, size_t keyNo)
void normalize_probs (SSizedKeys *keys)
size_t find_discriminator (SSizedKeys *keys, size_t keyLen)
int finalize_node (Node *node, size_t len)
int mperf_finish (MPerf *mp)
KeyStringmperf_find (MPerf *mp, const char *key, size_t keyLen)
KeyStringmperf_search (MPerf *mp, const char *key, size_t keyLen)
int for_all_key_nodes (Node *node, int(*fnctn)(KeyString *, void *), void *data)
int mperf_for_all (MPerf *mp, int(*fnctn)(KeyString *, void *), void *data)

Function Documentation

void add_key ( SSizedKeys * keys,
KeyString * key )
 

int finalize_node ( Node * node,
size_t len ) [static]
 

size_t find_discriminator ( SSizedKeys * keys,
size_t keyLen ) [static]
 

int for_all_key_nodes ( Node * node,
int(* fnctn)(KeyString *, void *),
void * data ) [static]
 

MPerf * mperf_ctor ( MPerf * mp )
 

Initialize an MPerf. If you pass NULL, memory will be malloc()'ed for an MPerf.

KeyString * mperf_find ( MPerf * mp,
const char * key,
size_t keyLen )
 

Use this function, I you're 100% sure, that the key will be found in the MPerf. This is fatser than mperf_search().

int mperf_finish ( MPerf * mp )
 

Finish an initalized MPerf. After finishing it, you may search it for keys.

int mperf_for_all ( MPerf * mp,
int(* fnctn)(KeyString *, void *),
void * data )
 

Let's you apply the function `fnctn' to all KeyStrings. `data' is passed as the second parameter to `fnctn'.

MPerf * mperf_init ( MPerf * mp,
KeyString * keys,
size_t keyNo )
 

Set the probabilities, keys and the associated data. After calling this you MPerf won't work, yet. You'll have to call mperf_finish() * first.

KeyString * mperf_search ( MPerf * mp,
const char * key,
size_t keyLen )
 

Use this function, if it's possible that the key is not in the MPerf. This will take the time for a final memcmp().

void normalize_probs ( SSizedKeys * keys ) [static]
 


Generated at Wed Oct 9 23:29:05 2002 for mperf by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001