public static NativeEGIDMultiMapper <T> QueryNativeMappedEntities <T>(this EntitiesDB entitiesDb, LocalFasterReadOnlyList <ExclusiveGroupStruct> groups) where T : unmanaged, IEntityComponent { var dictionary = new SveltoDictionary <ExclusiveGroupStruct, SveltoDictionary <uint, T, NativeStrategy <FasterDictionaryNode <uint> >, NativeStrategy <T>, NativeStrategy <int> >, NativeStrategy <FasterDictionaryNode <ExclusiveGroupStruct> >, NativeStrategy <SveltoDictionary <uint, T, NativeStrategy <FasterDictionaryNode <uint> >, NativeStrategy <T>, NativeStrategy <int> > >, NativeStrategy <int> > ((uint)groups.count, Allocator.TempJob); foreach (var group in groups) { if (entitiesDb.SafeQueryEntityDictionary <T>(group, out var typeSafeDictionary) == true) { if (typeSafeDictionary.count > 0) { dictionary.Add(group, ((TypeSafeDictionary <T>)typeSafeDictionary).implUnmgd); } } } return(new NativeEGIDMultiMapper <T>(dictionary)); }
public QueryGroups(LocalFasterReadOnlyList <ExclusiveGroupStruct> groups) { var groupsValue = QueryGroups.groups.Value; groupsValue.Reset(); groupsValue.AddRange(groups.ToArrayFast(out var count), count); }
public QueryGroups Except(LocalFasterReadOnlyList <ExclusiveGroupStruct> groupsToIgnore) { var groupsValue = groups.Value; groupsValue.Exclude(groupsToIgnore.ToArrayFast(out var count), count); return(this); }
public QueryGroups Union(LocalFasterReadOnlyList <ExclusiveGroupStruct> groups) { var groupsValue = QueryGroups.groups.Value; groupsValue.AddRange(groups.ToArrayFast(out var count), count); return(this); }
public QueryGroups(LocalFasterReadOnlyList <ExclusiveGroupStruct> findGroups) { var groupsValue = groups.Value; var group = groupsValue.reference; group.FastClear(); for (int i = 0; i < findGroups.count; i++) { group.Add(findGroups[i]); } }
///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)); }
///Note: if I use a SharedNativeSveltoDictionary for implUnmg, I may be able to cache NativeEGIDMultiMapper /// and reuse it public static NativeEGIDMultiMapper <T> QueryNativeMappedEntities <T>(this EntitiesDB entitiesDb, LocalFasterReadOnlyList <ExclusiveGroupStruct> groups, Allocator allocator) where T : unmanaged, IEntityComponent { var dictionary = new SveltoDictionary < /*key */ ExclusiveGroupStruct, /*value*/ SharedNative <SveltoDictionary <uint, T, NativeStrategy <SveltoDictionaryNode <uint> >, NativeStrategy <T>, NativeStrategy <int> > >, /*strategy to store the key*/ NativeStrategy <SveltoDictionaryNode <ExclusiveGroupStruct> >, /*strategy to store the value*/ NativeStrategy < SharedNative <SveltoDictionary <uint, T, NativeStrategy <SveltoDictionaryNode <uint> >, NativeStrategy <T>, NativeStrategy <int> > > > , NativeStrategy <int> > ((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, ((TypeSafeDictionary <T>)typeSafeDictionary).implUnmgd); } } return(new NativeEGIDMultiMapper <T>(dictionary)); }
public QueryResult Except(LocalFasterReadOnlyList <ExclusiveGroupStruct> groupsToIgnore) { var ignoreCount = groupsToIgnore.count; return(QueryResult(groupsToIgnore.ToArrayFast(out var count), (int)count)); }