1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | // |
5 | // File: HotHeap.h |
6 | // |
7 | |
8 | // |
9 | // Class code:MetaData::HotHeap represents a hot heap in MetaData hot stream. |
10 | // |
11 | // ====================================================================================== |
12 | |
13 | #pragma once |
14 | |
15 | #include "external.h" |
16 | |
17 | namespace MetaData |
18 | { |
19 | |
20 | // Forward declarations |
21 | struct ; |
22 | |
23 | // -------------------------------------------------------------------------------------- |
24 | // |
25 | // This class represents a hot heap in MetaData hot stream. |
26 | // |
27 | class HotHeap |
28 | { |
29 | friend class VerifyLayoutsMD; |
30 | private: |
31 | struct HotHeapHeader *; |
32 | |
33 | private: |
34 | friend class HotHeapsDirectoryIterator; |
35 | |
36 | // Initializes hot heap from its header and data. |
37 | __checkReturn |
38 | HRESULT (struct HotHeapHeader *, DataBuffer hotHeapData); |
39 | |
40 | public: |
41 | HotHeap() |
42 | { m_pHotHeapHeader = NULL; } |
43 | HotHeap(const HotHeap &source) |
44 | { m_pHotHeapHeader = source.m_pHotHeapHeader; } |
45 | |
46 | void Clear() |
47 | { m_pHotHeapHeader = NULL; } |
48 | |
49 | // Gets stored data at index. |
50 | // Returns S_FALSE if data index is not stored in hot heap. |
51 | __checkReturn |
52 | HRESULT GetData( |
53 | UINT32 nDataIndex, |
54 | __out DataBlob *pData); |
55 | |
56 | inline BOOL IsEmpty() const |
57 | { return m_pHotHeapHeader == NULL; } |
58 | |
59 | #ifdef _DEBUG_METADATA |
60 | // Validates hot heap structure (extension of code:Initialize checks). |
61 | __checkReturn |
62 | HRESULT Debug_Validate(); |
63 | #endif //_DEBUG_METADATA |
64 | |
65 | }; // class HotHeap |
66 | |
67 | }; // namespace MetaData |
68 | |