diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /sp/src/public/tier0/valobject.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/public/tier0/valobject.h')
| -rw-r--r-- | sp/src/public/tier0/valobject.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/sp/src/public/tier0/valobject.h b/sp/src/public/tier0/valobject.h new file mode 100644 index 00000000..8b25cc78 --- /dev/null +++ b/sp/src/public/tier0/valobject.h @@ -0,0 +1,72 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: CValObject is used for tracking individual objects that report
+// in to CValidator. Whenever a new object reports in (via CValidator::Push),
+// we create a new CValObject to aggregate stats for it.
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef VALOBJECT_H
+#define VALOBJECT_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#ifdef DBGFLAG_VALIDATE
+class CValObject
+{
+public:
+ // Constructors & destructors
+ CValObject( void ) { };
+ ~CValObject( void );
+
+ void Init( tchar *pchType, void *pvObj, tchar *pchName, CValObject *pValObjectParent,
+ CValObject *pValObjectPrev );
+
+ // Our object has claimed ownership of a memory block
+ void ClaimMemoryBlock( void *pvMem );
+
+ // A child of ours has claimed ownership of a memory block
+ void ClaimChildMemoryBlock( int cubUser );
+
+ // Accessors
+ tchar *PchType( void ) { return m_rgchType; };
+ void *PvObj( void ) { return m_pvObj; };
+ tchar *PchName( void ) { return m_rgchName; };
+ CValObject *PValObjectParent( void ) { return m_pValObjectParent; };
+ int NLevel( void ) { return m_nLevel; };
+ CValObject *PValObjectNext( void ) { return m_pValObjectNext; };
+ int CpubMemSelf( void ) { return m_cpubMemSelf; };
+ int CubMemSelf( void ) { return m_cubMemSelf; };
+ int CpubMemTree( void ) { return m_cpubMemTree; };
+ int CubMemTree( void ) { return m_cubMemTree; };
+ int NUser( void ) { return m_nUser; };
+ void SetNUser( int nUser ) { m_nUser = nUser; };
+ void SetBNewSinceSnapshot( bool bNewSinceSnapshot ) { m_bNewSinceSnapshot = bNewSinceSnapshot; }
+ bool BNewSinceSnapshot( void ) { return m_bNewSinceSnapshot; }
+
+private:
+ bool m_bNewSinceSnapshot; // If this block is new since the snapshot.
+ tchar m_rgchType[64]; // Type of the object we represent
+ tchar m_rgchName[64]; // Name of this particular object
+ void *m_pvObj; // Pointer to the object we represent
+
+ CValObject *m_pValObjectParent; // Our parent object in the tree.
+ int m_nLevel; // Our depth in the tree
+
+ CValObject *m_pValObjectNext; // Next ValObject in the linked list
+
+ int m_cpubMemSelf; // # of memory blocks we own directly
+ int m_cubMemSelf; // Total size of the memory blocks we own directly
+
+ int m_cpubMemTree; // # of memory blocks owned by us and our children
+ int m_cubMemTree; // Total size of the memory blocks owned by us and our children
+
+ int m_nUser; // Field provided for use by our users
+};
+#endif // DBGFLAG_VALIDATE
+
+
+#endif // VALOBJECT_H
|