Пример #1
0
 static NB()
 {
     if (UnmanagedTypeExtensions.IsUnmanaged <T>() == false)
     {
         throw new Exception("NativeBuffer (NB) supports only unmanaged types");
     }
 }
        public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy)
        {
            //AllocationStrategy must be passed external for TValue because SveltoDictionary doesn't have struct
            //constraint needed for the NativeVersion
            if (UnmanagedTypeExtensions.IsUnmanaged <TKey>() == false ||
                UnmanagedTypeExtensions.IsUnmanaged <TValue>() == false)
            {
                _valuesInfo = new ManagedStrategy <FasterDictionaryNode <TKey> >(size);
            }
            else
            {
                _valuesInfo = new NativeStrategy <FasterDictionaryNode <TKey> >(size);
            }

            _buckets = new int[HashHelpers.GetPrime((int)size)];
            _values  = allocationStrategy;
            _values.Alloc(size);
        }
Пример #3
0
        //it's an internal interface
        void IFiller.FillFromByteArray(EntityComponentInitializer init, NativeBag buffer)
        {
            DBC.ECS.Check.Require(UnmanagedTypeExtensions.IsUnmanaged <T>() == true, "invalid type used");

            _action(init, buffer);
        }
Пример #4
0
 static Filler()
 {
     DBC.ECS.Check.Require(UnmanagedTypeExtensions.IsUnmanaged <T>() == true, "invalid type used");
 }