7 #ifndef VDJ_PIPE_VARIABLE_PATH_HPP_ 8 #define VDJ_PIPE_VARIABLE_PATH_HPP_ 10 #include "boost/foreach.hpp" 23 std::string
const& path,
24 std::vector<std::string>& tv,
25 std::vector<std::string>& nv
32 std::vector<std::string>
const& templ,
33 detail::Queable_ofstream_types::val_ref_vector
const& vals
42 void init(std::string
const& path, std::vector<std::string>& nv0) {
43 std::vector<std::string> nv;
45 if( nv0.empty() ) nv0 = nv;
46 ids_.reserve(nv.size());
47 BOOST_FOREACH(std::string s, nv) {
48 std::vector<std::string>::const_iterator i =
49 std::find(nv0.begin(), nv0.end(), s);
50 if( i == nv0.end() ) BOOST_THROW_EXCEPTION(
52 << Err::msg_t(
"unknown variable")
55 ids_.push_back(Val_id(i - nv0.begin()));
59 std::string operator()(
60 detail::Queable_ofstream_types::val_vector
const& vals
62 detail::Queable_ofstream_types::val_ref_vector vr;
63 vr.reserve(ids_.size());
64 BOOST_FOREACH(
const Val_id
id, ids_) {
65 vr.push_back(boost::cref(vals[
id()]));
70 std::string operator()()
const {
return pt_.front();}
71 bool empty()
const {
return pt_.empty();}
72 std::size_t size()
const {
return pt_.size();}
75 std::vector<Val_id> ids_;
76 std::vector<std::string> pt_;
Definition: variable_path.hpp:40
Main namespace of vdj_pipe library.
Definition: sequence_file.hpp:14
VDJ_PIPE_DECL void path_decompose(std::string const &path, std::vector< std::string > &tv, std::vector< std::string > &nv)
separate path into non-name and name areas
Definition: exception.hpp:23
Definition: variable_path.hpp:38
VDJ_PIPE_DECL std::string path_assemble(std::vector< std::string > const &templ, detail::Queable_ofstream_types::val_ref_vector const &vals)
assemble path from template and values