public PointMetaDataString(ByteBuffer buffer, BitStream bitStream, MeasurementTypeCode code, int referenceId) : base(buffer, bitStream, code, referenceId) { Mode = 4; Mode4_1 = Codes64.Value1; Mode4_01 = Codes64.Value2; Mode4_001 = Codes64.Value3; }
protected PointMetaData(ByteBuffer buffer, BitStream bitStream, MeasurementTypeCode code, int referenceId) { Buffer = buffer; BitStream = bitStream; m_commandsSentSinceLastChange = 0; m_commandStats = new byte[64]; Mode = 1; Code = code; ReferenceId = referenceId; }
public int ReadCode(BitStream bitStream) { int code = 0; switch (Mode) { case 1: code = bitStream.ReadBits6(); break; case 2: if (bitStream.ReadBit() == 1) { code = Mode2_1; } else { code = bitStream.ReadBits6(); } break; case 3: if (bitStream.ReadBit() == 1) { code = Mode3_1; } else if (bitStream.ReadBit() == 1) { code = Mode3_01; } else { code = bitStream.ReadBits6(); } break; case 4: if (bitStream.ReadBit() == 1) { code = Mode4_1; } else if (bitStream.ReadBit() == 1) { code = Mode4_01; } else if (bitStream.ReadBit() == 1) { code = Mode4_001; } else { code = bitStream.ReadBits6(); } break; default: throw new Exception("Unsupported compression mode"); } m_commandStats[code]++; m_commandsSentSinceLastChange++; if (m_startupMode == 0 && m_commandsSentSinceLastChange > 5) { m_startupMode++; AdaptCommands2(); } else if (m_startupMode == 1 && m_commandsSentSinceLastChange > 20) { m_startupMode++; AdaptCommands2(); } else if (m_startupMode == 2 && m_commandsSentSinceLastChange > 100) { AdaptCommands2(); } return code; }