コード例 #1
0
ファイル: NB.cs プロジェクト: jlreymendez/ant-pheromones-ecs
 static NB()
 {
     if (UnmanagedTypeExtensions.IsUnmanaged <T>() == false)
     {
         throw new Exception("NativeBuffer (NB) supports only unmanaged types");
     }
 }
コード例 #2
0
        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");
 }