public override void Write(BinaryStreamBase stream) { stream.Write(CollectedTime); stream.Write(TableId); stream.Write(DataLength); stream.Write(Data, 0, Data.Length); }
public override void Write(BinaryStreamBase stream) { stream.Write(Timestamp); stream.Write(PointID); stream.Write(TableId); stream.Write(CollectedTime); }
/// <summary> /// Writes this data to the <see cref="stream"/>. /// </summary> /// <param name="stream">the stream to write data to</param> public void Save(BinaryStreamBase stream) { stream.Write((byte)0); stream.Write(Timeout.Ticks); stream.Write(MaxReturnedCount); stream.Write(MaxScanCount); stream.Write(MaxSeekCount); }
public override void Save(BinaryStreamBase stream) { stream.Write((byte)1); //Stored as array of uint[] stream.Write(m_maxValue); stream.Write(m_points.Count); foreach (uint x in m_points) { stream.Write(x); } }
public override void Save(BinaryStreamBase stream) { stream.Write((byte)1); //Stored as array of uint[] stream.Write(MaxValue); stream.Write(m_points.SetCount); foreach (int x in m_points.GetAllSetBits()) { stream.Write((uint)x); } }
/// <summary> /// Writes the end of the stream symbol to the <see cref="stream"/>. /// </summary> /// <param name="stream">the stream to write to</param> public override void WriteEndOfStream(BinaryStreamBase stream) { if (m_encoding.ContainsEndOfStreamSymbol) { stream.Write(m_encoding.EndOfStreamSymbol); } else { stream.Write((byte)0); } }
public void Save(BinaryStreamBase stream) { stream.Write((byte)1); stream.Write(DatabaseName); stream.Write(KeyTypeID); stream.Write(ValueTypeID); stream.Write(SupportedStreamingModes.Count); foreach (EncodingDefinition encoding in SupportedStreamingModes) { encoding.Save(stream); } }
/// <summary> /// Serializes the <see cref="EncodingDefinition"/> to the provided <see cref="stream"/> /// </summary> /// <param name="stream">the stream to write to</param> public void Save(BinaryStreamBase stream) { if (IsKeyValueEncoded) { stream.Write((byte)1); stream.Write(KeyValueEncodingMethod); } else { stream.Write((byte)2); stream.Write(KeyEncodingMethod); stream.Write(ValueEncodingMethod); } }
private static void SelfTest() { UnmanagedMemoryStream ms1 = new UnmanagedMemoryStream(); BinaryStreamBase ms = ms1.CreateBinaryStream(); Random rand = new Random(); int seed = rand.Next(); rand = new Random(seed); byte[] data = new byte[255]; rand.NextBytes(data); while (ms.Position < 1000000) { ms.Write(data, 0, rand.Next(256)); } byte[] data2 = new byte[255]; rand = new Random(seed); rand.NextBytes(data2); ms.Position = 0; Compare(data, data2, 255); while (ms.Position < 1000000) { int length = rand.Next(256); ms.ReadAll(data2, 0, length); Compare(data, data2, length); } ms.Dispose(); ms1.Dispose(); }
public unsafe override void Encode(BinaryStreamBase stream, HistorianKey prevKey, HistorianValue prevValue, HistorianKey key, HistorianValue value) { byte *ptr = stackalloc byte[MaxCompressionSize]; int length = Encode(ptr, prevKey, prevValue, key, value); stream.Write(ptr, length); }
/// <summary> /// Encodes the current key/value to the stream. /// </summary> /// <param name="stream">the stream to write to</param> /// <param name="currentKey">the key to write</param> /// <param name="currentValue">the value to write</param> public override void Encode(BinaryStreamBase stream, TKey currentKey, TValue currentValue) { if (!m_encoding.ContainsEndOfStreamSymbol) { stream.Write((byte)1); } m_encoding.Encode(stream, m_prevKey, m_prevValue, currentKey, currentValue); currentKey.CopyTo(m_prevKey); currentValue.CopyTo(m_prevValue); }
/// <summary> /// Writes the first page of the SortedTree as long as the <see cref="IsDirty"/> flag is set. /// After returning, the IsDirty flag is cleared. /// </summary> public void SaveHeader(BinaryStreamBase stream) { if (!IsDirty) { return; } long oldPosotion = stream.Position; stream.Position = 0; stream.Write((byte)1); stream.Write(BlockSize); TreeNodeType.Save(stream); stream.Write(LastAllocatedBlock); stream.Write(RootNodeIndexAddress); //Root Index stream.Write(RootNodeLevel); //Root Index stream.Position = oldPosotion; m_isDirty = false; }
public unsafe override void Encode(BinaryStreamBase stream, AmiKey prevKey, AmiValue prevValue, AmiKey key, AmiValue value) { stream.Write(key.Timestamp); stream.Write(key.PointID); stream.Write(value.CollectedTime); stream.Write(value.TableId); stream.Write(value.DataLength); stream.Write(value.Data, 0, value.DataLength); }
/// <summary> /// Serializes the filter to a stream /// </summary> /// <param name="stream">the stream to write to</param> public override void Save(BinaryStreamBase stream) { stream.Write((byte)2); //Stored with interval data stream.Write(m_start); stream.Write(m_stop); stream.Write(m_mainInterval); stream.Write(m_subInterval); stream.Write(m_tolerance); }
public override void Write(BinaryStreamBase stream) { stream.Write(Timestamp); stream.Write(PointID); stream.Write(EntryNumber); }
public override void Write(BinaryStreamBase stream) { stream.Write(Value); }
public unsafe override void Encode(BinaryStreamBase stream, HistorianKey prevKey, HistorianValue prevValue, HistorianKey currentKey, HistorianValue currentValue) { if (currentKey.Timestamp == prevKey.Timestamp && ((currentKey.PointID ^ prevKey.PointID) < 64) && currentKey.EntryNumber == 0 && currentValue.Value1 <= uint.MaxValue && //must be a 32-bit value currentValue.Value2 == 0 && currentValue.Value3 == 0) { if (currentValue.Value1 == 0) { stream.Write((byte)((currentKey.PointID ^ prevKey.PointID))); } else { stream.Write((byte)((currentKey.PointID ^ prevKey.PointID) | 64)); stream.Write((uint)currentValue.Value1); } return; } byte code = 128; if (currentKey.Timestamp != prevKey.Timestamp) { code |= 64; } if (currentKey.EntryNumber != 0) { code |= 32; } if (currentValue.Value1 > uint.MaxValue) { code |= 16; } else if (currentValue.Value1 > 0) { code |= 8; } if (currentValue.Value2 != 0) { code |= 4; } if (currentValue.Value3 > uint.MaxValue) { code |= 2; } else if (currentValue.Value3 > 0) { code |= 1; } stream.Write(code); if (currentKey.Timestamp != prevKey.Timestamp) { stream.Write7Bit(currentKey.Timestamp ^ prevKey.Timestamp); } stream.Write7Bit(currentKey.PointID ^ prevKey.PointID); if (currentKey.EntryNumber != 0) { stream.Write7Bit(currentKey.EntryNumber); } if (currentValue.Value1 > uint.MaxValue) { stream.Write(currentValue.Value1); } else if (currentValue.Value1 > 0) { stream.Write((uint)currentValue.Value1); } if (currentValue.Value2 != 0) { stream.Write(currentValue.Value2); } if (currentValue.Value3 > uint.MaxValue) { stream.Write(currentValue.Value3); } else if (currentValue.Value3 > 0) { stream.Write((uint)currentValue.Value3); } }
/// <summary> /// Serializes the filter to a stream /// </summary> /// <param name="stream">the stream to write to</param> public override void Save(BinaryStreamBase stream) { stream.Write(m_keyToFind.Timestamp); stream.Write(m_keyToFind.PointID); }
/// <summary> /// Serializes the filter to a stream /// </summary> /// <param name="stream">the stream to write to</param> public override void Save(BinaryStreamBase stream) { stream.Write((byte)1); //stored as start/stop stream.Write(m_start); stream.Write(m_stop); }