the_Foundation 1.0
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
hash.h File Reference
#include "defs.h"
#include "class.h"

Data Structures

struct  iHash
 
struct  iHashNode
 Base class for nodes inserted into the hash. More...
 
struct  iHashReverseIterator
 
struct  iHashReverseConstIterator
 

Typedefs

typedef struct Impl_HashBucket iHashBucket
 
typedef uint32_t iHashKey
 
typedef void iAnyNode
 

Functions

iHash * new_Hash (void)
 
void delete_Hash (iHash *)
 
void init_Hash (iHash *)
 
void deinit_Hash (iHash *)
 
iBool contains_Hash (const iHash *, iHashKey key)
 
iHashNode * value_Hash (const iHash *, iHashKey key)
 
void clear_Hash (iHash *)
 
iHashNode * insert_Hash (iHash *, iHashNode *node)
 
iHashNode * remove_Hash (iHash *, iHashKey key)
 
Iterators
void init_HashIterator (iHashIterator *, iHash *)
 
void next_HashIterator (iHashIterator *)
 
void init_HashReverseIterator (iHashReverseIterator *, iHash *)
 
void next_HashReverseIterator (iHashReverseIterator *)
 
iHashNode * remove_HashIterator (iHashIterator *d)
 
void init_HashConstIterator (iHashConstIterator *, const iHash *)
 
void next_HashConstIterator (iHashConstIterator *)
 
void init_HashReverseConstIterator (iHashReverseConstIterator *, const iHash *)
 
void next_HashReverseConstIterator (iHashReverseConstIterator *)
 

Detailed Description

Hash of unsorted unique integer keys.

Authors
Copyright (c) 2017 Jaakko Keränen jaakk.nosp@m.o.ke.nosp@m.ranen.nosp@m.@iki.nosp@m..fi
License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ insert_Hash()

iHashNode * insert_Hash ( iHash * ,
iHashNode * node )

Inserts a node into the hash.

Parameters
nodeNode to be inserted. Ownership not taken. The key member must be set to a valid hash key.
Returns
Previous node with the same key that had to be removed from the hash to make room for the new nodes. The caller should delete the node or take any other necessary actions, since it is no longer part of the hash.