1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 using System.Threading; 8 9 namespace Antmicro.Renode.Debugging 10 { 11 public class IdentifiableObject : IIdentifiable 12 { 13 #if DEBUG IdentifiableObject()14 public IdentifiableObject() 15 { 16 uniqueObjectId = Interlocked.Increment(ref IdCounter); 17 } 18 19 public int UniqueObjectId 20 { 21 get { return uniqueObjectId; } 22 } 23 ToString()24 public override string ToString() 25 { 26 return $"[IdentifiableObject: {uniqueObjectId}]"; 27 } 28 29 private int uniqueObjectId; 30 31 private static int IdCounter = 0; 32 #endif 33 } 34 } 35