vdj_pipe
pipeline for processing DNA sequence data
step_registry.hpp
Go to the documentation of this file.
1 
7 #ifndef STEP_REGISTRY_HPP_
8 #define STEP_REGISTRY_HPP_
9 #include <map>
10 #include <string>
11 #include <sstream>
12 #include "boost/multi_index_container.hpp"
13 #include "boost/multi_index/ordered_index.hpp"
14 #include "boost/multi_index/member.hpp"
15 #include "boost/range.hpp"
16 
17 #include "vdj_pipe/exception.hpp"
19 
20 namespace vdj_pipe{
21 namespace detail{ class Inserter; }
22 
26 public:
27  struct Meta {
28  Meta() {}
29 
31  std::string const& name,
32  std::string const& category,
33  std::string const& comment,
34  std::string const& description
35  )
36  : name_(name),
37  category_(category),
38  comment_(comment),
39  description_(description)
40  {}
41 
42  std::string name_, category_, comment_, description_;
43  };
44 
45 private:
46  typedef boost::multi_index_container<
47  Meta,
48  boost::multi_index::indexed_by<
49  boost::multi_index::ordered_unique<
50  boost::multi_index::member<Meta, std::string, &Meta::name_>
51  >,
52  boost::multi_index::ordered_non_unique<
53  boost::multi_index::member<Meta, std::string, &Meta::category_>
54  >
55  >
56  > mmap_t;
57  friend class detail::Inserter;
58 
59  Step_registry();
60 
61 public:
62  struct Err : public base_exception {};
63 
65  typedef mmap_t::const_iterator const_iterator;
66  typedef mmap_t::const_iterator iterator;
67  typedef boost::iterator_range<const_iterator> range;
68 
69  const_iterator begin() const {return mm_.begin();}
70  const_iterator end() const {return mm_.end();}
71 
72  static Step_registry const& get() {
73  static const Step_registry inst;
74  return inst;
75  }
76 
77  cats_t const& categories() const {return cats_;}
78 
79  boost::iterator_range<mmap_t::nth_index<1>::type::const_iterator>
80  category(std::string const& cat) const {
81  mmap_t::nth_index<1>::type const& ind = mm_.get<1>();
82  return ind.equal_range(cat);
83  }
84 
85 private:
87  cats_t cats_;
88 };
89 
90 }//namespace vdj_pipe
91 #endif /* STEP_REGISTRY_HPP_ */
mmap_t::const_iterator const_iterator
Definition: step_registry.hpp:65
boost::iterator_range< const_iterator > range
Definition: step_registry.hpp:67
Definition: step_registry.hpp:27
mmap_t::const_iterator iterator
Definition: step_registry.hpp:66
boost::multi_index_container< Meta, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< Meta, std::string,&Meta::name_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::member< Meta, std::string,&Meta::category_ > > > > mmap_t
Definition: step_registry.hpp:56
cats_t cats_
Definition: step_registry.hpp:87
const_iterator begin() const
Definition: step_registry.hpp:69
Definition: step_registry.cpp:26
mmap_t mm_
Definition: step_registry.hpp:86
cats_t const & categories() const
Definition: step_registry.hpp:77
detail::Vector_set< std::string > cats_t
Definition: step_registry.hpp:64
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
Definition: step_registry.hpp:25
boost::iterator_range< mmap_t::nth_index< 1 >::type::const_iterator > category(std::string const &cat) const
Definition: step_registry.hpp:80
Meta()
Definition: step_registry.hpp:28
std::string name_
Definition: step_registry.hpp:42
Meta(std::string const &name, std::string const &category, std::string const &comment, std::string const &description)
Definition: step_registry.hpp:30
Definition: step_registry.hpp:62
Definition: exception.hpp:23
const_iterator end() const
Definition: step_registry.hpp:70