Example #1
0
 public IDAlreadyExistsException(ID id) : base($"The ID {id} already exists in this ID pool")
 {
 }
Example #2
0
 public UnresolvedContextException(ID id) : base($"The contextual ID {id} was passed to the ID pool without expanding its context")
 {
 }
Example #3
0
 public MissingIDException(ID id) : base($"The ID {id} does not exist")
 {
 }
Example #4
0
 /// <summary>
 /// Ensures that the provided ID is mapped to an object. Will
 /// throw appropriate exceptions if not.
 /// </summary>
 /// <returns>The `id` parameter.</returns>
 /// <param name="id">The contextless ID.</param>
 public ID ValidateExisting(ID id)
 {
     CheckContext(id);
     Get(id);
     return(id);
 }
Example #5
0
 /// <summary>
 /// Checks if this ID pool contains the specified ID.
 /// </summary>
 /// <returns>`true` if the ID is mapped, `false` if not.</returns>
 /// <param name="id">The contextless ID.</param>
 public bool Contains(ID id)
 {
     CheckContext(id);
     return(_Storage.ContainsKey(id));
 }
Example #6
0
 /// <summary>
 /// Maps the specified ID to the specified object. Will throw an
 /// exception if the namespace is locked.
 /// </summary>
 /// <param name="id">The contextless ID.</param>
 public void Set(ID id, T val)
 {
     CheckContext(id);
     CheckNamespace(id);
     _Storage[id] = val;
 }
Example #7
0
 /// <summary>
 /// Retrieves an object with the specified ID. Sets `val` if the object
 /// exists.
 /// </summary>
 /// <returns>`true` if the object exists and `val` has been set,
 /// `false` otherwise.</returns>
 /// <param name="id">The contextless ID.</param>
 /// /// <param name="val">Output parameter for the object.</param>
 public bool TryGet(ID id, out T val)
 {
     CheckContext(id);
     return(_Storage.TryGetValue(id, out val));
 }