public GpfProgram(ProgramSet set)
        {
            RuleProgram   = set.GetRuleProgram();
            FilterProgram = set.GetFilterProgram();
            ProgramMemory = MemoryCoordinator.GetProgramMemory();

            DataStart   = set.RecordStartByte;
            DataLength  = set.RecordLengthByte + slackBytes;
            DataLength += (DataLength % 4 != 0 ? (4 - DataStart % 4) : 0);
            LayerCount  = set.RuleProgram.Count;

            Root = ProtocolLibrary.GetRoot().Identifier;
            //update root start / end
            //ensure records are multiples of 4 bytes
            if (DataLength < 16)
            {
                DataLength = 16;
            }
            if (DataLength % 4 != 0)
            {
                DataLength += 4 - (DataLength % 4);
            }

            FilterNames  = set.Filters.Select(f => f.ID).ToList();
            IntegerNames = set.Reads.Select(f => f.ID).ToList();
        }
Exemple #2
0
 private int MaxDistanceToRoot()
 {
     if (ProtocolLibrary.GetRoot().Equals(this))
     {
         return(0);
     }
     return(Parents.Select(parent => parent.MaxDistanceToRoot()).Max() + 1);
 }
Exemple #3
0
        public static void Compile(List <Protocol> protocols)
        {
            Layers.Clear();
            ProgramSet.RuleProgram.Clear();

            var rootLayer = new ProgramLayer();

            rootLayer.AddProtocol(ProtocolLibrary.GetRoot());
            Layers.Add(rootLayer);

            foreach (var p in protocols)
            {
                AddProtocol(p);
            }

            Validate();

            //generate the program set beased on statically available Layers var
            ProgramSet.Generate();
        }