public static uint GetOrAllocIndexFromPoolHelper(CpuThreadState CpuThreadState, Type Type, IHleUidPoolClass Item) { //Console.Error.WriteLine("AllocIndexFromPoolHelper"); return((uint)CpuThreadState.CpuProcessor.InjectContext.GetInstance <HleUidPoolManager>() .GetOrAllocIndex(Type, Item)); }
public int Alloc(IHleUidPoolClass Item) { if (Item.GetType() != this.Type) { throw(new InvalidOperationException("Trying to insert invalid object type")); } int Index = -1; if (ReuseIds) { //Console.Error.WriteLine("******************************************"); if (FreedIds.Count > 0) { Index = FreedIds.Min(); FreedIds.Remove(Index); } } if (Index == -1) { Index = LastId++; } Items[Index] = Item; RevItems[Item] = Index; return(Index); }
public int GetIndex(IHleUidPoolClass Item) { if (!RevItems.ContainsKey(Item)) { ThrowNotFound(); } return(RevItems[Item]); }
public int GetOrAllocIndex(IHleUidPoolClass Item) { if (!RevItems.ContainsKey(Item)) { return(Alloc(Item)); } return(GetIndex(Item)); }
//[MethodImpl(MethodImplOptions.Synchronized)] public void RemoveItem(IHleUidPoolClass Item) { Item.Dispose(); if (ReuseIds) { FreedIds.Add(RevItems[Item]); } Items.Remove(RevItems[Item]); RevItems.Remove(Item); }
public static int GetUidIndex(this IHleUidPoolClass IHleUidPoolClass, InjectContext InjectContext) { return(InjectContext.GetInstance <HleUidPoolManager>() .GetOrAllocIndex(IHleUidPoolClass.GetType(), IHleUidPoolClass)); }
public static void RemoveUid(this IHleUidPoolClass IHleUidPoolClass, InjectContext InjectContext) { InjectContext.GetInstance <HleUidPoolManager>().RemoveItem(IHleUidPoolClass.GetType(), IHleUidPoolClass); }
public int GetIndex(Type Type, IHleUidPoolClass Item) { return(_GetTypePool(Type).GetIndex(Item)); }
public void RemoveItem(Type Type, IHleUidPoolClass Item) { _GetTypePool(Type).RemoveItem(Item); }
public int Alloc(Type Type, IHleUidPoolClass Item) { return(_GetTypePool(Type).Alloc(Item)); }