Counter Strike : Global Offensive Source Code
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.

73 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "valobject.h"
  8. #ifndef VALIDATOR_H
  9. #define VALIDATOR_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #ifdef DBGFLAG_VALIDATE
  14. class CValidator
  15. {
  16. public:
  17. // Constructors & destructors
  18. CValidator( void );
  19. ~CValidator( void );
  20. // Call this each time we enter a new Validate function
  21. void Push( tchar *pchType, void *pvObj, tchar *pchName );
  22. // Call this each time we exit a Validate function
  23. void Pop( void );
  24. // Claim ownership of a memory block
  25. void ClaimMemory( void *pvMem );
  26. // Finish performing a check and perform necessary computations
  27. void Finalize( void );
  28. // Render our results to the console
  29. void RenderObjects( int cubThreshold ); // Render all reported objects
  30. void RenderLeaks( void ); // Render all memory leaks
  31. // List manipulation functions:
  32. CValObject *FindObject( void *pvObj ); // Returns CValObject containing pvObj, or NULL.
  33. void DiffAgainst( CValidator *pOtherValidator ); // Removes any entries from this validator that are also present in the other.
  34. // Accessors
  35. bool BMemLeaks( void ) { return m_bMemLeaks; };
  36. CValObject *PValObjectFirst( void ) { return m_pValObjectFirst; };
  37. void Validate( CValidator &validator, tchar *pchName ); // Validate our internal structures
  38. private:
  39. CValObject *m_pValObjectFirst; // Linked list of all ValObjects
  40. CValObject *m_pValObjectLast; // Last ValObject on the linked list
  41. CValObject *m_pValObjectCur; // Object we're current processing
  42. int m_cpvOwned; // Total # of blocks owned
  43. int m_cpubLeaked; // # of leaked memory blocks
  44. int m_cubLeaked; // Amount of leaked memory
  45. bool m_bMemLeaks; // Has any memory leaked?
  46. };
  47. #endif // DBGFLAG_VALIDATE
  48. #endif // VALIDATOR_H