Ignore:
Timestamp:
2011-01-27T22:09:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db7ed07
Parents:
9ee87f6 (diff), 6265a2b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Changes from development branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/hash_table.h

    r9ee87f6 r7fc092a  
    4141typedef unsigned long hash_count_t;
    4242typedef unsigned long hash_index_t;
    43 typedef struct hash_table hash_table_t;
    44 typedef struct hash_table_operations hash_table_operations_t;
     43
     44/** Set of operations for hash table. */
     45typedef struct {
     46        /** Hash function.
     47         *
     48         * @param key Array of keys needed to compute hash index.
     49         *            All keys must be passed.
     50         *
     51         * @return Index into hash table.
     52         *
     53         */
     54        hash_index_t (*hash)(unsigned long key[]);
     55       
     56        /** Hash table item comparison function.
     57         *
     58         * @param key Array of keys that will be compared with item. It is
     59         *            not necessary to pass all keys.
     60         *
     61         * @return True if the keys match, false otherwise.
     62         *
     63         */
     64        int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
     65       
     66        /** Hash table item removal callback.
     67         *
     68         * @param item Item that was removed from the hash table.
     69         *
     70         */
     71        void (*remove_callback)(link_t *item);
     72} hash_table_operations_t;
    4573
    4674/** Hash table structure. */
    47 struct hash_table {
     75typedef struct {
    4876        link_t *entry;
    4977        hash_count_t entries;
    5078        hash_count_t max_keys;
    5179        hash_table_operations_t *op;
    52 };
    53 
    54 /** Set of operations for hash table. */
    55 struct hash_table_operations {
    56         /** Hash function.
    57          *
    58          * @param key   Array of keys needed to compute hash index. All keys
    59          *              must be passed.
    60          *
    61          * @return      Index into hash table.
    62          */
    63         hash_index_t (* hash)(unsigned long key[]);
    64        
    65         /** Hash table item comparison function.
    66          *
    67          * @param key   Array of keys that will be compared with item. It is
    68          *              not necessary to pass all keys.
    69          *
    70          * @return      true if the keys match, false otherwise.
    71          */
    72         int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
    73 
    74         /** Hash table item removal callback.
    75          *
    76          * @param item  Item that was removed from the hash table.
    77          */
    78         void (*remove_callback)(link_t *item);
    79 };
     80} hash_table_t;
    8081
    8182#define hash_table_get_instance(item, type, member) \
Note: See TracChangeset for help on using the changeset viewer.