#if !NO_RUNTIME
using System;
#if FEAT_IKVM
using Type = IKVM.Reflection.Type;
#endif
namespace ProtoBuf.Serializers
{
interface IProtoSerializer
{
///
/// The type that this serializer is intended to work for.
///
Type ExpectedType { get; }
#if !FEAT_IKVM
///
/// Perform the steps necessary to serialize this data.
///
/// The value to be serialized.
/// The writer entity that is accumulating the output data.
void Write(object value, ProtoWriter dest);
///
/// Perform the steps necessary to deserialize this data.
///
/// The current value, if appropriate.
/// The reader providing the input data.
/// The updated / replacement value.
object Read(object value, ProtoReader source);
#endif
///
/// Indicates whether a Read operation replaces the existing value, or
/// extends the value. If false, the "value" parameter to Read is
/// discarded, and should be passed in as null.
///
bool RequiresOldValue { get; }
///
/// Now all Read operations return a value (although most do); if false no
/// value should be expected.
///
bool ReturnsValue { get; }
#if FEAT_COMPILER
/// Emit the IL necessary to perform the given actions
/// to serialize this data.
///
/// Details and utilities for the method being generated.
/// The source of the data to work against;
/// If the value is only needed once, then LoadValue is sufficient. If
/// the value is needed multiple times, then note that a "null"
/// means "the top of the stack", in which case you should create your
/// own copy - GetLocalWithValue.
void EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom);
///
/// Emit the IL necessary to perform the given actions to deserialize this data.
///
/// Details and utilities for the method being generated.
/// For nested values, the instance holding the values; note
/// that this is not always provided - a null means not supplied. Since this is always
/// a variable or argument, it is not necessary to consume this value.
void EmitRead(Compiler.CompilerContext ctx, Compiler.Local entity);
#endif
}
}
#endif