public int Read(IntPtr ptr, out TaggedKeyValue <TKey, TValue> value, out Timestamp timestamp) { //var fixedSize = TypeHelper<TaggedKeyValue<TKey, TValue>>.FixedSize; //if (fixedSize > 0) //{ // return BinarySerializer.Read(ptr, out value, out timestamp); //} throw new NotImplementedException(); }
public int Write(TaggedKeyValue <TKey, TValue> value, IntPtr pinnedDestination, MemoryStream temporaryStream = null, SerializationFormat format = SerializationFormat.Binary, Timestamp timestamp = default) { //var fixedSize = TypeHelper<TaggedKeyValue<TKey, TValue>>.FixedSize; //if (fixedSize > 0) //{ // return BinarySerializer.WriteUnsafe(value, pinnedDestination, temporaryStream, format, timestamp); //} //// TODO write key + value throw new NotImplementedException(); }
// TODO for version 0 write using BS with double headers // TODO special treatment of TKey=DateTime, autolayout public int SizeOf(TaggedKeyValue <TKey, TValue> value, out MemoryStream temporaryStream, SerializationFormat format = SerializationFormat.Binary, Timestamp timestamp = default) { if (IsFixedSizeStatic) { temporaryStream = default; return(FixedSizeStatic + ((long)timestamp == default ? 0 : Timestamp.Size)); } throw new NotImplementedException(); }
public void Serialize(ref JsonWriter writer, TaggedKeyValue <TKey, TValue> value, IJsonFormatterResolver formatterResolver) { writer.WriteBeginArray(); writer.WriteByte(value.Tag); writer.WriteValueSeparator(); formatterResolver.GetFormatterWithVerify <TKey>().Serialize(ref writer, value.Key, formatterResolver); writer.WriteValueSeparator(); formatterResolver.GetFormatterWithVerify <TValue>().Serialize(ref writer, value.Value, formatterResolver); writer.WriteEndArray(); }
public bool Equals(TaggedKeyValue <TKey, TValue> other) { return(Tag == other.Tag && EqualityComparer <TKey> .Default.Equals(Key, other.Key) && EqualityComparer <TValue> .Default.Equals(Value, other.Value)); }