Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

hashlist.c File Reference


Detailed Description

Needs brief description here.

An hashlist is a dual structure where data are both stored in a two-way list, preserving ordering, and indexed in a hash table.

This structure can quickly determine whether it contains some piece of data, as well as quickly remove data. It can be iterated over, in the order of the items or in reverse order.

Author:
Christian Biere
Date:
2003

#include "common.h"
#include "hashlist.h"
#include "misc.h"
#include "glib-missing.h"
#include "walloc.h"
#include "override.h"

Data Structures

struct  hash_list
struct  hash_list_iter

Defines

#define equiv(p, q)   (!(p) == !(q))
#define hash_list_regression(hl)

Enumerations

enum  hash_list_magic_t { HASH_LIST_MAGIC = 0x338954fdU }
enum  hash_list_iter_magic_t { HASH_LIST_ITER_MAGIC = 0x438954efU }

Functions

 RCSID ("$Id:hashlist.c, v 1.14 2005/06/29 14:24:26 daichik Exp $")
hash_list_thash_list_new (void)
 Create a new hash list.

void hash_list_free (hash_list_t *hl)
 Dispose of the data structure, but not of the items it holds.

gboolean hash_list_rt (gpointer uu_key, gpointer uu_value, gpointer uu_udata)
 Hash table removal iterator -- always returns TRUE.

void hash_list_clear (hash_list_t *hl)
 Clear the structure.

void hash_list_append (hash_list_t *hl, gpointer data)
 Append `data' to the list.

void hash_list_prepend (hash_list_t *hl, gpointer data)
 Prepend `data' to the list.

void hash_list_remove (hash_list_t *hl, gpointer data)
 Remove `data' from the list.

gpointer hash_list_last (const hash_list_t *hl)
gpointer hash_list_first (const hash_list_t *hl)
gint hash_list_length (const hash_list_t *hl)
hash_list_iter_thash_list_iterator (hash_list_t *hl)
 Get an iterator on the list, positionned before first item.

hash_list_iter_thash_list_iterator_last (hash_list_t *hl)
 Get an iterator on the list, positionned after last item.

gpointer hash_list_next (hash_list_iter_t *i)
 Get the next data item from the iterator, or NULL if none.

gboolean hash_list_has_next (const hash_list_iter_t *i)
 Checks whether there is a next item to be iterated over.

gpointer hash_list_previous (hash_list_iter_t *i)
 Get the previous data item from the iterator, or NULL if none.

gboolean hash_list_has_previous (const hash_list_iter_t *i)
 Checks whether there is a previous item in the iterator.

gpointer hash_list_follower (hash_list_iter_t *i)
 Move to next item in the direction of the iterator.

gboolean hash_list_has_follower (const hash_list_iter_t *i)
 Checks whether there is a following item in the iterator, in the direction chosen at creation time.

void hash_list_release (hash_list_iter_t *i)
 Release the iterator once we're done with it.

gboolean hash_list_contains (hash_list_t *hl, gpointer data)
 Check whether hashlist contains the `data'.

void hash_list_foreach (const hash_list_t *hl, GFunc func, gpointer user_data)
 Apply `func' to all the items in the structure.


Define Documentation

#define equiv p,
 )     (!(p) == !(q))
 

#define hash_list_regression hl   ) 
 


Enumeration Type Documentation

enum hash_list_iter_magic_t
 

Enumeration values:
HASH_LIST_ITER_MAGIC 

enum hash_list_magic_t
 

Enumeration values:
HASH_LIST_MAGIC 


Function Documentation

void hash_list_append hash_list_t hl,
gpointer  data
 

Append `data' to the list.

void hash_list_clear hash_list_t hl  ) 
 

Clear the structure.

Items are simply de-referenced, not freed.

gboolean hash_list_contains hash_list_t hl,
gpointer  data
 

Check whether hashlist contains the `data'.

gpointer hash_list_first const hash_list_t hl  ) 
 

Returns:
the first item of the list, or NULL if none.

gpointer hash_list_follower hash_list_iter_t i  ) 
 

Move to next item in the direction of the iterator.

void hash_list_foreach const hash_list_t hl,
GFunc  func,
gpointer  user_data
 

Apply `func' to all the items in the structure.

void hash_list_free hash_list_t hl  ) 
 

Dispose of the data structure, but not of the items it holds.

gboolean hash_list_has_follower const hash_list_iter_t i  ) 
 

Checks whether there is a following item in the iterator, in the direction chosen at creation time.

gboolean hash_list_has_next const hash_list_iter_t i  ) 
 

Checks whether there is a next item to be iterated over.

gboolean hash_list_has_previous const hash_list_iter_t i  ) 
 

Checks whether there is a previous item in the iterator.

hash_list_iter_t* hash_list_iterator hash_list_t hl  ) 
 

Get an iterator on the list, positionned before first item.

Get items with hash_list_next().

hash_list_iter_t* hash_list_iterator_last hash_list_t hl  ) 
 

Get an iterator on the list, positionned after last item.

Get items with hash_list_previous().

gpointer hash_list_last const hash_list_t hl  ) 
 

Returns:
the last item of the list, or NULL if none.

gint hash_list_length const hash_list_t hl  ) 
 

Returns:
the length of the list.

hash_list_t* hash_list_new void   ) 
 

Create a new hash list.

gpointer hash_list_next hash_list_iter_t i  ) 
 

Get the next data item from the iterator, or NULL if none.

void hash_list_prepend hash_list_t hl,
gpointer  data
 

Prepend `data' to the list.

gpointer hash_list_previous hash_list_iter_t i  ) 
 

Get the previous data item from the iterator, or NULL if none.

void hash_list_release hash_list_iter_t i  ) 
 

Release the iterator once we're done with it.

void hash_list_remove hash_list_t hl,
gpointer  data
 

Remove `data' from the list.

gboolean hash_list_rt gpointer  uu_key,
gpointer  uu_value,
gpointer  uu_udata
[static]
 

Hash table removal iterator -- always returns TRUE.

RCSID "$Id:hashlist.  c,
v 1.14 2005/06/29 14:24:26 daichik Exp $" 
 


Generated on Sun Feb 12 10:50:02 2006 for Gtk-Gnutella by doxygen 1.3.6