diff options
Diffstat (limited to 'include/BH/Hashmap.h')
| -rw-r--r-- | include/BH/Hashmap.h | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/include/BH/Hashmap.h b/include/BH/Hashmap.h index 615e747..57d04fc 100644 --- a/include/BH/Hashmap.h +++ b/include/BH/Hashmap.h @@ -9,12 +9,12 @@ typedef struct BH_Hashmap BH_Hashmap; /** - * Creates the new hashmap handle. + * Creates the new hashmap with specified \a equal and \a hash callbacks. * * \param equal Comparision function * \param hash Key hash function * - * \return On success, returns hashmap handle. + * \return On success, returns hashmap pointer. * \return On failure, returns a null pointer. */ BH_Hashmap *BH_HashmapNew(BH_EqualCallback equal, @@ -22,34 +22,34 @@ BH_Hashmap *BH_HashmapNew(BH_EqualCallback equal, /** - * Destroys the hashmap. + * Destroys the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer */ void BH_HashmapFree(BH_Hashmap *hashmap); /** - * Clears the hashmap. + * Clears the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer */ void BH_HashmapClear(BH_Hashmap *hashmap); /** - * Reserves space in the hashmap. + * Reserves space for \a size amount of elements in the \a hashmap. * * This function can both expand and shrink the available space in hashmap. * This function takes into account current hashmap load factor. * - * \param hashmap Hahsmap handle + * \param hashmap Hahsmap pointer * \param size Capacity * * \note Calling this function will invalidate iterators. * \note Actual hashmap capacity can be bigger then requested. * - * \return On success, returns zero value. + * \return On success, returns zero. * \return On failure, returns error code. */ int BH_HashmapReserve(BH_Hashmap *hashmap, @@ -57,16 +57,16 @@ int BH_HashmapReserve(BH_Hashmap *hashmap, /** - * Inserts the pair of key-value into the hashmap. + * Inserts the pair \a key \a value pair into the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param key Key * \param value Value * * \note This function allows duplicates to be inserted. * \note Calling this function will invalidate iterators. * - * \return On success, returns zero value. + * \return On success, returns zero. * \return On failure, returns error code. */ int BH_HashmapInsert(BH_Hashmap *hashmap, @@ -75,9 +75,9 @@ int BH_HashmapInsert(BH_Hashmap *hashmap, /** - * Removes value from the hashmap. + * Removes value from the \a hashmap by \a key. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param key Key * * \note Calling this function will invalidate iterators. @@ -89,13 +89,13 @@ void BH_HashmapRemove(BH_Hashmap *hashmap, /** - * Returns value from the hashmap by key. + * Returns \a value from the \a hashmap by \a key. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param key Key * \param value Value (optional) * - * \return On success, returns zero value. + * \return On success, returns zero. * \return On failure, returns error code. */ int BH_HashmapAt(BH_Hashmap *hashmap, @@ -104,20 +104,20 @@ int BH_HashmapAt(BH_Hashmap *hashmap, /** - * Checks if the hashmap is empty. + * Checks if the \a hashmap is empty. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * * \return If hashmap is empty, returns non-zero value - * \return If hashmap is not empty, returns zero value + * \return If hashmap is not empty, returns zero */ int BH_HashmapEmpty(BH_Hashmap *hashmap); /** - * Returns the size of the hashmap. + * Returns the size of the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * * \return Returns the size of the hashmap. */ @@ -125,9 +125,9 @@ size_t BH_HashmapSize(BH_Hashmap *hashmap); /** - * Returns the capacity of the hashmap. + * Returns the capacity of the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * * \return Returns the capacity of the hashmap. */ @@ -135,9 +135,9 @@ size_t BH_HashmapCapacity(BH_Hashmap *hashmap); /** - * Returns the load factor of the hashmap. + * Returns the load factor of the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * * \return Returns the load factor of the hashmap. */ @@ -145,9 +145,9 @@ float BH_HashmapFactor(BH_Hashmap *hashmap); /** - * Sets the load factor of the hashmap. + * Sets the load \a factor of the \a hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param factor Load factor * * \note New load factor will be applied on the next reserve/insert operation. @@ -157,9 +157,9 @@ void BH_HashmapSetFactor(BH_Hashmap *hashmap, /** - * Returns the iterator to the element in the hashmap with specified key. + * Returns the iterator to the element in the \a hashmap by \a key. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param iter Iterator * * \return On success, returns iterator value. @@ -173,12 +173,12 @@ void *BH_HashmapIterAt(BH_Hashmap *hashmap, /** - * Returns the iterator to the next element in the hashmap. + * Returns next element \a iter in the \a hashmap. * - * If the iterator is NULL pointer, this function will return iterator to the + * If \a iter is NULL pointer, then this function will return iter to the * first element of the hashmap. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param iter Iterator * * \return On success, returns new iterator value for the next element. @@ -189,9 +189,9 @@ void *BH_HashmapIterNext(BH_Hashmap *hashmap, /** - * Removes value from the hashmap pointed by by iterator. + * Removes key-value from the \a hashmap pointed by \a iter. * - * \param hashmap Hashmap handle + * \param hashmap Hashmap pointer * \param iter Iterator * * \note Calling this function will invalidate iterators. @@ -201,7 +201,7 @@ void BH_HashmapIterRemove(BH_Hashmap *hashmap, /** - * Returns key, pointed by the iterator. + * Returns key, pointed by the \a iter. * * \param iter Iterator * @@ -211,7 +211,7 @@ void *BH_HashmapIterKey(void *iter); /** - * Returns value, pointed by the iterator. + * Returns value, pointed by the \a iter. * * \param iter Iterator * @@ -221,3 +221,4 @@ void *BH_HashmapIterValue(void *iter); #endif /* BH_HASHMAP_H */ + |
