vdj_pipe
pipeline for processing DNA sequence data
combine_option_trees.hpp
Go to the documentation of this file.
1 
7 #ifndef COMBINE_OPTION_TREES_HPP_
8 #define COMBINE_OPTION_TREES_HPP_
9 #include "boost/foreach.hpp"
10 #include "boost/property_tree/ptree.hpp"
11 namespace bpt = boost::property_tree;
12 
13 #include "keywords_root.hpp"
14 
15 namespace vdj_pipe{
16 
20  bpt::ptree& pt1,
21  bpt::ptree const& pt2
22 ) {
23  BOOST_FOREACH(bpt::ptree::value_type const& vt, pt2) {
24 
25  //combine input section entries
26  if( vt.first == kwds::Root::input() ) {
27  if( ! pt1.count(kwds::Root::input()) ) {
28  pt1.put_child(kwds::Root::input(), bpt::ptree());
29  }
30  bpt::ptree& in1 = pt1.get_child(kwds::Root::input());
31  in1.insert(in1.end(), vt.second.begin(), vt.second.end());
32 
33  } else if( vt.first == kwds::Root::input_csv() ) {
34  if( ! pt1.count(kwds::Root::input_csv()) ) {
35  pt1.put_child(kwds::Root::input_csv(), bpt::ptree());
36  }
37  bpt::ptree& in1 = pt1.get_child(kwds::Root::input_csv());
38  in1.insert(in1.end(), vt.second.begin(), vt.second.end());
39 
40 
41  } else if( ! pt1.count(vt.first) ) {
42  //insert other entries
43  //entries already present in pt1 take precedence
44  pt1.push_back(vt);
45 
46  }
47  }
48 }
49 
50 }//namespace vdj_pipe
51 #endif /* COMBINE_OPTION_TREES_HPP_ */
void combine_option_trees(bpt::ptree &pt1, bpt::ptree const &pt2)
Definition: combine_option_trees.hpp:19
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
bpt::ptree ptree
Definition: processing_step_utils.hpp:19