LocARNA-2.0.0
free_endgaps.hh
1 #ifndef LOCARNA_FREE_ENDGAPS_HH
2 #define LOCARNA_FREE_ENDGAPS_HH
3 
4 #ifdef HAVE_CONFIG_H
5 #include <config.h>
6 #endif
7 
8 namespace LocARNA {
15  class FreeEndgaps {
16  std::vector<bool> desc;
17 
18  public:
27  explicit FreeEndgaps(const std::string &d) : desc(4,false) {
28  if (d.length() >= 4) {
29  for (size_t i = 0; i < 4; i++)
30  desc[i] = (d[i] == '+');
31  }
32  }
33 
34  FreeEndgaps(): desc(4,false) {
35  }
36 
41  bool
42  allow_left_1() const {
43  return desc[0];
44  }
45 
50  bool
51  allow_right_1() const {
52  return desc[1];
53  }
54 
59  bool
60  allow_left_2() const {
61  return desc[2];
62  }
63 
68  bool
69  allow_right_2() const {
70  return desc[3];
71  }
72 
73  // change (in place) to free endgaps for reversed sequences
75  reverse() const {
76  FreeEndgaps rev_fe;
77  rev_fe.desc = { desc[1], desc[0], desc[3], desc[2] };
78  return rev_fe;
79  }
80 
81  };
82 } // end namespace LocARNA
83 
84 #endif // LOCARNA_FREE_ENDGAPS_HH
Description of free end gaps.
Definition: free_endgaps.hh:15
bool allow_left_2() const
Definition: free_endgaps.hh:60
bool allow_left_1() const
Definition: free_endgaps.hh:42
bool allow_right_1() const
Definition: free_endgaps.hh:51
FreeEndgaps(const std::string &d)
Construct from string description.
Definition: free_endgaps.hh:27
bool allow_right_2() const
Definition: free_endgaps.hh:69
Definition: aligner.cc:15