#ifndef _PATTERN_COMMAND_H_ #define _PATTERN_COMMAND_H_ #include #include #include #include "../Thread/Lock.h" class CCommand { public: virtual bool DoProcess() = 0; virtual bool Destroy() = 0; // °³Ã¼ÀÇ »èÁ¦ ¹æ¹ýÀ» Á¤ÀÇÇÑ´Ù. // stack±â¹Ý °³Ã¼´Â ¾Æ¹« Àϵµ ÇÏÁö ¾Ê°í, Heap±â¹Ý °³Ã¼´Â delete this¸¦ ÇØ ÁÙ °Í. }; class CCommandProcess { public: typedef CCSLock CMDLock; typedef std::list CMDList; CCommandProcess(); ~CCommandProcess(); inline void Add(CCommand* lpNewCMD); void ProcessAll(); protected: void ClearAll(); CMDLock m_CMDLock; CMDList m_CMDList; }; inline void CCommandProcess::Add(CCommand* lpNewCMD) { if(NULL != lpNewCMD) { CMDLock::Syncronize sync(m_CMDLock); m_CMDList.push_back(lpNewCMD); } } #endif