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: HotHeapWriter.h
6//
7
8//
9// Class code:HeapIndex represents type of MetaData heap (#String, #GUID, #Blob, or #US).
10//
11// ======================================================================================
12
13#pragma once
14
15namespace MetaData
16{
17
18// --------------------------------------------------------------------------------------
19//
20// This class represents type of MetaData heap (#String, #GUID, #Blob, or #US).
21//
22class HeapIndex
23{
24private:
25 UINT32 m_Index;
26public:
27 enum
28 {
29 StringHeapIndex = 0,
30 GuidHeapIndex = 1,
31 BlobHeapIndex = 2,
32 UserStringHeapIndex = 3,
33
34 CountHeapIndex,
35 InvalidHeapIndex
36 };
37 HeapIndex()
38 {
39 m_Index = InvalidHeapIndex;
40 }
41 HeapIndex(UINT32 index)
42 {
43 _ASSERTE(IsValid(index));
44 m_Index = index;
45 }
46 void Set(UINT32 index)
47 {
48 _ASSERTE(IsValid(index));
49 m_Index = index;
50 }
51 void SetInvalid()
52 {
53 m_Index = InvalidHeapIndex;
54 }
55 BOOL IsValid() const
56 {
57 return m_Index < CountHeapIndex;
58 }
59 static BOOL IsValid(UINT32 index)
60 {
61 return index < CountHeapIndex;
62 }
63 UINT32 Get() const
64 { return m_Index; }
65
66}; // class HeapIndex
67
68}; // namespace MetaData
69