summaryrefslogtreecommitdiff
path: root/src/md/hotdata/hotheapsdirectoryiterator.h
blob: fc5acb9a53a088a2f00ee6f6646e0c21874a419a (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
69
70
71
// 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: HotHeapsDirectoryIterator.h
// 

// 
// Class code:MetaData::HotHeapsDirectoryIterator represents an iterator through hot heaps directory 
// (code:HotHeapsDirectory).
// 
// ======================================================================================

#pragma once

#include "external.h"
#include "heapindex.h"
#include "hotheap.h"

namespace MetaData
{

// --------------------------------------------------------------------------------------
// 
// This class represents an iterator through hot heaps directory (code:HotHeapsDirectory), i.e. through an 
// array of code:HotHeapsDirectoryEntry.
// 
class HotHeapsDirectoryIterator
{
private:
    // 
    // Private data
    // 
    
    // Remaining data from the heaps directory. On each iteration this will be shrinked (the 
    // code:HotHeapsDirectoryEntry will be skipped).
    DataBuffer m_RemainingHeapsDirectoryData;
    // Data for the hot heaps. It has to end exactly where heaps directory starts.
    DataBuffer m_HotHeapsData;
    
private:
    // 
    // Operations with restricted access
    // 
    
    // code:HotMetaData is the only class allowed to create this iteration.
    friend class HotMetaData;
    
    // Initialize iteration on heaps directory (hotHeapsDirectoryData) with heap hot data (hotHeapsData).
    // The caller guarantees that the heap hot data end where heaps directory beggins.
    void Initialize(
        DataBuffer hotHeapsDirectoryData, 
        DataBuffer hotHeapsData);
    
public:
    // 
    // Operations
    // 
    
    // Creates empty iterator.
    HotHeapsDirectoryIterator();
    
    // S_OK, S_FALSE, error code (clears the HotHeap if not S_OK)
    __checkReturn 
    HRESULT GetNext(
        HotHeap   *pHotHeap, 
        HeapIndex *pHotHeapIndex);
    
};  // class HotHeapsDirectoryIterator

};  // namespace MetaData