TacOS  0.2
 Tout Structures de données Fichiers Fonctions Variables Définitions de type Énumérations Macros
Fonctions
Référence du fichier hashmap.c
#include <kmalloc.h>
#include <hashmap.h>
Graphe des dépendances par inclusion de hashmap.c:

Fonctions

hashmap_thashmap_create (int size, int(*equal)(struct hashmap_key_t *, struct hashmap_key_t *), int(*hash)(struct hashmap_key_t *))
 
void hashmap_set (hashmap_t *this, struct hashmap_key_t *key, struct hashmap_value_t *value)
 
struct hashmap_value_t * hashmap_remove (hashmap_t *this, struct hashmap_key_t *key)
 
struct hashmap_value_t * hashmap_get (hashmap_t *this, struct hashmap_key_t *key)
 

Description détaillée

Auteur
TacOS developers

LICENSE

Copyright (C) 2010-2014 TacOS developers.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/copyleft/gpl.html

You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses.

DESCRIPTION

Hashmap générique. Des tests un peu plus poussés sont à faire.

Documentation des fonctions

hashmap_t* hashmap_create ( int  size,
int(*)(struct hashmap_key_t *, struct hashmap_key_t *)  equal,
int(*)(struct hashmap_key_t *)  hash 
)

Crée et initialise une nouvelle hashmap.

Paramètres
sizeLa taille de la table, correspond à la valeur maximale - 1 que peut retourner la fonction de hash.
equalFonction qui retourne 1 si 2 clefs sont identiques.
hashFonction de hash.
Renvoie
Pointeur vers la hashmap.

Voici le graphe d'appel pour cette fonction :

Voici le graphe des appelants de cette fonction :

struct hashmap_value_t* hashmap_get ( hashmap_t this,
struct hashmap_key_t *  key 
)

Lit un élément de la hashmap.

Paramètres
thisPointeur vers la hashmap à utiliser.
keyLa clef de l'élément à lire.
Renvoie
Pointeur vers la valeur, NULL si non trouvée.

Voici le graphe des appelants de cette fonction :

struct hashmap_value_t* hashmap_remove ( hashmap_t this,
struct hashmap_key_t *  key 
)

Supprime un élément de la hashmap. Attention, seule la cellule est freed.

Paramètres
thisPointeur vers la hashmap à utiliser.
keyLa clef de l'élément à supprimer.
Renvoie
Pointeur vers la valeur enlevée de la hashmap, NULL si non trouvée.

Voici le graphe d'appel pour cette fonction :

Voici le graphe des appelants de cette fonction :

void hashmap_set ( hashmap_t this,
struct hashmap_key_t *  key,
struct hashmap_value_t *  value 
)

Ajoute ou modifie une valeur dans la hashmap.

Paramètres
thisPointeur vers la hashmap à utiliser.
keyLa clef.
valueLa valeur.

Voici le graphe d'appel pour cette fonction :

Voici le graphe des appelants de cette fonction :