Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RunningStats{TTKernel}"/> class.
        /// </summary>
        public RunningStats()
        {
            if (!SupportTypes.TryGetValue(typeof(TKernel), out var type))
            {
                throw new NotSupportedException($"{typeof(TKernel).Name} does not support");
            }

            this._RunningStatsType = type.ToRunningStatsType();

            this.NativePtr = NativeMethods.running_stats_new(this._RunningStatsType);
            if (this.NativePtr == IntPtr.Zero)
            {
                throw new ArgumentException($"{type} is not supported.");
            }

            this._Type = type;

            switch (this._Type)
            {
            case RunningStatsType.Float:
                this._Imp = new RunningStatsFloatImp(this, this._RunningStatsType) as RunningStatsImp <TKernel>;
                break;

            case RunningStatsType.Double:
                this._Imp = new RunningStatsDoubleImp(this, this._RunningStatsType) as RunningStatsImp <TKernel>;
                break;
            }
        }
Пример #2
0
 internal RunningStatsDoubleImp(DlibObject parent, NativeMethods.RunningStatsType type)
     : base(parent, type)
 {
 }
Пример #3
0
 protected RunningStatsImp(DlibObject parent, NativeMethods.RunningStatsType type)
 {
     this._Parent = parent;
     this._Type   = type;
 }