//
// Asura_Animation_IK_Template_System.h
//
// Created by Richard Rice - 12/05/2008
// 
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __ASURA_ANIMATION_IK_TEMPLATE_SYSTEM_H__
#define __ASURA_ANIMATION_IK_TEMPLATE_SYSTEM_H__
#ifdef ASURA_USE_ANIMATION_IK_SOLVER

#include "Core/Asura_HashTree.h"

class Asura_Animation_IK_Template;


//Static class for storing all the IK templates
class Asura_Animation_IK_Template_System
{
	friend class Asura_Animation_IK_Template;

public :
	static void Initialise();
	static void Shutdown();
	static void Reset();

	static const Asura_Animation_IK_Template* FindTemplate(Asura_Hash_ID uHashID);


	#ifdef ASURA_TOOLS
	//Tools accessors for the lines and events.
	//Note that new templates aren't added to the end of the 'indexed' list , so
	//it isn't safe to store an index value for any length of time.
	static u_int GetNumberOfTemplates();
	static Asura_Animation_IK_Template* GetTemplateByHash(Asura_Hash_ID uHashID);
	static Asura_Animation_IK_Template* GetTemplateByIndex(u_int uIndex);

	static bool RenameTemplate(const char* szOldName,const char* szNewName);
	#endif
private :
	//tree traversal callbacks
	static void DeleteTemplate(Asura_Hash_ID uHash,Asura_Animation_IK_Template** ppxTemplate);

	// called by contructors/destructors
	static void AddTemplateToTree( Asura_Animation_IK_Template& xTemplate );
	static void RemoveTemplateFromTree( const Asura_Animation_IK_Template& xTemplate );


	static Asura_TemplateHashTree<Asura_Animation_IK_Template*> s_xTemplateTree;
	
};




#endif //ASURA_USE_ANIMATION_IK_SOLVER
#endif //__ASURA_ANIMATION_IK_TEMPLATE__SYSTEM_H__
