/* */ #ifndef _D_TIME_BASED_COMMAND_H_ #define _D_TIME_BASED_COMMAND_H_ #include "Command.h" #include "TimeA2.h" namespace aria2 { class DownloadEngine; class TimeBasedCommand : public Command { protected: DownloadEngine* _e; /** * setting _exit to true if this command's job has finished and you want to * delete this command. * The _exit variable is evaluated after preProcess(), process(), * postProcess(), and terminate processing immediately and excute() returns * true. */ bool _exit; time_t _interval; // unit: sec bool _routineCommand; private: Time _checkPoint; public: /** * preProcess() is called each time when excute() is called. */ virtual void preProcess() {}; /** * process() is called only when excute() is called and specified time has * elapsed. */ virtual void process() = 0; /** * postProcess() is called each time when excute() is called. */ virtual void postProcess() {}; public: TimeBasedCommand(int32_t cuid, DownloadEngine* e, time_t interval, bool routineCommand = false); virtual ~TimeBasedCommand(); virtual bool execute(); }; } // namespace aria2 #endif // _D_TIME_BASED_COMMAND_H_