Loading...
Searching...
No Matches
ProcessingController.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_PROCESSINGCONTROLLER_H
#define OPENSHOT_PROCESSINGCONTROLLER_H
#include <mutex>
#include <string>
class ProcessingController{
private:
uint processingProgress;
bool processingFinished;
bool stopProcessing;
bool error = true;
std::string error_message;
std::mutex mtxProgress;
std::mutex mtxFinished;
std::mutex mtxStop;
std::mutex mtxerror;
public:
ProcessingController(){
processingProgress = 0;
stopProcessing = false;
processingFinished = false;
}
int GetFinished(){
std::lock_guard<std::mutex> lck (mtxFinished);
bool f = processingFinished;
return f;
}
void SetFinished(bool f){
std::lock_guard<std::mutex> lck (mtxFinished);
processingFinished = f;
}
void SetProgress(uint p){
std::lock_guard<std::mutex> lck (mtxProgress);
processingProgress = p;
}
int GetProgress(){
std::lock_guard<std::mutex> lck (mtxProgress);
uint p = processingProgress;
return p;
}
void CancelProcessing(){
std::lock_guard<std::mutex> lck (mtxStop);
stopProcessing = true;
}
bool ShouldStop(){
std::lock_guard<std::mutex> lck (mtxStop);
bool s = stopProcessing;
return s;
}
void SetError(bool err, std::string message){
std::lock_guard<std::mutex> lck (mtxerror);
error = err;
error_message = message;
}
bool GetError(){
std::lock_guard<std::mutex> lck (mtxerror);
bool e = error;
return e;
}
std::string GetErrorMessage(){
std::lock_guard<std::mutex> lck (mtxerror);
std::string message = error_message;
return message;
}
};
#endif
ProcessingController
Definition ProcessingController.h:20
ProcessingController::SetProgress
void SetProgress(uint p)
Definition ProcessingController.h:52
ProcessingController::ShouldStop
bool ShouldStop()
Definition ProcessingController.h:68
ProcessingController::CancelProcessing
void CancelProcessing()
Definition ProcessingController.h:63
ProcessingController::GetError
bool GetError()
Definition ProcessingController.h:80
ProcessingController::GetErrorMessage
std::string GetErrorMessage()
Definition ProcessingController.h:86
ProcessingController::SetError
void SetError(bool err, std::string message)
Definition ProcessingController.h:74
ProcessingController::GetFinished
int GetFinished()
Definition ProcessingController.h:41
ProcessingController::SetFinished
void SetFinished(bool f)
Definition ProcessingController.h:47
ProcessingController::ProcessingController
ProcessingController()
Definition ProcessingController.h:35
ProcessingController::GetProgress
int GetProgress()
Definition ProcessingController.h:57