/*
OpenNxSerialization Framework
Copyright (C) 2006 - 2008 "NeXtreme Innovations"
[The Next Xtreme Innovations]
This program is free software, distributed under the terms of
the GNU General Public License Version 2. See the "License.txt" file
at the top of the source tree.
*/
using System;
using NeXtreme.OpenNxSerialization.IO;
namespace NeXtreme.OpenNxSerialization
{
/// <summary>
/// Implementations of <see cref="INxSerializable"/> can add their state directly to the output stream,
/// enabling them to bypass costly serialization.
/// </summary>
/// <remarks>
/// Objects that implement <see cref="INxSerializable"/> must have a default
/// constructor (can be private).
/// <para>
/// As per current implementation when a <see cref="INxSerializable"/> is deserialized
/// the default constructor is not invoked, therefore the object must "construct" itself in
/// <see cref="INxSerializable.Deserialize"/>.
/// </para>
/// </remarks>
public interface INxSerializable
{
/// <summary>
/// Load the state from the passed stream reader object.
/// </summary>
/// <param name="reader">A <see cref="INxBinaryReader"/> object</param>
/// <remarks>
/// As per current implementation when a <see cref="INxSerializable"/> is deserialized
/// the default constructor is not invoked, therefore the object must "construct" itself in
/// <see cref="INxSerializable.Deserialize"/>.
/// </remarks>
void Deserialize(INxBinaryReader reader);
/// <summary>
/// Save the the state to the passed stream reader object.
/// </summary>
/// <param name="writer">A <see cref="INxBinaryWriter"/> object</param>
void Serialize(INxBinaryWriter writer);
}
}