// ------------------------------------------------------------------------
/*
	author: Jaap Suter
   
	Copyright (C) Electronic Arts Canada Inc. 2002.  All rights reserved.	
*/
// ------------------------------------------------------------------------

/*! \file */

#ifndef REVEAL_SERIALIZE_H
#define REVEAL_SERIALIZE_H

#include <stddef.h>

namespace Reveal {

// ------------------------------------------------------------------------------
/*!
	\brief This class provides the interface abstraction for serialization 
			of Reveal values;
*/
// ------------------------------------------------------------------------------
class Serialize
{
public:
	virtual ~Serialize() {}

	//! The implementation should provide a set of files we can write to. This enumeration
	//! identifies the different files. Where you put them is up to you, e.g. I don't care;
	typedef enum
	{
		FILE_0,
		FILE_1,
		FILE_2,
		FILE_3
	} File;

	//! Saves the given buffer to the given file;
	void Save( File f, const char* data );

	//! Loads the file into the given buffer;
	void Load( File f, char* buffer, size_t size );

private:

	//! You must implement this function;
	//! This function should save the given string to the file associated with the given identifier;
	//! \warning Don't append, but write from scratch. I already take care of the merging, etc.
	virtual void DoSave( File f, const char* data ) = 0;

	//! You must implement this function;
	//! This function should fill the given buffer with the data in the file associated with the given
	//! identifier;
	//! \warning, you can write less than \a size bytes, but no more. If there is more data in the file, just
	//!			  discard it;
	virtual void DoLoad( File f, char* buffer, size_t size ) = 0;	
};

} // Namespace Reveal;

#endif
