3 * Copyright (C) 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS system libraries
23 * PURPOSE: Generic Table Implementation
24 * FILE: lib/rtl/genertictbl.c
32 /* FUNCTIONS *****************************************************************/
39 RtlDeleteElementGenericTable (
40 PRTL_GENERIC_TABLE Table
,
53 RtlDeleteElementGenericTableAvl (
67 RtlEnumerateGenericTable (
68 PRTL_GENERIC_TABLE Table
,
81 RtlEnumerateGenericTableAvl (
95 RtlEnumerateGenericTableLikeADirectory (
96 IN PRTL_AVL_TABLE Table
,
97 IN PRTL_AVL_MATCH_FUNCTION MatchFunction
,
100 IN OUT PVOID
*RestartKey
,
101 IN OUT PULONG DeleteCount
,
114 RtlEnumerateGenericTableWithoutSplaying (
115 PRTL_GENERIC_TABLE Table
,
128 RtlEnumerateGenericTableWithoutSplayingAvl (
129 PRTL_AVL_TABLE Table
,
142 RtlGetElementGenericTable(
143 PRTL_GENERIC_TABLE Table
,
156 RtlGetElementGenericTableAvl (
157 PRTL_AVL_TABLE Table
,
170 RtlInitializeGenericTable (
171 PRTL_GENERIC_TABLE Table
,
172 PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine
,
173 PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine
,
174 PRTL_GENERIC_FREE_ROUTINE FreeRoutine
,
186 RtlInitializeGenericTableAvl(IN OUT PRTL_AVL_TABLE Table
,
187 IN PRTL_AVL_COMPARE_ROUTINE CompareRoutine
,
188 IN PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine
,
189 IN PRTL_AVL_FREE_ROUTINE FreeRoutine
,
190 IN PVOID TableContext
)
193 sizeof(RTL_AVL_TABLE
));
194 Table
->BalancedRoot
.Parent
= &Table
->BalancedRoot
;
196 Table
->CompareRoutine
= CompareRoutine
;
197 Table
->AllocateRoutine
= AllocateRoutine
;
198 Table
->FreeRoutine
= FreeRoutine
;
199 Table
->TableContext
= TableContext
;
208 RtlInsertElementGenericTable (
209 PRTL_GENERIC_TABLE Table
,
212 PBOOLEAN NewElement OPTIONAL
224 RtlInsertElementGenericTableAvl (
225 PRTL_AVL_TABLE Table
,
228 PBOOLEAN NewElement OPTIONAL
240 RtlInsertElementGenericTableFull (
241 PRTL_GENERIC_TABLE Table
,
244 PBOOLEAN NewElement OPTIONAL
,
246 TABLE_SEARCH_RESULT SearchResult
258 RtlInsertElementGenericTableFullAvl (
259 PRTL_AVL_TABLE Table
,
262 PBOOLEAN NewElement OPTIONAL
,
264 TABLE_SEARCH_RESULT SearchResult
277 RtlIsGenericTableEmpty (
278 PRTL_GENERIC_TABLE Table
290 RtlIsGenericTableEmptyAvl (
304 RtlLookupElementGenericTable (
305 PRTL_GENERIC_TABLE Table
,
318 RtlLookupElementGenericTableAvl (
319 PRTL_AVL_TABLE Table
,
332 RtlLookupElementGenericTableFull (
333 PRTL_GENERIC_TABLE Table
,
335 OUT PVOID
*NodeOrParent
,
336 OUT TABLE_SEARCH_RESULT
*SearchResult
348 RtlLookupElementGenericTableFullAvl (
349 PRTL_AVL_TABLE Table
,
351 OUT PVOID
*NodeOrParent
,
352 OUT TABLE_SEARCH_RESULT
*SearchResult
364 RtlNumberGenericTableElements(IN PRTL_GENERIC_TABLE Table
)
366 return Table
->NumberGenericTableElements
;
374 RtlNumberGenericTableElementsAvl(IN PRTL_AVL_TABLE Table
)
376 return Table
->NumberGenericTableElements
;