Added a binary tree implementation

Added a splay tree implementation
Added a hash table implementation

svn path=/trunk/; revision=2766
This commit is contained in:
Casper Hornstrup
2002-03-22 20:58:23 +00:00
parent be5628fdc9
commit c08aa00a0e
8 changed files with 1942 additions and 4 deletions
+79
View File
@@ -820,4 +820,83 @@ ExHookException (
unsigned int exp
);
/* BEGIN REACTOS ONLY */
BOOLEAN STDCALL
ExInitializeBinaryTree(IN PBINARY_TREE Tree,
IN PKEY_COMPARATOR Compare);
VOID STDCALL
ExDeleteBinaryTree(IN PBINARY_TREE Tree);
VOID STDCALL
ExInsertBinaryTree(IN PBINARY_TREE Tree,
IN PVOID Key,
IN PVOID Value);
BOOLEAN STDCALL
ExSearchBinaryTree(IN PBINARY_TREE Tree,
IN PVOID Key,
OUT PVOID * Value);
BOOLEAN STDCALL
ExRemoveBinaryTree(IN PBINARY_TREE Tree,
IN PVOID Key,
IN PVOID * Value);
BOOLEAN STDCALL
ExInitializeSplayTree(IN PSPLAY_TREE Tree,
IN PKEY_COMPARATOR Compare,
IN BOOLEAN Weighted);
VOID STDCALL
ExDeleteSplayTree(IN PSPLAY_TREE Tree);
VOID STDCALL
ExInsertSplayTree(IN PSPLAY_TREE Tree,
IN PVOID Key,
IN PVOID Value);
BOOLEAN STDCALL
ExSearchSplayTree(IN PSPLAY_TREE Tree,
IN PVOID Key,
OUT PVOID * Value);
BOOLEAN STDCALL
ExRemoveSplayTree(IN PSPLAY_TREE Tree,
IN PVOID Key,
IN PVOID * Value);
BOOLEAN STDCALL
ExWeightOfSplayTree(IN PSPLAY_TREE Tree,
OUT PULONG Weight);
BOOLEAN STDCALL
ExInitializeHashTable(IN PHASH_TABLE HashTable,
IN ULONG HashTableSize,
IN PKEY_COMPARATOR Compare OPTIONAL);
VOID STDCALL
ExDeleteHashTable(IN PHASH_TABLE HashTable);
VOID STDCALL
ExInsertHashTable(IN PHASH_TABLE HashTable,
IN PVOID Key,
IN ULONG KeyLength,
IN PVOID Value);
BOOLEAN STDCALL
ExSearchHashTable(IN PHASH_TABLE HashTable,
IN PVOID Key,
IN ULONG KeyLength,
OUT PVOID * Value);
BOOLEAN STDCALL
ExRemoveHashTable(IN PHASH_TABLE HashTable,
IN PVOID Key,
IN ULONG KeyLength,
IN PVOID * Value);
/* END REACTOS ONLY */
#endif /* ndef _NTOS_EXFUNCS_H */
+44 -1
View File
@@ -1,4 +1,4 @@
/* $Id: extypes.h,v 1.6 2001/08/30 23:50:53 ekohl Exp $ */
/* $Id: extypes.h,v 1.7 2002/03/22 20:58:23 chorns Exp $ */
#ifndef __INCLUDE_DDK_EXTYPES_H
#define __INCLUDE_DDK_EXTYPES_H
@@ -158,6 +158,49 @@ typedef VOID STDCALL
PVOID Argument1,
PVOID Argument2);
/* BEGIN REACTOS ONLY */
typedef LONG STDCALL (*PKEY_COMPARATOR)(PVOID Key1,
PVOID Key2);
struct _BINARY_TREE_NODE;
typedef struct _BINARY_TREE
{
struct _BINARY_TREE_NODE * RootNode;
PKEY_COMPARATOR Compare;
PAGED_LOOKASIDE_LIST LookasideList;
FAST_MUTEX Lock;
} BINARY_TREE, *PBINARY_TREE;
struct _SPLAY_TREE_NODE;
typedef struct _SPLAY_TREE
{
struct _SPLAY_TREE_NODE * RootNode;
PKEY_COMPARATOR Compare;
BOOLEAN Weighted;
PAGED_LOOKASIDE_LIST LookasideList;
FAST_MUTEX Lock;
PVOID Reserved[4];
} SPLAY_TREE, *PSPLAY_TREE;
typedef struct _HASH_TABLE
{
// Lock for this structure
FAST_MUTEX Lock;
// Size of hash table in number of bits
ULONG HashTableSize;
// Pointer to array of hash buckets with splay trees
PSPLAY_TREE HashTrees;
} HASH_TABLE, *PHASH_TABLE;
/* END REACTOS ONLY */
#endif /* __INCLUDE_DDK_EXTYPES_H */
/* EOF */