Fix header name.
[bertos.git] / mware / hashtable.h
index bbe100a3dffc541b9341369dd00890238b2ca0cb..c6da451a7e88084ca1389bbb2b985d9d0e677fbc 100755 (executable)
@@ -1,8 +1,8 @@
 /*!
  * \file
  * <!--
- * Copyright (C) 2004 Giovanni Bajo
- * Copyright (C) 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2004 Giovanni Bajo
  * All Rights Reserved.
  * -->
  *
  * \author Giovanni Bajo <rasky@develer.com>
  */
 
-/*
- * $Log$
- * Revision 1.1  2004/07/14 14:08:16  rasky
- * Implementazione di una tabella hash
- *
- * Revision 1.10  2004/06/14 15:17:15  rasky
- * Qualche fix alla documentazione Doxygen
- *
- * Revision 1.9  2004/06/14 15:15:24  rasky
- * Cambiato key_data in un union invece di castare
- * Aggiunto un ASSERT sull'indice calcolata nella key_internal_get_ptr
- *
- * Revision 1.8  2004/06/14 14:59:40  rasky
- * Rinominanta la macro di configurazione per rispettare il namespace, e aggiunta in un punto in cui mancava
- *
- * Revision 1.7  2004/06/12 15:18:05  rasky
- * Nuova hashtable con chiave esterna o interna a scelta, come discusso
- *
- * Revision 1.6  2004/05/26 16:33:31  rasky
- * Aggiunta interfaccia per visita della hashtable tramite iteratori
- *
- * Revision 1.5  2004/05/24 18:42:23  rasky
- * Fixato un commento doxygen
- *
- * Revision 1.4  2004/05/24 15:28:20  rasky
- * Sistemata la documentazione, rimossa keycmp in favore della memcmp
- *
- */
+/*#*
+ *#* $Log$
+ *#* Revision 1.6  2005/04/11 19:10:28  bernie
+ *#* Include top-level headers from cfg/ subdir.
+ *#*
+ *#* Revision 1.5  2004/10/03 20:43:22  bernie
+ *#* Import changes from sc/firmware.
+ *#*
+ *#* Revision 1.9  2004/06/14 15:15:24  rasky
+ *#* Cambiato key_data in un union invece di castare
+ *#* Aggiunto un ASSERT sull'indice calcolata nella key_internal_get_ptr
+ *#*
+ *#* Revision 1.8  2004/06/14 14:59:40  rasky
+ *#* Rinominanta la macro di configurazione per rispettare il namespace, e aggiunta in un punto in cui mancava
+ *#*
+ *#* Revision 1.7  2004/06/12 15:18:05  rasky
+ *#* Nuova hashtable con chiave esterna o interna a scelta, come discusso
+ *#*
+ *#* Revision 1.6  2004/05/26 16:33:31  rasky
+ *#* Aggiunta interfaccia per visita della hashtable tramite iteratori
+ *#*
+ *#* Revision 1.5  2004/05/24 18:42:23  rasky
+ *#* Fixato un commento doxygen
+ *#*
+ *#* Revision 1.4  2004/05/24 15:28:20  rasky
+ *#* Sistemata la documentazione, rimossa keycmp in favore della memcmp
+ *#*/
 
+#ifndef MWARE_HASHTABLE_H
+#define MWARE_HASHTABLE_H
 
-#ifndef HASHTABLE_H
-#define HASHTABLE_H
+#include <cfg/compiler.h>
+#include <cfg/macros.h>
+#include <cfg/debug.h>
 
-#include <compiler.h>
-#include <kdebug.h>
-
-/*! Enable/disable support to declare special hash tables which maintain a copy of
- *  the key internally instead of relying on the hook to extract it from the data.
+/*!
+ * Enable/disable support to declare special hash tables which maintain a copy of
+ * the key internally instead of relying on the hook to extract it from the data.
  */
 #define CONFIG_HT_OPTIONAL_INTERNAL_KEY      1
 
 //! Maximum length of the internal key (use (2^n)-1 for slight speedup)
 #define INTERNAL_KEY_MAX_LENGTH     15
 
-/*! Hook to get the key from \a data, which is an element of the hash table. The
- *  key must be returned together with \a key_length (in words).
+/*!
+ * Hook to get the key from \a data, which is an element of the hash table. The
+ * key must be returned together with \a key_length (in words).
  */
 typedef const void* (*hook_get_key)(const void* data, uint8_t* key_length);
 
-/*! Hash table description
+
+/*!
+ * Hash table description
  *
  * \note This structures MUST NOT be accessed directly. Its definition is
  * provided in the header file only for optimization purposes (see the rationale
  * in hashtable.c).
  *
- * \note If new elements must be added to this list, please double check 
+ * \note If new elements must be added to this list, please double check
  * \c DECLARE_HASHTABLE, which requires the existing elements to be at the top.
  */
 struct HashTable
@@ -100,6 +103,7 @@ struct HashTable
        } key_data;
 };
 
+
 //! Iterator to walk the hash table
 typedef struct
 {
@@ -107,7 +111,9 @@ typedef struct
        const void** end;
 } HashIterator;
 
-/*! Declare a hash table in the current scope
+
+/*!
+ * Declare a hash table in the current scope
  *
  * \param name Variable name
  * \param size Number of elements
@@ -144,7 +150,8 @@ typedef struct
                static struct HashTable name = { name##_nodes, UINT32_LOG2(size), { true }, name##_keys }
 #endif
 
-/*! Initialize (and clear) a hash table in a memory buffer.
+/*!
+ * Initialize (and clear) a hash table in a memory buffer.
  *
  * \param ht Hash table declared with \c DECLARE_HASHTABLE
  *
@@ -154,7 +161,8 @@ typedef struct
  */
 void ht_init(struct HashTable* ht);
 
-/*! Insert an element into the hash table
+/*!
+ * Insert an element into the hash table
  *
  * \param ht Handle of the hash table
  * \param data Data to be inserted into the table
@@ -172,7 +180,8 @@ void ht_init(struct HashTable* ht);
  */
 bool ht_insert(struct HashTable* ht, const void* data);
 
-/*! Insert an element into the hash table
+/*!
+ * Insert an element into the hash table
  *
  * \param ht Handle of the hash table
  * \param key Key of the element
@@ -192,7 +201,8 @@ bool ht_insert(struct HashTable* ht, const void* data);
  */
 bool ht_insert_with_key(struct HashTable* ht, const void* key, uint8_t key_length, const void* data);
 
-/*! Find an element in the hash table
+/*!
+ * Find an element in the hash table
  *
  * \param ht Handle of the hash table
  * \param key Key of the element
@@ -221,11 +231,12 @@ INLINE HashIterator ht_iter_begin(struct HashTable* ht)
        return h;
 }
 
-/*! Get an iterator to the (exclusive) end of the hash table \a ht
+/*!
+ * Get an iterator to the (exclusive) end of the hash table \a ht
  *
- *  \note Like in STL, the end iterator is not a valid iterator (you
- *  cannot call \c ht_iter_get() on it), and it must be used only to
- *  detect if we reached the end of the iteration (through \c ht_iter_cmp()).
+ * \note Like in STL, the end iterator is not a valid iterator (you
+ *       cannot call \c ht_iter_get() on it), and it must be used only to
+ *       detect if we reached the end of the iteration (through \c ht_iter_cmp()).
  */
 INLINE HashIterator ht_iter_end(struct HashTable* ht)
 {
@@ -262,4 +273,4 @@ INLINE HashIterator ht_iter_next(HashIterator h)
        return h;
 }
 
-#endif /* HASHTABLE_H */
+#endif /* MWARE_HASHTABLE_H */