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
Exemple #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);
        }
Exemple #2
0
        private int GetByteSize(ScalarElement scalar)
        {
            if ((object)scalar == null)
            {
                return(0);
            }

            return(scalar.TypeOfValue.GetByteSize());
        }
Exemple #3
0
        // 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);
        }
Exemple #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);
        }
Exemple #5
0
        private int GetByteSize(ScalarElement scalar)
        {
            if ((object)scalar == null)
                return 0;

            return scalar.TypeOfValue.GetByteSize();
        }
Exemple #6
0
 private void WriteScalar(BinaryWriter writer, ScalarElement scalar)
 {
     writer.Write(scalar.GetValue());
 }
Exemple #7
0
        // 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;
        }
Exemple #8
0
 private void WriteScalar(BinaryWriter writer, ScalarElement scalar)
 {
     writer.Write(scalar.GetValue());
 }