示例#1
0
        /// <summary>
        /// Create a new list to store the event variable values associated with an event of the specified type.
        /// </summary>
        /// <param name="identifier">The identifier associated with the event.</param>
        /// <returns>The list of event variables specific to the event with the specified identifier.</returns>
        public List <EventVariable> CreateEventVariableList(short identifier)
        {
            Debug.Assert(identifier >= 0, "EventTable.GetEventVariableList");

            int             structIdentifier;
            List <Struct_t> structList;

            List <EventVariable> eventVariableList = new List <EventVariable>();

            try
            {
                // ----------------------------------------------------------------------------------------------------------------------------------------------
                // Get the event variables that are collected for each event i.e. those defined with the structure identifier 0 less those defined as event header
                // variables.
                // ----------------------------------------------------------------------------------------------------------------------------------------------
                structList = m_StructLists[0];

                // Add the event variables that are common to all events. These are the event variables contained within the STRUCT generic list corresponding to
                // structure identifier 0, less those event variables defined as header event variables.
                for (int index = HeaderEventVariableCount; index < structList.Count; index++)
                {
                    // Ensure that a new instance of the event variable is created.
                    EventVariable eventVariable = new EventVariable();
                    Lookup.EventVariableTable.Items[structList[index].EventVariableIdentifier].CopyTo(ref eventVariable);
                    eventVariableList.Add(eventVariable);
                }

                structIdentifier = Items[identifier].StructureIdentifier;
                structList       = m_StructLists[structIdentifier];

                // Add the event variables corresponding to the event variable identifier contained within the list.
                for (int index = 0; index < structList.Count; index++)
                {
                    EventVariable eventVariable = new EventVariable();
                    Lookup.EventVariableTable.Items[structList[index].EventVariableIdentifier].CopyTo(ref eventVariable);
                    eventVariableList.Add(eventVariable);
                }
            }
            catch (Exception)
            {
                // Ensure that an exception isn't thrown.
            }

            return(eventVariableList);
        }
        /// <summary>
        /// Copy all property values to the specified event variable.
        /// </summary>
        /// <param name="eventVariable">The event variable that the property values are to be copied to.</param>
        public void CopyTo(ref EventVariable eventVariable)
        {
            // EventVariable
            eventVariable.ConversionFactor = ConversionFactor;

            // Variable
            eventVariable.Name               = Name;
            eventVariable.DataType           = DataType;
            eventVariable.VariableType       = VariableType;
            eventVariable.ScaleFactor        = ScaleFactor;
            eventVariable.EnumBitIdentifier  = EnumBitIdentifier;
            eventVariable.IsBitMask          = IsBitMask;
            eventVariable.Units              = Units;
            eventVariable.FormatString       = FormatString;
            eventVariable.ValueFromTarget    = ValueFromTarget;
            eventVariable.DataTypeFromTarget = DataTypeFromTarget;

            // Record
            eventVariable.Identifier = Identifier;
            eventVariable.HelpIndex  = HelpIndex;
        }
示例#3
0
        /// <summary>
        /// Copy all property values to the specified event variable.
        /// </summary>
        /// <param name="eventVariable">The event variable that the property values are to be copied to.</param>
        public void CopyTo(ref EventVariable eventVariable)
        {
            // EventVariable
            eventVariable.ConversionFactor = ConversionFactor;

            // Variable
            eventVariable.Name = Name;
            eventVariable.DataType = DataType;
            eventVariable.VariableType = VariableType;
            eventVariable.ScaleFactor = ScaleFactor;
            eventVariable.EnumBitIdentifier = EnumBitIdentifier;
            eventVariable.IsBitMask = IsBitMask;
            eventVariable.Units = Units;
            eventVariable.FormatString = FormatString;
            eventVariable.ValueFromTarget = ValueFromTarget;
            eventVariable.DataTypeFromTarget = DataTypeFromTarget;
            
            // Record
            eventVariable.Identifier = Identifier;
            eventVariable.HelpIndex = HelpIndex;
        }