Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
1.2 KiB

/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
htable.h
Abstract:
Handle table
Author:
Erez Haba (erezh) 10-Mar-97
Revision History:
--*/
#ifndef __HTABLE_H
#define __HTABLE_H
//---------------------------------------------------------
//
// class CHTable
//
//---------------------------------------------------------
class CHTable {
enum {
GrowSize = 16, // N.B. must be a power of 2
ShrinkSize = 24 // N.B. must be greater than GrowSize
};
public:
CHTable();
~CHTable();
HACCursor32 CreateHandle(PVOID Object);
PVOID ReferenceObject(HACCursor32 Handle);
PVOID CloseHandle(HACCursor32 Handle);
private:
void Grow();
void Shrink();
void Reallocate(ULONG nObjects);
private:
ULONG m_nObjects;
ULONG m_ixTop;
PVOID* m_pObjects;
};
//---------------------------------------------------------
//
// IMPLEMENTATION
//
//---------------------------------------------------------
inline CHTable::CHTable() :
m_nObjects(0),
m_ixTop(0),
m_pObjects(0)
{
}
inline CHTable::~CHTable()
{
ASSERT(m_ixTop == 0);
delete[] m_pObjects;
}
#endif // __HTABLE_H