GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/RenderBackend/backend_status.cpp Lines: 22 23 95.7 %
Date: 2023-10-11 10:52:07 Branches: 47 50 94.0 %

Line Branch Exec Source
1
/***************************************
2
	Auteur : Pierre Aubert
3
	Mail : pierre.aubert@lapp.in2p3.fr
4
	Licence : CeCILL-C
5
****************************************/
6
7
#include "string_utils.h"
8
#include "backend_status.h"
9
10
///Get the status of the given scene
11
/**	@param scene : Scene we want the status
12
*/
13
2
void backend_getSceneStatus(const Scene & scene){
14


2
	std::cout << termCyan() << "Scene"<<termDefault()<<" : '"<<scene.getName()<<"' => rendering : ";
15
	//Check if the Output render directory does exist
16

4
	std::string renderDir(scene.getWorkingDirectory()+"/"+scene.getOutputRenderDirectory());
17
2
	if(isFileOrDirExist(renderDir)){
18
		//Then, count the number of files in it to evaluate progression
19
2
		std::list<std::string> listFile;
20
1
		getListAllFileInDir(listFile, renderDir);
21
1
		int expectedNumberOfFile(scene.getLastFrame() - scene.getFirstFrame() + 1);
22
1
		int progression((100*((int)listFile.size()))/expectedNumberOfFile);
23



1
		std::cout << "["<<scene.getFirstFrame()<<", "<<scene.getLastFrame()<<"] "<<expectedNumberOfFile<<" Frames, Found "<<listFile.size()<<", Progression : " << progression << " %";
24
	}else{
25
1
		std::cout << "Not synchronised yet (no directory '"<<renderDir<<"')";
26
	}
27
2
	std::cout << std::endl;
28
2
}
29
30
///Get the status of scenes
31
/**	@param[out] isSuccess : true if getting the status was a success
32
 * 	@param renderProject : render project to be used
33
 * 	@param wantStatus : true if we want to print the status of scenes
34
 *	@param vecStatusScene : vector of scene names to get theirs status (get all status if empty)
35
 *	@return true if the function was called
36
*/
37
5
bool backend_status(bool & isSuccess, const RenderProject & renderProject, bool wantStatus, const std::vector<std::string> & vecStatusScene){
38
5
	if(!wantStatus){return false;}
39
3
	const std::map<std::string, Scene> & mapScene = renderProject.getMapScene();
40
3
	if(vecStatusScene.size() == 0lu){
41
4
		for(std::map<std::string, Scene>::const_iterator it(mapScene.begin()); it != mapScene.end(); ++it){
42
2
			backend_getSceneStatus(it->second);
43
		}
44
	}else{
45
2
		for(std::vector<std::string>::const_iterator it(vecStatusScene.begin()); it != vecStatusScene.end(); ++it){
46
1
			std::map<std::string, Scene>::const_iterator itFind(mapScene.find(*it));
47
1
			if(itFind != mapScene.end()){
48
				backend_getSceneStatus(itFind->second);
49
			}
50
		}
51
	}
52
3
	return true;
53
}
54
55