#ifndef OPENSHOT_PROCESSINGCONTROLLER_H #define OPENSHOT_PROCESSINGCONTROLLER_H #include #include #include class ProcessingController{ private: uint processingProgress; bool processingFinished; bool stopProcessing; std::mutex mtxProgress; std::mutex mtxFinished; std::mutex mtxStop; public: ProcessingController(){ processingProgress = 0; stopProcessing = false; processingFinished = false; } int GetFinished(){ std::lock_guard lck (mtxFinished); bool f = processingFinished; return f; } void SetFinished(bool f){ std::lock_guard lck (mtxFinished); processingFinished = f; } void SetProgress(uint p){ std::lock_guard lck (mtxProgress); processingProgress = p; } int GetProgress(){ std::lock_guard lck (mtxProgress); uint p = processingProgress; return p; } void CancelProcessing(){ std::lock_guard lck (mtxStop); stopProcessing = true; } bool ShouldStop(){ std::lock_guard lck (mtxStop); bool s = stopProcessing; return s; } }; #endif