-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSubToolChain.cpp
More file actions
53 lines (35 loc) · 1.47 KB
/
SubToolChain.cpp
File metadata and controls
53 lines (35 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "SubToolChain.h"
#include "ToolChain.h"
SubToolChain::SubToolChain():Tool(){}
/*
Unlike Tools, the return type for the Initialise(), Execute() and Finalise() methods of ToolChains are int, NOT bool.
For that reason, we need to compare return value to zero to judge that the subtoolchain functioned properly.
*/
bool SubToolChain::Initialise(std::string configfile, DataModel &data){
if(configfile!="") m_variables.Initialise(configfile);
//m_variables.Print();
m_data= &data;
m_log= m_data->Log;
std::string tools_conf="";
int errorlevel=0;
if(!m_variables.Get("verbose",m_verbose)) m_verbose=1;
if(!m_variables.Get("Tools_file",tools_conf)) return false;
if(!m_variables.Get("error_level",errorlevel)) errorlevel=2;
m_subtoolchain=new ToolChain(m_verbose, errorlevel, true, false, "", false, m_data);
if(!m_subtoolchain->LoadTools(tools_conf)) return false;
if(!m_variables.Get("repeats_var", m_repeats_var)) m_repeats_var="";
m_repeats=1;
return (m_subtoolchain->Initialise() == 0);
}
bool SubToolChain::Execute(){
if(!m_repeats_var.empty() && !m_data->CStore.Get(m_repeats_var, m_repeats)){
throw std::runtime_error("SubToolChain:Execute : repeat flag set, but no variable in m_data->CStore matches the name "+m_repeats_var+"\n");
}
return (m_subtoolchain->Execute(m_repeats) == 0);
}
bool SubToolChain::Finalise(){
int ret = m_subtoolchain->Finalise();
delete m_subtoolchain;
m_subtoolchain=0;
return (ret == 0);
}