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.

40 lines
873 B

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: ID Generator
  6. File: IdGener.h
  7. Owner: DmitryR
  8. This file contains the declarations for the ID Generator class
  9. ===================================================================*/
  10. #ifndef IDGENER_H
  11. #define IDGENER_H
  12. #define INVALID_ID 0xFFFFFFFF
  13. class CIdGenerator
  14. {
  15. private:
  16. BOOL m_fInited; // Initialized?
  17. CRITICAL_SECTION m_csLock; // Synchronize access
  18. DWORD m_dwStartId; // Starting (seed) Id
  19. DWORD m_dwLastId; // Last Generated Id
  20. public:
  21. CIdGenerator();
  22. ~CIdGenerator();
  23. public:
  24. HRESULT Init();
  25. HRESULT Init(CIdGenerator & StartId);
  26. DWORD NewId();
  27. BOOL IsValidId(DWORD dwId);
  28. };
  29. #endif // IDGENER_H