Exemplo n.º 1
0
        // Accessors
        public static int l_byteaGetSize(this L_Bytea ba)
        {
            if (null == ba)
            {
                throw new ArgumentNullException("ba cannot be null");
            }

            return(Native.DllImports.l_byteaGetSize((HandleRef)ba));
        }
Exemplo n.º 2
0
        public static IntPtr l_byteaGetData(this L_Bytea ba, ref int psize)
        {
            if (null == ba)// || IntPtr.Zero == psize)
            {
                throw new ArgumentNullException("ba, psize cannot be null");
            }

            return(Native.DllImports.l_byteaGetData((HandleRef)ba, ref psize));
        }
Exemplo n.º 3
0
        public static int l_byteaAppendString(this L_Bytea ba, string str)
        {
            if (null == ba)
            {
                throw new ArgumentNullException("ba cannot be null");
            }

            return(Native.DllImports.l_byteaAppendString((HandleRef)ba, str));
        }
Exemplo n.º 4
0
        // Appending
        public static int l_byteaAppendData(this L_Bytea ba, IntPtr newdata, IntPtr newbytes)
        {
            if (null == ba ||
                IntPtr.Zero == newdata ||
                IntPtr.Zero == newbytes)
            {
                throw new ArgumentNullException("ba, newbytes, newdata cannot be null");
            }

            return(Native.DllImports.l_byteaAppendData((HandleRef)ba, newdata, newbytes));
        }
Exemplo n.º 5
0
        public static void l_byteaDestroy(this L_Bytea pba)
        {
            if (null == pba)
            {
                throw new ArgumentNullException("pba cannot be null");
            }

            var pointer = (IntPtr)pba;

            Native.DllImports.l_byteaDestroy(ref pointer);
        }
Exemplo n.º 6
0
        public static int l_byteaWriteStream(IntPtr fp, L_Bytea ba, IntPtr startloc, IntPtr endloc)
        {
            if (IntPtr.Zero == fp ||
                null == ba ||
                IntPtr.Zero == startloc ||
                IntPtr.Zero == endloc)
            {
                throw new ArgumentNullException("fp, ba, startloc, endloc cannot be null");
            }

            return(Native.DllImports.l_byteaWriteStream(fp, (HandleRef)ba, startloc, endloc));
        }
Exemplo n.º 7
0
        // Output to file
        public static int l_byteaWrite(string fname, L_Bytea ba, IntPtr startloc, IntPtr endloc)
        {
            if (null == ba ||
                IntPtr.Zero == startloc ||
                IntPtr.Zero == endloc ||
                string.IsNullOrWhiteSpace(fname))
            {
                throw new ArgumentNullException("ba, startloc, endloc, fname cannot be null");
            }

            return(Native.DllImports.l_byteaWrite(fname, (HandleRef)ba, startloc, endloc));
        }
Exemplo n.º 8
0
        // Join/Split
        public static int l_byteaJoin(L_Bytea ba1, ref L_Bytea pba2)
        {
            if (null == ba1)
            {
                throw new ArgumentNullException("ba1 cannot be null");
            }

            IntPtr pba2Ptr = pba2.Pointer;
            IntPtr ba1Ptr  = ba1.Pointer;
            var    ret     = Native.DllImports.l_byteaJoin(ba1Ptr, ref pba2Ptr);

            return(ret);
        }
Exemplo n.º 9
0
        // Join/Split
        public static int l_byteaJoin(this L_Bytea ba1, out L_Bytea pba2)
        {
            if (null == ba1)
            {
                throw new ArgumentNullException("ba1 cannot be null");
            }

            IntPtr pba2Ptr;
            var    result = Native.DllImports.l_byteaJoin((HandleRef)ba1, out pba2Ptr);

            pba2 = new L_Bytea(pba2Ptr);
            return(result);
        }
Exemplo n.º 10
0
        // Search
        public static int l_byteaFindEachSequence(this L_Bytea ba, IntPtr sequence, int seqlen, out L_Dna pda)
        {
            if (null == ba ||
                IntPtr.Zero == sequence)
            {
                throw new ArgumentNullException("ba1, sequence cannot be null");
            }

            IntPtr pdaPtr;
            var    result = Native.DllImports.l_byteaFindEachSequence((HandleRef)ba, sequence, seqlen, out pdaPtr);

            pda = new L_Dna(pdaPtr);
            return(result);
        }
Exemplo n.º 11
0
        public static int l_byteaSplit(this L_Bytea ba1, IntPtr splitloc, out L_Bytea pba2)
        {
            if (null == ba1 ||
                IntPtr.Zero == splitloc)
            {
                throw new ArgumentNullException("ba1, splitloc cannot be null");
            }

            IntPtr pba2Ptr;
            var    result = Native.DllImports.l_byteaSplit((HandleRef)ba1, splitloc, out pba2Ptr);

            pba2 = new L_Bytea(pba2Ptr);
            return(result);
        }
Exemplo n.º 12
0
        public static L_Bytea l_byteaCopy(this L_Bytea bas, int copyflag)
        {
            if (null == bas)
            {
                throw new ArgumentNullException("bas cannot be null.");
            }

            var pointer = Native.DllImports.l_byteaCopy((HandleRef)bas, copyflag);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new L_Bytea(pointer));
            }
        }
Exemplo n.º 13
0
        public L_Bytea(byte[] data) : base(IntPtr.Zero)
        {
            L_Bytea ba = ByteArray.l_byteaInitFromMem(data, data.Length);

            Pointer = ba.Pointer;
        }