예제 #1
0
        /// <summary>
        /// Indicates that this entire pointer's memory space has been freed, and this reference cannot be used again
        /// </summary>
        public void Free()
        {
            if (_memory != null)
            {
                _memory.Free();
                _memory = null;
            }

            _elementsOffset = -1;
        }
예제 #2
0
 public Pointer(IMemoryBlockAccess <T> memoryAccess, int absoluteOffsetElements)
 {
     _memory         = memoryAccess;
     _elementsOffset = absoluteOffsetElements;
     _elementSize    = PointerHelpers.GetElementSize(typeof(T));
 }
예제 #3
0
 public Pointer(T[] buffer, int absoluteOffsetElements)
 {
     _memory         = new BasicMemoryBlockAccess <T>(new MemoryBlock <T>(buffer));
     _elementsOffset = absoluteOffsetElements;
     _elementSize    = PointerHelpers.GetElementSize(typeof(T));
 }
예제 #4
0
        private int                    _elementSize;    // Size in bytes of each array element (set to 1 for non-primitive types)

        #endregion

        #region Constructors

        public Pointer(int capacity)
        {
            _memory         = new BasicMemoryBlockAccess <T>(new MemoryBlock <T>(capacity));
            _elementsOffset = 0;
            _elementSize    = PointerHelpers.GetElementSize(typeof(T));
        }