Example #1
0
        public NativeList(RNA rna, IntPtr first, Entity entity)
        {
            this.rna   = rna;
            this.first = first;

            rnaDelegate = RNA <T> .GetDelegate(rna, entity);
        }
Example #2
0
        public static NativePointer <N> Create <N>(RNA rna, string ctype, IntPtr ptr) where N : struct
        {
            Console.WriteLine($"Create NativePointer<{typeof(N)}>, ptr={ptr}, ctype={ctype}");

            var entity = rna.FindEntityForCType(ctype);

            return(new NativePointer <N>(rna, entity, ptr));
        }
Example #3
0
        /// <summary>
        /// Convert a native DNA type in memory to a managed C# type <typeparamref name="T"/>
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ptr"></param>
        /// <returns></returns>
        public T Transcribe <T>(IntPtr ptr)
        {
            var entity = FindEntityForType(typeof(T));

            if (entity == null)
            {
                throw new Exception($"Missing [DNA] attribute for type {typeof(T)}");
            }

            // Run custom IL to generate T and return it.
            return(RNA <T> .Transcribe(this, entity, ptr));
        }
Example #4
0
        public NativeArray(RNA rna, Entity entity, IntPtr ptr, int count)
        {
            this.rna = rna;
            Ptr      = ptr;
            Count    = count;

            if (entity != null)
            {
                rnaDelegate = RNA <T> .GetDelegate(rna, entity);

                ElementSize = entity.Size;
            }
            else
            {
                rnaDelegate = RNA <T> .GetCopyDelegate();

                ElementSize = Marshal.SizeOf(typeof(T));
            }
        }
Example #5
0
 public NativePointer(RNA rna, Entity entity, IntPtr ptr)
 {
     this.rna    = rna;
     Ptr         = ptr;
     rnaDelegate = RNA <T> .GetDelegate(rna, entity);
 }
Example #6
0
        public static NativeArray <N> Create <N>(RNA rna, string ctype, int count, IntPtr ptr) where N : struct
        {
            var entity = rna.FindEntityForCType(ctype);

            return(new NativeArray <N>(rna, entity, ptr, count));
        }
Example #7
0
 public NativeListEnumerator(RNA rna, IntPtr current, RNA <T> .Delegate rnaDelegate)
 {
     this.rna         = rna;
     this.current     = current;
     this.rnaDelegate = rnaDelegate;
 }