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

#pragma once

#include "glmAssert.h"
#include "glmTypes.h"
#include "glmMemory.h"
#include "glmDeque.h"

namespace glm
{
	template <typename _Ty, class Container = GlmDeque<_Ty> >
	class GlmQueue
	{
	public:

		typedef _Ty value_type;
		typedef size_t size_type;
		typedef Container container_type;

		typedef glm::GlmQueue < _Ty > ThisGlmQueue;
		GLM_CLASS_STAT_ID( getDefaultArrayMemoryStatId())

		// does not handle building queue from a container (notused in sdk/crowd)
		explicit GlmQueue(const MemAllocStatId memAllocStatId = getDefaultArrayMemoryStatId())
		: _container(memAllocStatId)
		{
		}

		void clear() { _container.clear();}

		bool empty() const { return _container.empty(); }
		size_type size() const { return _container.size(); }

		value_type& front() { return _container.front(); }
		const value_type& front() const { return _container.front(); }

		value_type& back() { return _container.back(); }
		const value_type& back() const { return _container.back(); }

		void push(const value_type& val) { return _container.push_back(val); }
		void pop() { return _container.pop_front(); }

		void push_back(const value_type& val) { return _container.push_back(val); }
		void pop_front() { return _container.pop_front(); }

	protected:
		MemAllocStatId _memAllocStatId;

		// ----------------------------------------------------------------------------------
		static GLM_FORCE_INLINE MemAllocStatId getDefaultArrayMemoryStatId()
		{
			return glm::MemoryStatIds::GolaemShared;
		}

	private:

		container_type _container;
	};
}
