/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
****************************************************************************/

#pragma once

#include "glmCoreAPI.h"
#include "glmCommon.h"
#include "glmPODArray.h"

namespace glm
{
	// index is current index in max array, up to 2^20 = 1 million
	// counter is used to compare reaffectation 
	// unused : the entity is not created.
	// -----------------------------------------------------------------------------
	class GLM_CORE_API ProcessingBatch
	{
	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::Simulation);

		// define a method pointer to process, which will be overriden by contexts, entities and actions managers to do their things.
		// therefore, the method content is defined next to the specific manager, and the process is generalized on engine Manager
		// which only handle threads stuff and call a func
		typedef void (ThreadUpdateMethod)(ProcessingBatch& batch);

		ProcessingBatch();

		ThreadUpdateMethod* _updateMethod;
		void*				_userData;
		Time				_dt;
		union
		{
			int64_t			_firstIndex; // inclusive
			int				_updateOrder; // not used when indices are used (filtered before)
			int				_setInitialized; // for set initialized batch
		};
		int64_t			_lastIndex;	 // inclusive
		int				_typeIndex;

		bool			_blocking;
	};
}
