7 #ifndef STEP_BUILDER_REGISTRY_HPP_ 8 #define STEP_BUILDER_REGISTRY_HPP_ 11 #include "boost/function.hpp" 12 #include "boost/mpl/bind.hpp" 13 #include "boost/mpl/fold.hpp" 14 #include "boost/mpl/for_each.hpp" 15 #include "boost/mpl/insert.hpp" 16 #include "boost/mpl/quote.hpp" 17 #include "boost/mpl/set.hpp" 18 #include "boost/property_tree/json_parser.hpp" 19 #include "boost/property_tree/ptree.hpp" 26 class Pipe_environment;
34 typedef typename Config::value_map_access
vm_access;
36 typedef boost::function<
49 explicit Insert(constructor_map_t& constr_map)
53 template<
class M>
static step_variant
make(
58 return M::make(vma, pt, pe);
62 const typename constructor_map_t::value_type p(
67 if( !
cm_->insert(p).second ) {
68 BOOST_THROW_EXCEPTION(
77 mutable constructor_map_t*
cm_;
82 typedef boost::mpl::quote1<Find_maker> maker;
85 typedef typename boost::mpl::fold<
86 typename step_variant::types,
90 boost::mpl::bind1<maker, boost::mpl::_2>
95 boost::mpl::for_each<maker_tl>(ins);
99 std::string
const& name,
100 vm_access
const& vma,
105 typename constructor_map_t::const_iterator i =
constr_map_.find(name);
106 if( i ==
constr_map_.end() ) BOOST_THROW_EXCEPTION(
111 return i->second(vma, pt, pe);
122 std::string
const& name,
123 vm_access
const& vma,
127 return get().
make_impl(name, vma, pt, pe);
131 vm_access
const& vma,
137 if( pt.size() > 1 ) BOOST_THROW_EXCEPTION(
141 std::string
const& name = pt.front().first;
142 return get().
make_impl(name, vma, pt.front().second, pe);
143 }
catch(boost::exception
const&) {
144 std::stringstream ss;
146 BOOST_THROW_EXCEPTION(
step_variant make_impl(std::string const &name, vm_access const &vma, boost::property_tree::ptree const &pt, Pipe_environment &pe) const
Definition: step_builder_registry.hpp:98
Config::processing_step step_variant
Definition: step_builder_registry.hpp:33
std::map< std::string, constructor_t > constructor_map_t
Definition: step_builder_registry.hpp:45
static step_variant make(std::string const &name, vm_access const &vma, boost::property_tree::ptree const &pt, Pipe_environment &pe)
Definition: step_builder_registry.hpp:121
Insert(constructor_map_t &constr_map)
Definition: step_builder_registry.hpp:49
constructor_map_t * cm_
Definition: step_builder_registry.hpp:77
Definition: step_builder_registry.hpp:32
boost::function< step_variant(vm_access const &, boost::property_tree::ptree const &, Pipe_environment &) > constructor_t
Definition: step_builder_registry.hpp:43
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
Definition: blank_step.hpp:20
boost::errinfo_nested_exception nested_t
Definition: exception.hpp:32
Definition: pipe_environment.hpp:26
void operator()(M const &) const
Definition: step_builder_registry.hpp:61
boost::error_info< struct errinfo_str1_, std::string > str1_t
Definition: exception.hpp:25
static step_variant make(vm_access const &vma, boost::property_tree::ptree const &pt, Pipe_environment &pe)
Definition: step_builder_registry.hpp:53
static step_variant make(vm_access const &vma, boost::property_tree::ptree const &pt, Pipe_environment &pe)
Definition: step_builder_registry.hpp:130
Definition: exception.hpp:23
boost::error_info< struct errinfo_message_, std::string > msg_t
Definition: exception.hpp:24
Step_builder_registry()
Definition: step_builder_registry.hpp:80
std::string sanitize(const char c)
Definition: sanitize_string.cpp:53
Config::value_map_access vm_access
Definition: step_builder_registry.hpp:34
Definition: step_builder_registry.hpp:47
constructor_map_t constr_map_
Definition: step_builder_registry.hpp:159
bpt::ptree ptree
Definition: processing_step_utils.hpp:19