示例#1
0
        /// <summary>
        /// Adds a new channel instance to the collection
        /// of channel instances in this observation record.
        /// </summary>
        /// <param name="channelDefinition">Channel definition to use for looking up channel definition index of new channel instance.</param>
        /// <returns>NEw channel instance.</returns>
        public ChannelInstance AddNewChannelInstance(ChannelDefinition channelDefinition)
        {
            CollectionElement channelInstanceElement = new CollectionElement()
            {
                TagOfElement = OneChannelInstanceTag
            };
            ChannelInstance channelInstance = new ChannelInstance(channelInstanceElement, this);

            channelInstance.ChannelDefinitionIndex = (uint)channelDefinition.DataSource.ChannelDefinitions.IndexOf(channelDefinition);
            channelInstanceElement.AddElement(new CollectionElement()
            {
                TagOfElement = ChannelInstance.SeriesInstancesTag
            });

            CollectionElement?channelInstancesElement = PhysicalRecord.Body.Collection.GetCollectionByTag(ChannelInstancesTag);

            if (channelInstancesElement == null)
            {
                channelInstancesElement = new CollectionElement()
                {
                    TagOfElement = ChannelInstancesTag
                };
                PhysicalRecord.Body.Collection.AddElement(channelInstancesElement);
            }

            channelInstancesElement.AddElement(channelInstanceElement);

            return(channelInstance);
        }
示例#2
0
        /// <summary>
        /// Adds a new channel setting to the collection
        /// of channel settings in this monitor settings record.
        /// </summary>
        /// <param name="channelDefinition">Channel definition to use for looking up channel definition index of new channel setting.</param>
        /// <returns>New channel setting.</returns>
        public ChannelSetting AddNewChannelSetting(ChannelDefinition channelDefinition)
        {
            CollectionElement channelSettingElement = new CollectionElement()
            {
                TagOfElement = OneChannelSettingTag
            };
            ChannelSetting channelSetting = new ChannelSetting(channelSettingElement, this);

            channelSetting.ChannelDefinitionIndex = (uint)channelDefinition.DataSource.ChannelDefinitions.IndexOf(channelDefinition);

            CollectionElement?channelSettingsElement = PhysicalRecord.Body.Collection.GetCollectionByTag(ChannelSettingsArrayTag);

            if (channelSettingsElement == null)
            {
                channelSettingsElement = new CollectionElement()
                {
                    TagOfElement = OneChannelSettingTag
                };
                PhysicalRecord.Body.Collection.AddElement(channelSettingsElement);
            }

            channelSettingsElement.AddElement(channelSettingElement);

            return(channelSetting);
        }
示例#3
0
        /// <summary>
        /// Adds a new channel definition to the collection
        /// of channel definitions in this data source record.
        /// </summary>
        /// <returns>New channel definition.</returns>
        public ChannelDefinition AddNewChannelDefinition()
        {
            CollectionElement channelDefinitionElement = new CollectionElement()
            {
                TagOfElement = OneChannelDefinitionTag
            };
            ChannelDefinition channelDefinition = new ChannelDefinition(channelDefinitionElement, this);

            channelDefinition.Phase            = Phase.None;
            channelDefinition.QuantityMeasured = QuantityMeasured.None;
            channelDefinitionElement.AddElement(new CollectionElement()
            {
                TagOfElement = ChannelDefinition.SeriesDefinitionsTag
            });

            CollectionElement?channelDefinitionsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelDefinitionsTag);

            if (channelDefinitionsElement == null)
            {
                channelDefinitionsElement = new CollectionElement()
                {
                    TagOfElement = ChannelDefinitionsTag
                };
                m_physicalRecord.Body.Collection.AddElement(channelDefinitionsElement);
            }

            channelDefinitionsElement.AddElement(channelDefinitionElement);

            return(channelDefinition);
        }
示例#4
0
        /// <summary>
        /// Removes the given channel definition from the collection of channel definitions.
        /// </summary>
        /// <param name="channelDefinition">The channel definition to be removed.</param>
        public void Remove(ChannelDefinition channelDefinition)
        {
            CollectionElement?channelDefinitionsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelDefinitionsTag);

            if (channelDefinitionsElement == null)
            {
                return;
            }

            List <CollectionElement> channelDefinitionElements = channelDefinitionsElement.GetElementsByTag(OneChannelDefinitionTag).Cast <CollectionElement>().ToList();

            foreach (CollectionElement channelDefinitionElement in channelDefinitionElements)
            {
                ChannelDefinition definition = new ChannelDefinition(channelDefinitionElement, this);

                if (Equals(channelDefinition, definition))
                {
                    channelDefinitionsElement.RemoveElement(channelDefinitionElement);
                }
            }
        }
示例#5
0
 /// <summary>
 /// Creates a new instance of the <see cref="SeriesDefinition"/> class.
 /// </summary>
 /// <param name="physicalStructure">The collection that is the physical structure of the series definition.</param>
 /// <param name="channelDefinition">The channel definition in which the series definition resides.</param>
 public SeriesDefinition(CollectionElement physicalStructure, ChannelDefinition channelDefinition)
 {
     PhysicalStructure = physicalStructure;
     ChannelDefinition = channelDefinition;
 }