-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlaunchfile.cpp
More file actions
39 lines (33 loc) · 1.22 KB
/
launchfile.cpp
File metadata and controls
39 lines (33 loc) · 1.22 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
#include "launchfile.h"
using namespace std;
void LaunchFile::updateParam(ptree & param , LaunchParam lp){
param.add("<xmlattr>.type", lp.ptype);
param.add("<xmlattr>.name", lp.name);
param.add("<xmlattr>.value", lp.value);
}
void LaunchFile::updateNode(ptree & node, LaunchNode ln){
node.add("<xmlattr>.type", ln.ntype);
node.add("<xmlattr>.pkg", ln.pkg);
node.add("<xmlattr>.name", ln.name);
node.add("<xmlattr>.output", ln.output);
//node.add("<xmlattr>.required", ln.required);
//node.add("<xmlattr>.launch_prefix", ln.launch_prefix);
for(LaunchParam lp : ln.params){
ptree & param = node.add("param", "");
updateParam(param, lp);
}
}
void LaunchFile::create(vector<LaunchNode> lnodes, vector<LaunchParam> lparams){
for (int i=0; i<lparams.size(); i++){
ptree & param = launch.add("launch.param", "");
updateParam(param, lparams[i]);
}
for(int i=0; i<lnodes.size(); i++){
ptree & node = launch.add("launch.node", "");
updateNode(node, lnodes[i]);
}
}
void LaunchFile::write(const char * dir){
string fullpath = string(dir)+filename;
write_xml(fullpath, launch, std::locale(), xml_writer_settings<char>(' ', 4));
}