Leaked source code of windows server 2003
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.

70 lines
1.6 KiB

  1. //
  2. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  3. //
  4. // ***************************************************************************
  5. //
  6. // Original Author: Rajesh Rao
  7. //
  8. // $Author: rajeshr $
  9. // $Date: 6/11/98 4:43p $
  10. // $Workfile:refcount.h $
  11. //
  12. // $Modtime: 6/11/98 11:21a $
  13. // $Revision: 1 $
  14. // $Nokeywords: $
  15. //
  16. //
  17. // Description: Contains the declaration for a basic reference counted object, that
  18. // also stores a timestamp (in 100-nanosecond intervals since January 1, 1601. This
  19. // is copatible with the definition of the Win32 FILETIME struture)
  20. //
  21. //***************************************************************************
  22. #ifndef REFCOUNTED_OBJECT_H
  23. #define REFCOUNTED_OBJECT_H
  24. class CRefCountedObject
  25. {
  26. public:
  27. CRefCountedObject();
  28. CRefCountedObject(LPCWSTR lpszName);
  29. virtual ~CRefCountedObject();
  30. LPCWSTR GetName();
  31. void SetName(LPCWSTR lpszName);
  32. void AddRef();
  33. void Release();
  34. // Returns the time of creation
  35. __int64 GetCreationTime()
  36. {
  37. return m_CreationTime;
  38. }
  39. // Returns the last time of access
  40. __int64 GetLastAccessTime()
  41. {
  42. return m_LastAccessTime;
  43. }
  44. // Sets the last time of access
  45. void SetLastAccessTime(__int64 lastAccessTime)
  46. {
  47. m_LastAccessTime = lastAccessTime;
  48. }
  49. private:
  50. // A critical section object for synchronizing modifications to refcount
  51. CRITICAL_SECTION m_ReferenceCountSection;
  52. unsigned m_dwRefCount;
  53. LPWSTR m_lpszName;
  54. __int64 m_CreationTime;
  55. __int64 m_LastAccessTime;
  56. };
  57. #endif /* REFCOUNTED_OBJECT_H */