/// <summary> /// Insert result of the given metric. It can override the old result. /// </summary> /// <param name="key">Metric identification.</param> /// <param name="value">Result of the given metric.</param> /// <exception cref="System.InvalidOperationException">Thrown when results are frozen.</exception> public void Insert(TMetricCategory key, Result value) { if (IsFrozen) { throw new InvalidOperationException("Cannot insert values in frozen state"); } results[key] = value; }
/// <summary> /// Get result of the given metric. /// </summary> /// <param name="key">Metric identification.</param> /// <returns>Result of the given metric.</returns> /// <exception cref="System.NotImplementedException"> /// Thrown when there is no result for the given metric. /// </exception> public Result GetResult(TMetricCategory key) { Result result; if (!results.TryGetValue(key, out result)) { // All implemented metrics has to have entry in results. throw new NotImplementedException("Metric '" + key.ToString() + "' isn't implemented yet"); } return(result); }