00001 #ifndef Impala_Core_VideoJob_Data_h 00002 #define Impala_Core_VideoJob_Data_h 00003 00004 #include <vector> 00005 #include <deque> 00006 #include <map> 00007 00008 #include "Job/State.h" 00009 #include "Core/VideoJob/ProcessDefinition.h" 00010 00011 namespace Impala 00012 { 00013 namespace Core 00014 { 00015 namespace VideoJob 00016 { 00017 00018 /*********************************************************************** 00019 An instance of this class holds data used for processing a video set. 00020 ************************************************************************/ 00021 00022 class Data 00023 { 00024 00025 public: 00026 00027 typedef struct VideoJob 00028 { 00029 int stepNr; 00030 int videoNr; 00031 int videoNrCompact; 00032 bool isIndiv; 00033 int id; 00034 Job::State::StateType state; 00035 int exitCode; 00036 } VideoJob; 00037 00038 typedef struct VideoMeta 00039 { 00040 int videoNr; 00041 bool discarded; 00042 std::vector<VideoJob*> jobs; 00043 } VideoMeta; 00044 00045 Data() 00046 { 00047 mInitialMask = ""; 00048 mCountOfWaitingJobs = 0; 00049 } 00050 00051 virtual 00052 ~Data() 00053 { 00054 if (mProcessDef) 00055 delete mProcessDef; 00056 00057 std::deque<VideoJob*>::iterator jobIter = mAllJobs.begin(); 00058 while (jobIter < mAllJobs.end()) 00059 { 00060 delete *(jobIter); 00061 *jobIter = 0; 00062 jobIter++; 00063 } 00064 } 00065 00066 int 00067 VideoSetSize() const 00068 { 00069 return mVideoSetSize; 00070 } 00071 00072 bool 00073 IsValid(int video) const 00074 { 00075 return !( WasInitiallyMaskedOut(video) || IsDiscarded(video) ); 00076 } 00077 00078 bool 00079 WasInitiallyMaskedOut(int video) const 00080 { 00081 return (video < mInitialMask.size() && mInitialMask[video] != '1'); 00082 } 00083 00084 bool 00085 IsDiscarded(int video) const 00086 { 00087 std::map<int, VideoMeta>::const_iterator iter = mVideos.find(video); 00088 return (iter->second.discarded) ? true : false; 00089 } 00090 00091 String mVideoSetName; 00092 int mVideoSetSize; 00093 00094 String mProcessDefFile; 00095 00096 String mServerName; 00097 int mPort; 00098 String mPasswordFile; 00099 00100 String mInitialMask; 00101 ProcessDefinition* mProcessDef; 00102 std::map<int, VideoMeta> mVideos; 00103 std::map<int, VideoJob*> mJobsScheduled; 00104 std::deque<VideoJob*> mAllJobs; 00105 int mCountOfWaitingJobs; 00106 00107 private: 00108 00109 }; // class 00110 00111 } // namespace 00112 } // namespace 00113 } // namespace 00114 00115 #endif