public void EnsureChildTag(int InChildNameIndex, FAllocationTag InTag)
 {
     if (!ChildTagsByNameMap.ContainsKey(InChildNameIndex))
     {
         new FNode(InChildNameIndex, this, InTag);
     }
 }
        public void InitializeHierarchy()
        {
            RootNode = new FNode(-1, null, null);

            var Untagged = new FAllocationTag("Untagged");

            UntaggedNode = new FNode(Untagged.TagNameIndex, RootNode, Untagged);
        }
Exemple #3
0
        private bool AllocationMatchesTagFilter(FAllocationTag InTag, ISet <FAllocationTag> InActiveTags, bool bInclusiveFilter)
        {
            if (InActiveTags == null || InActiveTags.Count == 0)
            {
                // No filter, so match anything
                return(true);
            }

            return(InActiveTags.Contains(InTag) ? bInclusiveFilter : !bInclusiveFilter);
        }
        public FAllocationTags(string TagsStr)
        {
            var SplitTags = TagsStr.Split(TagSeparators, StringSplitOptions.RemoveEmptyEntries);

            Tags = new FAllocationTag[SplitTags.Length];
            for (int TagIndex = 0; TagIndex < SplitTags.Length; ++TagIndex)
            {
                Tags[TagIndex] = new FAllocationTag(SplitTags[TagIndex]);
                FStreamInfo.GlobalInstance.TagHierarchy.RegisterTag(SplitTags[TagIndex], Tags[TagIndex]);
            }
        }
        public void RegisterTag(string TagStr, FAllocationTag Tag)
        {
            string CategoryName = "Uncategorized";
            string ActualTag    = TagStr;

            // Split the tag into its category and remaining parts
            int CategorySeparatorIndex = TagStr.IndexOf(':');

            if (CategorySeparatorIndex != -1)
            {
                CategoryName = TagStr.Substring(0, CategorySeparatorIndex);
                ActualTag    = TagStr.Substring(CategorySeparatorIndex + 1);
            }

            // Add the top-level category
            FNode CurrentNode = RootNode;
            {
                int CategoryNameIndex = FStreamInfo.GlobalInstance.GetNameIndex(CategoryName, true);
                CurrentNode = CurrentNode.EnsureChildNode(CategoryNameIndex);
            }

            // Split the remaining parts it hierarchical parts, add a name entry for each tag, and add to the hierarchy
            var HierarchicalTags           = ActualTag.Split(TagPathSeparators, StringSplitOptions.RemoveEmptyEntries);
            var HierarchicalTagNameIndices = new int[HierarchicalTags.Length];

            for (int HierarchicalTagIndex = 0; HierarchicalTagIndex < HierarchicalTags.Length; ++HierarchicalTagIndex)
            {
                int HierarchicalTagNameIndex = FStreamInfo.GlobalInstance.GetNameIndex(HierarchicalTags[HierarchicalTagIndex], true);

                // Are we dealing with a child node, or a tag?
                if (HierarchicalTagIndex + 1 == HierarchicalTags.Length)
                {
                    CurrentNode.EnsureChildTag(HierarchicalTagNameIndex, Tag);
                }
                else
                {
                    CurrentNode = CurrentNode.EnsureChildNode(HierarchicalTagNameIndex);
                }
            }
        }