Ejemplo n.º 1
0
        private VectorImp <TType> CreateVectorImp(NativeMethods.VectorElementType types)
        {
            switch (types)
            {
            case NativeMethods.VectorElementType.UInt8:
                return(new VectorUInt8Imp(this, types) as VectorImp <TType>);

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

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

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

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

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

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

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

            default:
                throw new ArgumentOutOfRangeException(nameof(types), types, null);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 4
0
 internal VectorDoubleImp(DlibObject parent, NativeMethods.VectorElementType type)
     : base(parent, type)
 {
 }
Ejemplo n.º 5
0
 internal VectorImp(DlibObject parent, NativeMethods.VectorElementType type)
 {
     this._Parent = parent ?? throw new ArgumentNullException(nameof(parent));
     this._Type   = type;
 }