summaryrefslogtreecommitdiff
path: root/src/md/hotdata/hotheap.h
blob: e9e42c4330bf959ecc0ad015001ed70cdaf2eb0a (plain)
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
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license 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