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

#pragma once

#include <glmMotionDefinitions.h>
#include <glmBlendTreePosture.h>
#include <glmCachePerThread.h>

namespace glm
{
	/**
	 * \brief Cache for generalized animation files
	 *
	 * \author dev@golaem.com
	 *
	 */
	class GLM_SDK_API BlendTreePostureCache
	{
	public:
		/**
		* \brief BlendTreePostureArray, with array and size as member
		*/
		class Data
		{
		public:
			Data() : _postures(NULL), _size(0)
			{ }

			~Data()
			{
				GLM_SAFE_DELETE_ARRAY(_postures, getClassMemoryStatId())
			}

			BlendTreePosture* _postures;
			int _size;
		};

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared);

		BlendTreePostureCache()
			: _blendTreePosturesCache(getClassMemoryStatId())
		{}
		~BlendTreePostureCache() {}

		void clear() ;
		LockedThreadData<BlendTreePostureCache::Data> getBlendTreePostureArray(int atLeastSize) const;

	private:

		CachePerThread<BlendTreePostureCache::Data> _blendTreePosturesCache;
	};
}

