diff options
Diffstat (limited to 'src/md/hotdata/hotheap.h')
-rw-r--r-- | src/md/hotdata/hotheap.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/md/hotdata/hotheap.h b/src/md/hotdata/hotheap.h new file mode 100644 index 0000000000..bad1ed2d0d --- /dev/null +++ b/src/md/hotdata/hotheap.h @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// +// File: HotHeap.h +// + +// +// Class code:MetaData::HotHeap represents a hot heap in MetaData hot stream. +// +// ====================================================================================== + +#pragma once + +#include "external.h" + +namespace MetaData +{ + +// Forward declarations +struct HotHeapHeader; + +// -------------------------------------------------------------------------------------- +// +// This class represents a hot heap in MetaData hot stream. +// +class HotHeap +{ + friend class VerifyLayoutsMD; +private: + struct HotHeapHeader *m_pHotHeapHeader; + +private: + friend class HotHeapsDirectoryIterator; + + // Initializes hot heap from its header and data. + __checkReturn + HRESULT Initialize(struct HotHeapHeader *pHotHeapHeader, DataBuffer hotHeapData); + +public: + HotHeap() + { m_pHotHeapHeader = NULL; } + HotHeap(const HotHeap &source) + { m_pHotHeapHeader = source.m_pHotHeapHeader; } + + void Clear() + { m_pHotHeapHeader = NULL; } + + // Gets stored data at index. + // Returns S_FALSE if data index is not stored in hot heap. + __checkReturn + HRESULT GetData( + UINT32 nDataIndex, + __out DataBlob *pData); + + inline BOOL IsEmpty() const + { return m_pHotHeapHeader == NULL; } + +#ifdef _DEBUG_METADATA + // Validates hot heap structure (extension of code:Initialize checks). + __checkReturn + HRESULT Debug_Validate(); +#endif //_DEBUG_METADATA + +}; // class HotHeap + +}; // namespace MetaData |