#ifndef GlobalPointer_h
#define GlobalPointer_h


#include"../Setup/CompileMode.h"
#include"../auxiliary/Debug/CAssert.h"

namespace Maid
{
	template<class TYPE>
	class GlobalPointer
	{
	protected:

		void Set()
		{
			MAID_ASSERT( s_pPointer!=NULL, "すでに実態が存在します" );
			s_pPointer = static_cast<TYPE*>(this);
		}

		TYPE* Get()
		{
			MAID_ASSERT( s_pPointer==NULL, "まだ設定されていません" );
			return s_pPointer;
		}

		void Clear() { s_pPointer = NULL; }

	private:
		static TYPE*	s_pPointer;
	};

}


#endif
