///////////////////////////////////////////////////////////////////////////////
/// @file deNetData.hpp
///
/// @brief 
///
/// @author trajar
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Jun 2002
/// @author trajar
/// @remarks Creation
///
///////////////////////////////////////////////////////////////////////////////

#ifndef	_DENETDATA_HPP
#define	_DENETDATA_HPP

#ifndef		_DENET_HPP
 #include	"deNet.hpp"
#endif

class deNetDataGroup;

//---------------------------------------------------------------------------
// deNetDataItem
//
// - base item transferred over network
//---------------------------------------------------------------------------
typedef class DENET_API deNetDataItem
{
public:
	
	deNetDataItem(void)					{ }
	virtual ~deNetDataItem(void)		{ }
	
	virtual bool		StreamFrom( const deNetDataItem * pFrom );
	virtual bool		ApplyFrom ( const deNetDataItem * pFrom );
	
	const char *		GetDataName(void)		const	{ return m_DataName; }
	DWORD				GetDataID(void)			const	{ return m_DataID; }
	DWORD				GetDataSize(void)		const	{ return m_DataSize; }
	deNetDataGroup *	GetGroup(void)			const	{ return m_Group; }

protected:

	virtual bool		DeadReckon( float fTime )		{ return true; }

	char				m_DataName[32];
	unsigned char		m_DataID;
	DWORD				m_DataSize;
	void *				m_RawData;
	deNetDataGroup *	m_Group;
	
} deNetDataItem, *pdeNetDataItem;

//---------------------------------------------------------------------------
// deNetDataGroup
//
// - simply a group of data objects grouped together for transfer
//---------------------------------------------------------------------------
typedef class DENET_API	deNetDataGroup
{
public:

	deNetDataGroup(void)	: m_DataItems(NULL)	{ }
	~deNetDataGroup(void)						{ SAFE_DELETE_ARRAY( m_DataItems ); }

	deNetDataItem	*	GetItemAt( unsigned int iIndex )			{ deASSERT( m_NumDataItems > iIndex ); return m_DataItems + iIndex; }
	unsigned int		GetNumItems(void)					const	{ return m_NumDataItems; }
	bool				IsDeadReckoned(void)				const	{ return m_bDeadReckoning; }
	float				GetAbsTime(void)					const	{ return m_fAbsTime; }
	unsigned int		GetGroupID(void)					const	{ return m_GroupID; }
	
protected:

	unsigned int		m_GroupID;
	deNetDataItem	*	m_DataItems;
	unsigned char		m_NumDataItems;
	bool				m_bDeadReckoning;
	float				m_fAbsTime;

} deNetDataGroup, *pdeNetDataGroup;

#endif