Represents an Element which is a single value in a PQDIF file. Scalar elements are part of the physical structure of a PQDIF file. They exist within the body of a Record (contained by a CollectionElement).
Inheritance: GSF.PQDIF.Physical.Element
コード例 #1
0
        /// <summary>
        /// Updates the value of the scalar element identified by the given tag
        /// or adds a new scalar element if one does not already exist.
        /// </summary>
        /// <param name="tag">The tag which identifies the scalar element to be updated.</param>
        /// <param name="type">The physical type of the value contained in the scalar element.</param>
        /// <param name="bytes">The value to be entered into the scalar element.</param>
        /// <returns>The scalar element which was updated, or a new scalar element if one did not already exist.</returns>
        public ScalarElement AddOrUpdateScalar(Guid tag, PhysicalType type, byte[] bytes)
        {
            ScalarElement scalarElement = GetOrAddScalar(tag);

            scalarElement.TypeOfValue = type;
            scalarElement.SetValue(bytes, 0);
            return(scalarElement);
        }
コード例 #2
0
        private int GetByteSize(ScalarElement scalar)
        {
            if ((object)scalar == null)
            {
                return(0);
            }

            return(scalar.TypeOfValue.GetByteSize());
        }
コード例 #3
0
ファイル: PhysicalParser.cs プロジェクト: ellen50/gsf
        // Reads a scalar element from the PQDIF file.
        private ScalarElement ReadScalar(BinaryReader recordBodyReader, PhysicalType typeOfValue)
        {
            ScalarElement element = new ScalarElement()
            {
                TypeOfValue = typeOfValue
            };

            byte[] value = recordBodyReader.ReadBytes(typeOfValue.GetByteSize());

            element.SetValue(value, 0);

            return(element);
        }
コード例 #4
0
        /// <summary>
        /// Gets the scalar element identified by the given tag
        /// or adds a new scalar element if one does not already exist.
        /// </summary>
        /// <param name="tag">The tag which identifies the scalar element to be retrieved.</param>
        /// <returns>The scalar element identified by the tag, or a new scalar element if one did not already exist.</returns>
        public ScalarElement GetOrAddScalar(Guid tag)
        {
            ScalarElement scalarElement = GetScalarByTag(tag);

            if ((object)scalarElement == null)
            {
                scalarElement = new ScalarElement()
                {
                    TagOfElement = tag
                };

                AddElement(scalarElement);
            }

            return(scalarElement);
        }
コード例 #5
0
ファイル: PhysicalWriter.cs プロジェクト: avs009/gsf
        private int GetByteSize(ScalarElement scalar)
        {
            if ((object)scalar == null)
                return 0;

            return scalar.TypeOfValue.GetByteSize();
        }
コード例 #6
0
ファイル: PhysicalWriter.cs プロジェクト: avs009/gsf
 private void WriteScalar(BinaryWriter writer, ScalarElement scalar)
 {
     writer.Write(scalar.GetValue());
 }
コード例 #7
0
ファイル: PhysicalParser.cs プロジェクト: avs009/gsf
        // Reads a scalar element from the PQDIF file.
        private ScalarElement ReadScalar(BinaryReader recordBodyReader, PhysicalType typeOfValue)
        {
            ScalarElement element = new ScalarElement()
            {
                TypeOfValue = typeOfValue
            };

            byte[] value = recordBodyReader.ReadBytes(typeOfValue.GetByteSize());

            element.SetValue(value, 0);

            return element;
        }
コード例 #8
0
 private void WriteScalar(BinaryWriter writer, ScalarElement scalar)
 {
     writer.Write(scalar.GetValue());
 }