forked from hitmen047/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidator.h
73 lines (48 loc) · 1.83 KB
/
validator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "valobject.h"
#ifndef VALIDATOR_H
#define VALIDATOR_H
#ifdef _WIN32
#pragma once
#endif
#ifdef DBGFLAG_VALIDATE
class CValidator
{
public:
// Constructors & destructors
CValidator( void );
~CValidator( void );
// Call this each time we enter a new Validate function
void Push( tchar *pchType, void *pvObj, tchar *pchName );
// Call this each time we exit a Validate function
void Pop( void );
// Claim ownership of a memory block
void ClaimMemory( void *pvMem );
// Finish performing a check and perform necessary computations
void Finalize( void );
// Render our results to the console
void RenderObjects( int cubThreshold ); // Render all reported objects
void RenderLeaks( void ); // Render all memory leaks
// List manipulation functions:
CValObject *FindObject( void *pvObj ); // Returns CValObject containing pvObj, or NULL.
void DiffAgainst( CValidator *pOtherValidator ); // Removes any entries from this validator that are also present in the other.
// Accessors
bool BMemLeaks( void ) { return m_bMemLeaks; };
CValObject *PValObjectFirst( void ) { return m_pValObjectFirst; };
void Validate( CValidator &validator, tchar *pchName ); // Validate our internal structures
private:
CValObject *m_pValObjectFirst; // Linked list of all ValObjects
CValObject *m_pValObjectLast; // Last ValObject on the linked list
CValObject *m_pValObjectCur; // Object we're current processing
int m_cpvOwned; // Total # of blocks owned
int m_cpubLeaked; // # of leaked memory blocks
int m_cubLeaked; // Amount of leaked memory
bool m_bMemLeaks; // Has any memory leaked?
};
#endif // DBGFLAG_VALIDATE
#endif // VALIDATOR_H