wartimereventtask.h
来自「ftpserver very good sample」· C头文件 代码 · 共 135 行
H
135 行
/** */#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 + =
减小字号Ctrl + -
显示快捷键?