/// <summary> /// Unregisters the specified entity. /// </summary> /// <param name="name">Original name of the entity.</param> /// <param name="numberOfArguments">Number of entity arguments.</param> public void Unregister(string name, int numberOfArguments = 0) { var key = Tuple.Create(name, numberOfArguments); Debug.Assert(NameWithArgToId.ContainsKey(key)); NameWithArgToId.Remove(key); }
/// <summary> /// Registers the specified entity and returns the registered ID value. /// </summary> /// <param name="name">Original name of the entity.</param> /// <param name="numberOfArguments">Number of entity arguments.</param> /// <returns>Registered entity ID.</returns> public int Register(string name, int numberOfArguments = 0) { var key = Tuple.Create(name, numberOfArguments); Debug.Assert(!NameWithArgToId.ContainsKey(key)); NameWithArgToId.Add(key, NextFreeId); return(NextFreeId++); }
/// <summary> /// Checks whether the entity has been registered. /// </summary> /// <param name="name">Original entity name.</param> /// <param name="numberOfArguments">Number of entity arguments (if it has any).</param> /// <returns>True if the entity has been registered. False otherwise.</returns> public bool IsRegistered(string name, int numberOfArguments = 0) { var key = Tuple.Create(name, numberOfArguments); return(NameWithArgToId.ContainsKey(key)); }