Esempio n. 1
0
        public static PointerArray <T> Create(ushort[] data, int startOffset, int count)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (startOffset < 0)
            {
                throw new ArgumentException("Start offset must not be < 0.", "startOffset");
            }
            if (count < 0)
            {
                throw new ArgumentException("Count must not be < 0.", "count");
            }
            int sizeofTData = sizeof(ushort);

            if (startOffset + count * SIZEOF_T > data.Length * sizeofTData)
            {
                throw new IndexOutOfRangeException("The sub-array must be within the confines of the given data array");
            }
            PointerArray <T> result = PointerArray <T> .newInstanceFunction();

            result.dataReference = data;
            unsafe
            {
                fixed(ushort *ptr = data)
                {
                    result.pointer = (byte *)ptr + startOffset;
                }
            }
            result.Count = data.Length * sizeofTData / SIZEOF_T;
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     this.owner = null;
 }
Esempio n. 3
0
 public Enumerator(PointerArray <T> owner)
 {
     this.owner = owner;
     this.count = owner.Count;
 }