示例#1
0
        private VectorImp <TType> CreateVectorImp(VectorElementType types)
        {
            switch (types)
            {
            case VectorElementType.UInt8:
                return(new VectorUInt8Imp(this, types) as VectorImp <TType>);

            case VectorElementType.UInt16:
                return(new VectorUInt16Imp(this, types) as VectorImp <TType>);

            case VectorElementType.UInt32:
                return(new VectorUInt32Imp(this, types) as VectorImp <TType>);

            case VectorElementType.Int8:
                return(new VectorInt8Imp(this, types) as VectorImp <TType>);

            case VectorElementType.Int16:
                return(new VectorInt16Imp(this, types) as VectorImp <TType>);

            case VectorElementType.Int32:
                return(new VectorInt32Imp(this, types) as VectorImp <TType>);

            case VectorElementType.Float:
                return(new VectorFloatImp(this, types) as VectorImp <TType>);

            case VectorElementType.Double:
                return(new VectorDoubleImp(this, types) as VectorImp <TType>);

            default:
                throw new ArgumentOutOfRangeException(nameof(types), types, null);
            }
        }
示例#2
0
        public Vector()
        {
            if (!SupportTypes.TryGetValue(typeof(TType), out var type))
            {
                throw new NotSupportedException($"{typeof(TType).Name} does not support");
            }

            this._VectorElementTypes = type;
            this._ElementType        = type.ToNativeVectorElementType();

            this._Imp = this.CreateVectorImp(this._ElementType);

            this.NativePtr = NativeMethods.vector_new(this._ElementType);
        }
示例#3
0
        internal Vector(IntPtr ptr, bool isEnabledDispose = true)
            : base(isEnabledDispose)
        {
            if (ptr == IntPtr.Zero)
            {
                throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr));
            }

            if (!SupportTypes.TryGetValue(typeof(TType), out var type))
            {
                throw new NotSupportedException($"{typeof(TType).Name} does not support");
            }

            this.NativePtr = ptr;

            this._VectorElementTypes = type;
            this._ElementType        = type.ToNativeVectorElementType();

            this._Imp = this.CreateVectorImp(this._ElementType);

            this.NativePtr = ptr;
        }
示例#4
0
 internal VectorDoubleImp(DlibObject parent, VectorElementType type)
     : base(parent, type)
 {
 }
示例#5
0
 internal VectorFloatImp(DlibObject parent, VectorElementType type)
     : base(parent, type)
 {
 }
示例#6
0
 internal VectorUInt32Imp(DlibObject parent, VectorElementType type)
     : base(parent, type)
 {
 }
示例#7
0
 internal VectorImp(DlibObject parent, VectorElementType type)
 {
     this._Parent = parent ?? throw new ArgumentNullException(nameof(parent));
     this._Type   = type;
 }