public NativeEGIDMapper
     (ExclusiveGroupStruct groupStructId
     , SveltoDictionary <uint, T, NativeStrategy <FasterDictionaryNode <uint> >, NativeStrategy <T> > toNative) : this()
 {
     groupID = groupStructId;
     map     = toNative;
 }
        public NativeEGIDMapper
            (ExclusiveGroupStruct groupStructId
            , SveltoDictionary <uint, T, NativeStrategy <SveltoDictionaryNode <uint> >, NativeStrategy <T>, NativeStrategy <int> >
            toNative) : this()
        {
            groupID = groupStructId;
            _map    = new SveltoDictionaryNative <uint, T>();

            _map.UnsafeCast(toNative);
        }
Exemple #3
0
        ///Note: if I use a SharedNativeSveltoDictionary for implUnmg, I may be able to cache NativeEGIDMultiMapper
        /// and reuse it
        /// TODO: the ability to retain a NativeEGIDMultiMapper thanks to the use of shareable arrays
        /// must be unit tested!
        public static NativeEGIDMultiMapper <T> QueryNativeMappedEntities <T>(this EntitiesDB entitiesDb,
                                                                              LocalFasterReadOnlyList <ExclusiveGroupStruct> groups, Allocator allocator)
            where T : unmanaged, IBaseEntityComponent
        {
            var dictionary = new SveltoDictionaryNative <ExclusiveGroupStruct, SharedSveltoDictionaryNative <uint, T> >
                                 ((uint)groups.count, allocator);

            foreach (var group in groups)
            {
                if (entitiesDb.SafeQueryEntityDictionary <T>(group, out var typeSafeDictionary) == true)
                {
                    //if (typeSafeDictionary.count > 0)
                    dictionary.Add(group, ((UnmanagedTypeSafeDictionary <T>)typeSafeDictionary).implUnmgd);
                }
            }

            return(new NativeEGIDMultiMapper <T>(dictionary));
        }
Exemple #4
0
 public NativeEGIDMapper
     (ExclusiveGroupStruct groupStructId, SveltoDictionaryNative <uint, T> toNative) : this()
 {
     groupID = groupStructId;
     _map    = toNative;
 }