Coconut Framework  beta
Classes | Macros | Typedefs | Functions
CNHashTable.h File Reference

Define CNHashTable data structure. More...

#include "CNType.h"
#include <stdint.h>

Go to the source code of this file.

Classes

struct  CNHashTableMethods
 Set of methods for item in CNHashTable These functions are called in CNHashTable. More...
 
struct  CNHashTable
 Hash table for any data. More...
 

Macros

#define CNArraySizeOfHashTable   256
 Array size of CNHashTable.
 

Typedefs

typedef uint64_t(* CNCalcHashItemFuncRef )(const void *obj, void *info)
 Function to calc hash value of item in CNHashTable.
 

Functions

void CNInitHashTable (struct CNHashTable *dst, const struct CNHashTableMethods *methods, struct CNResource *resource)
 Initialize CNHashTable. More...
 
void CNDestroyHashTable (struct CNHashTable *dst, void *info)
 Destroy all contexts in CNHashTable. More...
 
const void * CNSearchHashTable (const struct CNHashTable *table, const void *src, void *info)
 Search item in CNHashTable. More...
 
const void * CNAddToHashTable (struct CNHashTable *table, const void *src, void *info)
 Add item to CNHashTable. More...
 

Detailed Description

Define CNHashTable data structure.

Copyright
Copyright (C) 2012 Steel Wheels Project

Function Documentation

void CNInitHashTable ( struct CNHashTable dst,
const struct CNHashTableMethods methods,
struct CNResource *  resource 
)

Initialize CNHashTable.

Parameters
dstDestination hash table
methodsMethods to operate hash items
resourceResource for hash table
void CNDestroyHashTable ( struct CNHashTable dst,
void *  info 
)

Destroy all contexts in CNHashTable.

Parameters
dstDestination hash table
infoUser defined info
const void* CNSearchHashTable ( const struct CNHashTable table,
const void *  src,
void *  info 
)

Search item in CNHashTable.

Return values
objMatched object
NULLThere are no matched object
Parameters
tableHash table
srcSource data to search
infoUser defined info
const void* CNAddToHashTable ( struct CNHashTable table,
const void *  src,
void *  info 
)

Add item to CNHashTable.

Returns
Added item
Parameters
tableDestination table
srcSource item
infoUser defined info