00001 #ifndef Impala_Process_Manager_h
00002 #define Impala_Process_Manager_h
00003
00004 namespace Impala
00005 {
00006 namespace Process
00007 {
00008
00009
00010
00011
00012
00013 class Manager
00014 {
00015
00016 public:
00017
00018
00019 static const int STATE_RUNNING = -1;
00020 static const int STATE_TERM_SUCCESS = 0;
00021 static const int STATE_TERM_ERROR = 1;
00022 static const int STATE_TERM_ABNORMAL = 2;
00023 static const int STATE_UNKNOWN = 9;
00024
00025 static const int WAIT_INTERVAL_SEC = 5;
00026
00027 virtual ~Manager()
00028 {
00029 }
00030
00031
00032
00033
00034 virtual int Create(const std::string& cmdLine, std::string application = "") = 0;
00035
00036 virtual int GetManagedProcessCount() const = 0;
00037
00038 virtual bool IsRunning(int handle) = 0;
00039
00040
00041 virtual bool IsTerminated(int handle) = 0;
00042
00043
00044 virtual void Sleep(int sec) = 0;
00045
00046
00047
00048
00049
00050
00051
00052 virtual void Kill(int handle) = 0;
00053
00054
00055 virtual void Remove(int handle) = 0;
00056
00057
00058 virtual int GetState(int handle) = 0;
00059
00060
00061 virtual int GetExitCode(int handle) = 0;
00062
00063 protected:
00064
00065 private:
00066
00067 };
00068
00069 }
00070 }
00071
00072 #endif