/*
	ZBinaryFileWriter.hpp
	Author: Chris Ertel <crertel@762studios.com>, Patrick Baggett <ptbaggett@762studios.com>
	Created: 3/11/2013

	Purpose: 

	Writes a binary stream from a SST_File handle. NOTE: On 32-bit platforms, only files up to 4GB are supported.

	License:

	TODO

*/

#pragma once

#ifndef _ZBINARYFILEWRITER_HPP
#define _ZBINARYFILEWRITER_HPP

#include <SST/SST_File.h>
#include <ZUtil/ZBinaryWriter.hpp>

class ZBinaryFileWriter : public ZBinaryWriter
{
	public:
		ZBinaryFileWriter(SST_File handle, SST_ByteOrder bo);

		//Subclass implementation
		void WriteU8(uint8_t v);

		//Subclass implementation
		void WriteU16(uint16_t v);

		//Subclass implementation
		void WriteU32(uint32_t v);

		//Subclass implementation
		void WriteU64(uint64_t v);

		//Subclass implementation
		void WriteU8Array(const uint8_t* v, size_t count);

		//Subclass implementation
		void WriteU16Array(const uint16_t* v, size_t count);

		//Subclass implementation
		void WriteU32Array(const uint32_t* v, size_t count);

		//Subclass implementation
		void WriteU64Array(const uint64_t* v, size_t count);

		//Subclass implementation
		size_t GetOffset() const { return Offset; }

		//Subclass implementation
		void SeekTo(size_t offset);

		//Unique to ZBinaryFileWriter
		SST_File GetFileHandle() { return fp; }

	private:
		SST_File fp;
		size_t Offset;
};

#endif

