| 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: HotHeapsDirectoryIterator.h |
| 6 | // |
| 7 | |
| 8 | // |
| 9 | // Class code:MetaData::HotHeapsDirectoryIterator represents an iterator through hot heaps directory |
| 10 | // (code:HotHeapsDirectory). |
| 11 | // |
| 12 | // ====================================================================================== |
| 13 | |
| 14 | #pragma once |
| 15 | |
| 16 | #include "external.h" |
| 17 | #include "heapindex.h" |
| 18 | #include "hotheap.h" |
| 19 | |
| 20 | namespace MetaData |
| 21 | { |
| 22 | |
| 23 | // -------------------------------------------------------------------------------------- |
| 24 | // |
| 25 | // This class represents an iterator through hot heaps directory (code:HotHeapsDirectory), i.e. through an |
| 26 | // array of code:HotHeapsDirectoryEntry. |
| 27 | // |
| 28 | class HotHeapsDirectoryIterator |
| 29 | { |
| 30 | private: |
| 31 | // |
| 32 | // Private data |
| 33 | // |
| 34 | |
| 35 | // Remaining data from the heaps directory. On each iteration this will be shrinked (the |
| 36 | // code:HotHeapsDirectoryEntry will be skipped). |
| 37 | DataBuffer m_RemainingHeapsDirectoryData; |
| 38 | // Data for the hot heaps. It has to end exactly where heaps directory starts. |
| 39 | DataBuffer m_HotHeapsData; |
| 40 | |
| 41 | private: |
| 42 | // |
| 43 | // Operations with restricted access |
| 44 | // |
| 45 | |
| 46 | // code:HotMetaData is the only class allowed to create this iteration. |
| 47 | friend class HotMetaData; |
| 48 | |
| 49 | // Initialize iteration on heaps directory (hotHeapsDirectoryData) with heap hot data (hotHeapsData). |
| 50 | // The caller guarantees that the heap hot data end where heaps directory beggins. |
| 51 | void Initialize( |
| 52 | DataBuffer hotHeapsDirectoryData, |
| 53 | DataBuffer hotHeapsData); |
| 54 | |
| 55 | public: |
| 56 | // |
| 57 | // Operations |
| 58 | // |
| 59 | |
| 60 | // Creates empty iterator. |
| 61 | HotHeapsDirectoryIterator(); |
| 62 | |
| 63 | // S_OK, S_FALSE, error code (clears the HotHeap if not S_OK) |
| 64 | __checkReturn |
| 65 | HRESULT GetNext( |
| 66 | HotHeap *pHotHeap, |
| 67 | HeapIndex *pHotHeapIndex); |
| 68 | |
| 69 | }; // class HotHeapsDirectoryIterator |
| 70 | |
| 71 | }; // namespace MetaData |
| 72 | |