📄 wartimereventtask.h
字号:
/** */#ifndef WAR_TIMER_EVENT_TASK_H#define WAR_TIMER_EVENT_TASK_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_TIMER_EVENT_H# include "WarTimerEvent.h"#endif#ifndef WAR_THREAD_POOL_TASK_H# include "WarThreadPoolTask.h"#endif#ifndef WAR_LOG_H# include "WarLog.h"#endif#ifndef WAR_TIMER_H# include "WarTimer.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarTimerEventTask : public WarThreadPoolTask{public: // LIFECYCLE enum TypeE { REQUEST_TIMER_EVENT = REQUEST_NOOP + 1 }; /** * Default constructor. */ WarTimerEventTask(war_timer_event_ptr_t& timerEvent, war_timer_ptr_t& Timer) : WarThreadPoolTask(REQUEST_TIMER_EVENT), mTimerEvent(timerEvent), mTimer(Timer) { } // OPERATORS /** * Assignment operator. * * @param from THe value to assign to this object. * * @return A reference to this object. */ WarTimerEventTask& operator=(WarTimerEventTask& from); // OPERATIONS // ACCESS // INQUIRY virtual std::string GetTypeName() const { return "REQUEST_TIMER_EVENT"; } virtual const std::string GetInfo() const { return mTimerEvent->Explain(); } protected: virtual void OnProcessing(WarThreadForPool * pThread) { try { mTimerEvent->DoTimer(); mTimer->OnCompleted(mTimerEvent); } catch(WarException& e) { WarLog err_log(WARLOG_ERROR, "WarTimerEventTask::OnProcessing()"); err_log << "Caught an unexpected exeption from a timer event. " << e.Explain() << mTimerEvent->Explain() << war_endl; } }private: war_timer_event_ptr_t mTimerEvent; war_timer_ptr_t mTimer;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WAR_TIMER_EVENT_TASK_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -