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.

34 lines
1.1 KiB

  1. //--------------------------------------------------------------------
  2. // An example of how to create a wrapper for CLKRHashTable
  3. //--------------------------------------------------------------------
  4. #include <lkrhash.h>
  5. #ifndef __LKRHASH_NO_NAMESPACE__
  6. #define LKRHASH_NS LKRhash
  7. // using namespace LKRhash;
  8. #else // __LKRHASH_NO_NAMESPACE__
  9. #define LKRHASH_NS
  10. #endif // __LKRHASH_NO_NAMESPACE__
  11. #ifndef __HASHFN_NO_NAMESPACE__
  12. #define HASHFN_NS HashFn
  13. // using namespace HashFn;
  14. #else // __HASHFN_NO_NAMESPACE__
  15. #define HASHFN_NS
  16. #endif // __HASHFN_NO_NAMESPACE__
  17. class CNumberTestHashTable
  18. : public LKRHASH_NS::CTypedHashTable<CNumberTestHashTable, int, int>
  19. {
  20. public:
  21. CNumberTestHashTable()
  22. : LKRHASH_NS::CTypedHashTable<CNumberTestHashTable, int, int>(
  23. "NumberSet") {}
  24. static int ExtractKey(const int* pn) {return (int) (DWORD_PTR) pn;}
  25. static DWORD CalcKeyHash(int nKey) {return nKey;}
  26. static bool EqualKeys(int nKey1, int nKey2) {return nKey1 == nKey2;}
  27. static void AddRefRecord(const int* pn, LK_ADDREF_REASON lkar) {}
  28. };