
///////////////////////////////////////////////////////////////////////////////
//
// File   : Asura_Streaming_Job_StreamZoneDataState.h
// Author : Andy Tate
// Date   : 4-May-2006
//
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

// RJT NOTE: Required for GCC builds as the file list generation doesn't account for VC project exclusion from build
#ifdef ASURA_USE_STREAMING

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __ASURA_STREAMING_JOB_STREAMZONEDATASTATE_H__
#define __ASURA_STREAMING_JOB_STREAMZONEDATASTATE_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

#include "Core/Asura_Hash.h"
#include "Streaming/Jobs/Asura_Streaming_Job.h"


////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////

class Asura_Chunk_File_Stream;
class Asura_Streaming_Zone;
class Asura_Streaming_ZoneDataState;


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_Streaming_Job_CreateZoneSubsystemHandlers
// Author       : Andy Tate
// Date         : 8-May-2006
//
// Description  : Job to create the streaming-zone sub-system handlers to be
//				  used for the load which is currently pending.
////////////////////////////////////////////////////////////////////////////////

class Asura_Streaming_Job_CreateZoneSubsystemHandlers : public Asura_Streaming_Job
{
public:
	// Public functions...
	Asura_Streaming_Job_CreateZoneSubsystemHandlers          (Asura_Streaming_ZoneDataState& xZoneDataState, const bool bAllowEnvironment);
//	virtual ~Asura_Streaming_Job_CreateZoneSubsystemHandlers ();

	// Manipulation functions...
	virtual	void	BeginUpdate	(void);
	virtual	bool	Update		(float& fTimeAllowed);
	virtual	void	EndUpdate	(void);


protected:
	// Protected variables...


	// Protected functions...


private:
	// Private typedefs...
	typedef Asura_Streaming_Job PARENT;

	// Private variables...
	bool							m_bAllowEnvironment;	// Flag to say whether this zone should include environment.

	Asura_Streaming_ZoneDataState&	m_xZoneDataState;		// A reference to the zone data-state to use.
	Asura_Hash_ID					m_uOldZoneHash;			// The hash-ID of the current zone when we being the update.
	u_int							m_uHandlerIndex;		// The index of the handler currently being created.


	// Private functions...
	Asura_Streaming_Job_CreateZoneSubsystemHandlers  (void);
	Asura_Streaming_Job_CreateZoneSubsystemHandlers  (const Asura_Streaming_Job_CreateZoneSubsystemHandlers& xOther);

	Asura_Streaming_Job_CreateZoneSubsystemHandlers&	operator=	(const Asura_Streaming_Job_CreateZoneSubsystemHandlers& xOther);

};   // End of class 'Asura_Streaming_Job_CreateZoneSubsystemHandlers'.



////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_Streaming_Job_LoadZoneDataState
// Author       : Andy Tate
// Date         : 4-May-2006
//
// Description  : Job which covers the entirety of streaming the data required
//				  for the specified streaming-zone data-state.
////////////////////////////////////////////////////////////////////////////////

class Asura_Streaming_Job_LoadZoneDataState : public Asura_Streaming_Job
{
public:
	// Public functions...
	Asura_Streaming_Job_LoadZoneDataState          (Asura_Streaming_ZoneDataState& xZoneDataState);
//	virtual ~Asura_Streaming_Job_LoadZoneDataState ();

	// Manipulation functions...
	virtual	void	BeginUpdate	(void);
//	virtual	bool	Update		(float& fTimeAllowed);
	virtual	void	EndUpdate	(void);


protected:
	// Protected variables...


	// Protected functions...


private:
	// Internal typedef...
	typedef Asura_Streaming_Job PARENT;

	// Private variables...
	Asura_Streaming_ZoneDataState&	m_xZoneDataState;	// A reference to the zone data-state to use.
	Asura_Hash_ID					m_uOldZoneHash;		// The hash-ID of the current zone when we being the update.
	Asura_Chunk_File_Stream*		m_pxFileStream;		// A pointer to the file-stream to use when reading.


	// Private functions...
	Asura_Streaming_Job_LoadZoneDataState  (void);
	Asura_Streaming_Job_LoadZoneDataState  (const Asura_Streaming_Job_LoadZoneDataState& xOther);

	Asura_Streaming_Job_LoadZoneDataState&	operator=	(const Asura_Streaming_Job_LoadZoneDataState& xOther);

};   // End of class 'Asura_Streaming_Job_LoadZoneDataState'.



////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_Streaming_Job_LoadZoneDataStateComplete
// Author       : Andy Tate
// Date         : 5-May-2006
//
// Description  : Handles the completion of of streaming the specified
//				  streaming-zone data-state.
////////////////////////////////////////////////////////////////////////////////

class Asura_Streaming_Job_LoadZoneDataStateComplete : public Asura_Streaming_Job
{
public:
	// Public functions...
	Asura_Streaming_Job_LoadZoneDataStateComplete          (Asura_Streaming_ZoneDataState& xZoneDataState);
//	virtual ~Asura_Streaming_Job_LoadZoneDataStateComplete ();

	// Manipulation functions...
//	virtual	void	BeginUpdate	(void);
	virtual	bool	Update		(float& fTimeAllowed);
//	virtual	void	EndUpdate	(void);


protected:
	// Protected variables...


	// Protected functions...


private:
	// Internal typedef...
	typedef Asura_Streaming_Job PARENT;

	// Private variables...
	Asura_Streaming_ZoneDataState&	m_xZoneDataState;		// The data-state to mark as complete.


	// Private functions...
	Asura_Streaming_Job_LoadZoneDataStateComplete  (const Asura_Streaming_Job_LoadZoneDataStateComplete& xOther);

	Asura_Streaming_Job_LoadZoneDataStateComplete&	operator=	(const Asura_Streaming_Job_LoadZoneDataStateComplete& xOther);

};   // End of class 'Asura_Streaming_Job_LoadZoneDataStateComplete'.



////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_Streaming_Job_DestroyZoneSubsystemHandlers
// Author       : Andy Tate
// Date         : 8-May-2006
//
// Description  : Job to destroy the streaming-zone sub-system handlers to be
//				  used for the load which is currently pending.
////////////////////////////////////////////////////////////////////////////////

class Asura_Streaming_Job_DestroyZoneSubsystemHandlers : public Asura_Streaming_Job
{
public:
	// Public functions...
	Asura_Streaming_Job_DestroyZoneSubsystemHandlers          (Asura_Streaming_ZoneDataState& xZoneDataState, const bool bAllowEnvironment);
//	virtual ~Asura_Streaming_Job_DestroyZoneSubsystemHandlers ();

	// Manipulation functions...
	virtual	void	BeginUpdate	(void);
	virtual	bool	Update		(float& fTimeAllowed);
	virtual	void	EndUpdate	(void);


protected:
	// Protected variables...


	// Protected functions...


private:
	// Private typedefs...
	typedef Asura_Streaming_Job PARENT;

	// Private variables...
	bool							m_bAllowEnvironment;	// Flag to say whether this zone should include environment.

	Asura_Streaming_ZoneDataState&	m_xZoneDataState;		// A reference to the zone data-state to use.
	Asura_Hash_ID					m_uOldZoneHash;			// The hash-ID of the current zone when we being the update.
	u_int							m_uHandlerIndex;		// The index of the handler currently being created.


	// Private functions...
	Asura_Streaming_Job_DestroyZoneSubsystemHandlers  (void);
	Asura_Streaming_Job_DestroyZoneSubsystemHandlers  (const Asura_Streaming_Job_DestroyZoneSubsystemHandlers& xOther);

	Asura_Streaming_Job_DestroyZoneSubsystemHandlers&	operator=	(const Asura_Streaming_Job_DestroyZoneSubsystemHandlers& xOther);

};   // End of class 'Asura_Streaming_Job_DestroyZoneSubsystemHandlers'.



////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_Streaming_Job_DestroyZoneDataStateComplete
// Author       : Andy Tate
// Date         : 5-May-2006
//
// Description  : Handles the completion of of streaming the specified
//				  streaming-zone data-state.
////////////////////////////////////////////////////////////////////////////////

class Asura_Streaming_Job_DestroyZoneDataStateComplete : public Asura_Streaming_Job
{
public:
	// Public functions...
	Asura_Streaming_Job_DestroyZoneDataStateComplete          (Asura_Streaming_ZoneDataState& xZoneDataState);
//	virtual ~Asura_Streaming_Job_DestroyZoneDataStateComplete ();

	// Manipulation functions...
//	virtual	void	BeginUpdate	(void);
	virtual	bool	Update		(float& fTimeAllowed);
//	virtual	void	EndUpdate	(void);


protected:
	// Protected variables...


	// Protected functions...


private:
	// Internal typedef...
	typedef Asura_Streaming_Job PARENT;

	// Private variables...
	Asura_Streaming_ZoneDataState&	m_xZoneDataState;		// The data-state to mark as complete.


	// Private functions...
	Asura_Streaming_Job_DestroyZoneDataStateComplete  (const Asura_Streaming_Job_DestroyZoneDataStateComplete& xOther);

	Asura_Streaming_Job_DestroyZoneDataStateComplete&	operator=	(const Asura_Streaming_Job_DestroyZoneDataStateComplete& xOther);

};   // End of class 'Asura_Streaming_Job_DestroyZoneDataStateComplete'.


#endif   // ifndef __ASURA_STREAMING_JOB_STREAMZONEDATASTATE_H__

#endif	// ASURA_USE_STREAMING

/// End of file. ///
