Represents an Element which is a collection of values in a PQDIF file. Vector 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 values contained by the vector element identified by the given tag
        /// or adds a new vector element if one does not already exist.
        /// </summary>
        /// <param name="tag">The tag which identifies the vector element to be updated.</param>
        /// <param name="type">The physical type of the values contained in the vector element.</param>
        /// <param name="bytes">The values to be entered into the vector element.</param>
        /// <returns>The vector element which was updated, or a new vector element if one did not already exist.</returns>
        public VectorElement AddOrUpdateVector(Guid tag, PhysicalType type, byte[] bytes)
        {
            VectorElement vectorElement = GetOrAddVector(tag);

            vectorElement.TypeOfValue = type;
            vectorElement.Size        = bytes.Length / type.GetByteSize();
            vectorElement.SetValues(bytes, 0);
            return(vectorElement);
        }
コード例 #2
0
        private int GetByteSize(VectorElement vector)
        {
            if ((object)vector == null)
            {
                return(0);
            }

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

            byte[] values = recordBodyReader.ReadBytes(element.Size * typeOfValue.GetByteSize());

            element.SetValues(values, 0);

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

            if ((object)vectorElement == null)
            {
                vectorElement = new VectorElement()
                {
                    TagOfElement = tag
                };

                AddElement(vectorElement);
            }

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

            return 4 + (vector.Size * vector.TypeOfValue.GetByteSize());
        }
コード例 #6
0
ファイル: PhysicalWriter.cs プロジェクト: avs009/gsf
 private void WriteVector(BinaryWriter writer, VectorElement vector)
 {
     writer.Write(vector.Size);
     writer.Write(vector.GetValues());
 }
コード例 #7
0
ファイル: PhysicalParser.cs プロジェクト: avs009/gsf
        // Reads a vector element from the PQDIF file.
        private VectorElement ReadVector(BinaryReader recordBodyReader, PhysicalType typeOfValue)
        {
            VectorElement element = new VectorElement()
            {
                Size = recordBodyReader.ReadInt32(),
                TypeOfValue = typeOfValue
            };

            byte[] values = recordBodyReader.ReadBytes(element.Size * typeOfValue.GetByteSize());

            element.SetValues(values, 0);

            return element;
        }
コード例 #8
0
 private void WriteVector(BinaryWriter writer, VectorElement vector)
 {
     writer.Write(vector.Size);
     writer.Write(vector.GetValues());
 }