Beispiel #1
0
 /// <summary>
 /// Records a snapshot of all longs converted into TDatum. The TDatum must have a public .ctor(string, long) or runtime exception is thrown
 /// (this is because C# does not have a contract/constraint for parameterized cosntructors)
 /// </summary>
 public void SnapshotAllLongsInto <TDatum>(long?exchange = null, Instrumentation.IInstrumentation instrumentation = null) where TDatum : Instrumentation.Datum
 {
     if (instrumentation == null)
     {
         instrumentation = App.Instrumentation;
     }
     foreach (var slot in SnapshotAllLongs(exchange))
     {
         var datum = (Instrumentation.Datum)Activator.CreateInstance(typeof(TDatum), slot.Key, slot.Value);
         instrumentation.Record(datum);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Records a snapshot of all longs converted into TDatum. The TDatum must have a public .ctor(string, long) or runtime exception is thrown
        /// (this is because C# does not have a contract/constraint for parameterized constructors)
        /// </summary>
        public void SnapshotAllLongsInto <TDatum>(Instrumentation.IInstrumentation instrumentation, long?exchange = null) where TDatum : Instrumentation.Datum
        {
            if (instrumentation == null)
            {
                throw new AzosException(StringConsts.ARGUMENT_ERROR + "{0}.{1}(instr==null)".Args(nameof(NamedInterlocked), nameof(SnapshotAllLongsInto)));
            }

            foreach (var slot in SnapshotAllLongs(exchange))
            {
                var datum = (Instrumentation.Datum)Activator.CreateInstance(typeof(TDatum), slot.Key, slot.Value);
                instrumentation.Record(datum);
            }
        }