1 //
2 // Copyright (c) 2010-2018 Antmicro
3 // Copyright (c) 2011-2015 Realtime Embedded
4 //
5 // This file is licensed under the MIT License.
6 // Full license text is available in 'licenses/MIT.txt'.
7 //
8 using System;
9 using Antmicro.Renode.Core.Structure;
10 
11 namespace Antmicro.Renode.Peripherals.CPU
12 {
13     public class CPURegistrationPoint : IRegistrationPoint
14     {
CPURegistrationPoint(int? slot = null)15         public CPURegistrationPoint(int? slot = null)
16         {
17             Slot = slot;
18         }
19 
20         public string PrettyString
21         {
22             get
23             {
24                 return ToString();
25             }
26         }
27 
ToString()28         public override string ToString()
29         {
30             return string.Format("Slot: {0}", Slot);
31         }
32 
33         public int? Slot { get; private set; }
34 
Equals(object obj)35         public override bool Equals(object obj)
36         {
37             var other = obj as CPURegistrationPoint;
38             if(other == null)
39                 return false;
40             if(ReferenceEquals(this, obj))
41                 return true;
42 
43             return Slot == other.Slot;
44         }
45 
46 
GetHashCode()47         public override int GetHashCode()
48         {
49             unchecked
50             {
51                 return Slot.GetHashCode();
52             }
53         }
54 
55     }
56 }
57 
58