/************************************************************************

コマンドパターン用クラス

備考：デザインパターンを参考に作成
 *************************************************************************/

/* 多重インクルードの回避 */
#ifndef COMMAND_H_INCLUDED
#define COMMAND_H_INCLUDED

namespace uji{
namespace sys{

/************************************************************************
 ************************************************************************/
class Command
{

  public:
	virtual ~Command(){}
	virtual void Execute(void)=0;
	
  protected:
  	Command(){}

};

template<class T> class SimpleCommand : public Command
{

  public:
  	typedef void ( T::* ActionType )(void);
  	SimpleCommand( T* Receiver, ActionType Action ):m_Receiver(Receiver), m_Action(Action){}	

	virtual void Execute(void){
		(m_Receiver->*m_Action)();
	}

  private:
  	T*			m_Receiver;
  	ActionType	m_Action;

};

}
}//namespace

/* 多重インクルードの回避 */
#endif
