/// <summary> /// Get the data type size. Some of the data types have a fixed size. /// The others depend on the number of depth cells. /// </summary> /// <param name="dataType">Data type.</param> /// <returns>Number of bytes for each data types.</returns> public int GetDataTypeSize(Pd0DataType dataType) { switch (dataType.ID.Type) { case Pd0ID.Pd0Types.Header: return(GetDataTypeSize()); // Sized based of number of type types case Pd0ID.Pd0Types.FixedLeader: return(Pd0FixedLeader.DATATYPE_SIZE); // Fixed size case Pd0ID.Pd0Types.VariableLeader: return(Pd0VariableLeader.DATATYPE_SIZE); // Fixed size case Pd0ID.Pd0Types.BottomTrack: return(Pd0BottomTrack.DATATYPE_SIZE); // Fixed size case Pd0ID.Pd0Types.Velocity: return(GetVelocitySize()); // 2 Bytes for every beam, 4 beams for every depth cell case Pd0ID.Pd0Types.Correlation: case Pd0ID.Pd0Types.EchoIntensity: case Pd0ID.Pd0Types.PercentGood: return(GetCorrEchoPerGdSize()); // 1 Byte for every beam, 4 beams for every depth cell case Pd0ID.Pd0Types.NmeaData: //return GetNmeaDataSize(); // Varies based of NMEA data return(dataType.GetDataTypeSize()); default: return(0); } }
/// <summary> /// Add the data type to the ensemble. /// </summary> /// <param name="dataType">Data type.</param> public void AddDataType(Pd0DataType dataType) { // Increase the number of bytes // Add 2 for the offset added to the header NumberOfBytes += GetDataTypeSize(dataType) + 2; if (!DataTypes.ContainsKey(dataType.ID.Type)) { // Add the offset to the list DataTypes.Add(dataType.ID.Type, dataType); } else { Debug.WriteLine("Data type already exist." + dataType.ID.Type); } }
/// <summary> /// Get the data type size. Some of the data types have a fixed size. /// The others depend on the number of depth cells. /// </summary> /// <param name="dataType">Data type.</param> /// <returns>Number of bytes for each data types.</returns> public int GetDataTypeSize(Pd0DataType dataType) { switch(dataType.ID.Type) { case Pd0ID.Pd0Types.Header: return GetDataTypeSize(); // Sized based of number of type types case Pd0ID.Pd0Types.FixedLeader: return Pd0FixedLeader.DATATYPE_SIZE; // Fixed size case Pd0ID.Pd0Types.VariableLeader: return Pd0VariableLeader.DATATYPE_SIZE; // Fixed size case Pd0ID.Pd0Types.BottomTrack: return Pd0BottomTrack.DATATYPE_SIZE; // Fixed size case Pd0ID.Pd0Types.Velocity: return GetVelocitySize(); // 2 Bytes for every beam, 4 beams for every depth cell case Pd0ID.Pd0Types.Correlation: case Pd0ID.Pd0Types.EchoIntensity: case Pd0ID.Pd0Types.PercentGood: return GetCorrEchoPerGdSize(); // 1 Byte for every beam, 4 beams for every depth cell default: return 0; } }
/// <summary> /// Add the data type to the ensemble. /// </summary> /// <param name="dataType">Data type.</param> public void AddDataType(Pd0DataType dataType) { // Increase the number of bytes // Add 2 for the offset added to the header NumberOfBytes += GetDataTypeSize(dataType) + 2; // Add the offset to the list DataTypes.Add(dataType.ID.Type, dataType); }
/// <summary> /// Added the data type to the ensemble. /// </summary> /// <param name="dataType">Data type.</param> public void AddDataType(Pd0DataType dataType) { Header.AddDataType(dataType); }