/// <inheritdoc />
        public override CtfFieldValue Read(IPacketReader reader, CtfFieldValue parent = null)
        {
            Guard.NotNull(reader, nameof(reader));

            reader.Align((uint)this.Align);

            var structValue = new CtfStructValue();

            foreach (var ctfField in this.Fields)
            {
                CtfFieldValue field = null;
                try
                {
                    field = ctfField.Read(reader, structValue);
                }
                catch (InvalidOperationException)
                {
                    continue;
                }
                bool addedField = structValue.AddValue(field);
                Debug.Assert(addedField);
            }

            return(structValue);
        }
 public static ContextSwitchUserData Read(CtfStructValue data)
 {
     return(new ContextSwitchUserData
     {
         PrevComm = data.ReadFieldAsArray("_prev_comm").ReadAsString(),
         PrevTid = data.ReadFieldAsInt32("_prev_tid"),
         PrevPrio = data.ReadFieldAsInt32("_prev_prio"),
         PrevState = data.ReadFieldAsInt64("_prev_state"),
         NextComm = data.ReadFieldAsArray("_next_comm").ReadAsString(),
         NextTid = data.ReadFieldAsInt32("_next_tid"),
         NextPrio = data.ReadFieldAsInt32("_next_prio")
     });
 }